Changeset 2878471
- Timestamp:
- 03/11/2023 03:38:23 PM (3 years ago)
- Location:
- diff-check
- Files:
-
- 6 added
- 2 edited
-
assets/screenshot-2.png (added)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/diff_check.php (modified) (2 diffs)
-
trunk/includes/css/diff_check_block.css (added)
-
trunk/includes/css/diff_check_frontend.css (added)
-
trunk/includes/gutenberg-block.php (added)
-
trunk/includes/js/diff_check_block.js (added)
-
trunk/includes/shortcodes.php (added)
Legend:
- Unmodified
- Added
- Removed
-
diff-check/trunk/README.txt
r2878345 r2878471 5 5 Tested up to: 6.1 6 6 Requires PHP: 5.4 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 Donate link: https://plugins.club/wordpress/diff-check/ 9 9 License: GPLv2 or later … … 14 14 DiffCheck allows you to display side-by-side comparisons of two text files. 15 15 16 This plugin is ultra-lightweight (6KB) and uses WordPress's already built-in revision function. 16 This plugin is ultra-lightweight (7KB) and uses WordPress's already built-in revision function. 17 18 *NEW!* The plugin now supports Gutenberg and you can use the "DiffCheck" block to comare two texts. 17 19 18 20 = How to compare two files = … … 32 34 == Changelog == 33 35 36 = 1.1 = 37 * Added gutenberg block 38 34 39 = 1.0 = 35 40 The first stable public version. -
diff-check/trunk/diff_check.php
r2878334 r2878471 4 4 Plugin URI: https://plugins.club/wordpress/diff-check/ 5 5 Description: Display a side-by-side comparison of two texts or files. 6 Version: 1. 06 Version: 1.1 7 7 Author: plugins.club 8 8 Author URI: https://plugins.club … … 12 12 wp_enqueue_script( 'diff_check', plugin_dir_url( __FILE__ ) . 'includes/js/diff_check.js', array(), '1.0.0', true ); 13 13 wp_enqueue_style( 'diff_check', plugin_dir_url( __FILE__ ) . 'includes/css/diff_check.css', array(), '1.0.0' ); 14 wp_enqueue_script( 'diff_check', plugin_dir_url( __FILE__ ) . 'includes/js/diff_check.js', array( 'wp-blocks', 'wp-editor', 'wp-element' ), '1.0.0', true ); 15 wp_enqueue_script( 'diff_check_block', plugin_dir_url( __FILE__ ) . 'includes/js/diff_check_block.js', array( 'wp-blocks', 'wp-editor', 'wp-element' ), '1.0.0', true ); 14 16 } 15 17 add_action( 'wp_enqueue_scripts', 'diff_check_scripts' ); 16 18 17 function diff_check_shortcode( $atts ) { 18 $atts = shortcode_atts( array( 19 'text1' => '', 20 'text2' => '', 21 'file1' => '', 22 'file2' => '', 23 ), $atts, 'diff_check' ); 24 25 if($atts['file1'] != ''){ 26 $text1 = file_get_contents($atts['file1']); 27 }else{ 28 $text1 = $atts['text1']; 29 } 30 31 if($atts['file2'] != ''){ 32 $text2 = file_get_contents($atts['file2']); 33 }else{ 34 $text2 = $atts['text2']; 35 } 36 37 $diff = wp_text_diff( $text1, $text2 ); 38 $differences_count = substr_count($diff,'<ins>') + substr_count($diff,'<del>'); 39 40 return '<div class="diff-check">' . $diff . '</div><p>Differences found: '.$differences_count.'</p>'; 41 } 42 43 add_shortcode( 'diff_check', 'diff_check_shortcode' ); 19 // Include Gutenberg block 20 require_once plugin_dir_path( __FILE__ ) . 'includes/gutenberg-block.php'; 21 // Include Shortcodes 22 require_once plugin_dir_path( __FILE__ ) . 'includes/shortcodes.php';
Note: See TracChangeset
for help on using the changeset viewer.