Changeset 3455510
- Timestamp:
- 02/06/2026 03:46:34 PM (8 weeks ago)
- Location:
- remove-empty-shortcodes
- Files:
-
- 32 added
- 2 deleted
- 4 edited
- 1 copied
-
assets/banner-772x250.jpg (deleted)
-
assets/banner-772x250.png (added)
-
assets/icon-256x256.jpg (deleted)
-
assets/icon-256x256.png (added)
-
assets/screenshot-1.png (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
tags/1.0.0 (copied) (copied from remove-empty-shortcodes/trunk)
-
tags/1.0.0/.distignore (added)
-
tags/1.0.0/README.txt (modified) (3 diffs)
-
tags/1.0.0/assets (added)
-
tags/1.0.0/assets/css (added)
-
tags/1.0.0/assets/css/admin.css (added)
-
tags/1.0.0/assets/js (added)
-
tags/1.0.0/assets/js/admin.js (added)
-
tags/1.0.0/includes (added)
-
tags/1.0.0/includes/class-admin-page.php (added)
-
tags/1.0.0/includes/class-cache-manager.php (added)
-
tags/1.0.0/includes/class-plugin.php (added)
-
tags/1.0.0/includes/class-shortcode-scanner.php (added)
-
tags/1.0.0/remove-empty-shortcodes.php (modified) (5 diffs)
-
tags/1.0.0/templates (added)
-
tags/1.0.0/templates/admin-page.php (added)
-
trunk/.distignore (added)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/assets (added)
-
trunk/assets/css (added)
-
trunk/assets/css/admin.css (added)
-
trunk/assets/js (added)
-
trunk/assets/js/admin.js (added)
-
trunk/includes (added)
-
trunk/includes/class-admin-page.php (added)
-
trunk/includes/class-cache-manager.php (added)
-
trunk/includes/class-plugin.php (added)
-
trunk/includes/class-shortcode-scanner.php (added)
-
trunk/remove-empty-shortcodes.php (modified) (5 diffs)
-
trunk/templates (added)
-
trunk/templates/admin-page.php (added)
Legend:
- Unmodified
- Added
- Removed
-
remove-empty-shortcodes/tags/1.0.0/README.txt
r3278389 r3455510 1 1 === Remove Empty Shortcodes === 2 2 Contributors: tommcfarlin 3 Donate link: https://buymeacoffee.com/tommcfarlin 3 4 Tags: shortcodes, content, cleanup, maintenance, content management 4 5 Requires at least: 5.0 5 Tested up to: 6. 86 Stable tag: 0.7.06 Tested up to: 6.9 7 Stable tag: 1.0.0 7 8 Requires PHP: 7.4 8 9 License: GPL-3.0 … … 23 24 * Automatically removes inactive shortcodes from displayed content 24 25 * Preserves your original content in the database 25 * Works with both posts and pages26 * Works with all public post types 26 27 * Handles both self-closing and wrapped shortcodes 27 * Zero configuration required 28 * Admin scanner to find and review unregistered shortcodes 29 * On-demand scanning with cached results 30 * Ignore specific shortcodes you want to keep 31 * Zero configuration required for automatic removal 28 32 29 33 = How It Works = … … 71 75 No. The plugin works automatically once activated. 72 76 77 = How do I find unregistered shortcodes on my site? = 78 79 Go to Tools > Empty Shortcodes in your WordPress admin. Click "Run Scan" to search all your content for shortcodes that are no longer registered with WordPress. 80 81 = What does "Ignore" do in the scanner? = 82 83 Ignoring a shortcode adds it to a global ignore list. The scanner will no longer flag that shortcode, and the automatic removal feature will leave it untouched. Use this for shortcodes you intentionally want to keep. 84 85 == Screenshots == 86 87 1. Scanner ready to scan your content for unregistered shortcodes 88 2. Scan results showing unregistered shortcodes found across your site 89 3. Expanded view showing context preview and edit options for each shortcode 90 4. By Post view showing all affected posts with their shortcodes 91 73 92 == Changelog == 93 94 = 1.0.0 = 95 * Admin page under Tools menu for scanning and managing unregistered shortcodes 96 * On-demand scanning with progress indicator and cached results 97 * Two view modes: By Shortcode and By Post 98 * Context preview showing surrounding text for each shortcode 99 * Global ignore list for shortcodes you want to keep 100 * Support for all public post types 101 * Fixed false positive shortcode detection 102 * New abstract blue branding 103 * Restructured plugin with class-based architecture 74 104 75 105 = 0.7.0 = -
remove-empty-shortcodes/tags/1.0.0/remove-empty-shortcodes.php
r3278389 r3455510 15 15 * Plugin URI: https://github.com/tommcfarlin/remove-empty-shortcodes/ 16 16 * Description: Removes empty shortcodes from WordPress standard posts and pages. 17 * Version: 0.7.017 * Version: 1.0.0 18 18 * Author: Tom McFarlin 19 19 * Author URI: https://tommcfarlin.com … … 30 30 31 31 // Define plugin constants. 32 const VERSION = ' 0.6.0';32 const VERSION = '1.0.0'; 33 33 const SUPPORTED_POST_TYPES = array( 'post', 'page' ); 34 const SHORTCODE_PATTERN = '/\[(\[?)([^\s\]]+)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s'; 34 35 // Autoload classes. 36 spl_autoload_register( 37 function ( $class ) { 38 $prefix = 'TomMcFarlin\\RESC\\'; 39 $base_dir = __DIR__ . '/includes/'; 40 41 $len = strlen( $prefix ); 42 if ( strncmp( $prefix, $class, $len ) !== 0 ) { 43 return; 44 } 45 46 $relative_class = substr( $class, $len ); 47 48 // Convert CamelCase to kebab-case. 49 $filename = strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', $relative_class ) ); 50 $file = $base_dir . 'class-' . $filename . '.php'; 51 52 if ( file_exists( $file ) ) { 53 require $file; 54 } 55 } 56 ); 35 57 36 58 /** … … 41 63 function init() { 42 64 add_filter( 'the_content', __NAMESPACE__ . '\process_shortcodes' ); 65 66 // Initialize admin functionality. 67 if ( is_admin() ) { 68 Plugin::get_instance()->init(); 69 } 43 70 } 44 71 add_action( 'init', __NAMESPACE__ . '\init' ); … … 60 87 */ 61 88 function find_shortcodes( $content ) { 62 if ( ! preg_match_all( SHORTCODE_PATTERN, $content, $matches, PREG_SET_ORDER ) ) { 89 $pattern = get_shortcode_regex(); 90 91 if ( ! preg_match_all( '/' . $pattern . '/s', $content, $matches, PREG_SET_ORDER ) ) { 63 92 return array(); 64 93 } … … 77 106 foreach ( $shortcodes as $match ) { 78 107 $original_shortcode = $match[0]; 79 $shortcode_name = $match[2];80 108 81 if ( ! shortcode_exists( $shortcode_name ) ) {82 $content = str_replace( $original_shortcode, '', $content );109 // Skip escaped shortcodes [[like_this]]. 110 if ( ! empty( $match[1] ) && ! empty( $match[6] ) ) { 83 111 continue; 84 112 } -
remove-empty-shortcodes/trunk/README.txt
r3278389 r3455510 1 1 === Remove Empty Shortcodes === 2 2 Contributors: tommcfarlin 3 Donate link: https://buymeacoffee.com/tommcfarlin 3 4 Tags: shortcodes, content, cleanup, maintenance, content management 4 5 Requires at least: 5.0 5 Tested up to: 6. 86 Stable tag: 0.7.06 Tested up to: 6.9 7 Stable tag: 1.0.0 7 8 Requires PHP: 7.4 8 9 License: GPL-3.0 … … 23 24 * Automatically removes inactive shortcodes from displayed content 24 25 * Preserves your original content in the database 25 * Works with both posts and pages26 * Works with all public post types 26 27 * Handles both self-closing and wrapped shortcodes 27 * Zero configuration required 28 * Admin scanner to find and review unregistered shortcodes 29 * On-demand scanning with cached results 30 * Ignore specific shortcodes you want to keep 31 * Zero configuration required for automatic removal 28 32 29 33 = How It Works = … … 71 75 No. The plugin works automatically once activated. 72 76 77 = How do I find unregistered shortcodes on my site? = 78 79 Go to Tools > Empty Shortcodes in your WordPress admin. Click "Run Scan" to search all your content for shortcodes that are no longer registered with WordPress. 80 81 = What does "Ignore" do in the scanner? = 82 83 Ignoring a shortcode adds it to a global ignore list. The scanner will no longer flag that shortcode, and the automatic removal feature will leave it untouched. Use this for shortcodes you intentionally want to keep. 84 85 == Screenshots == 86 87 1. Scanner ready to scan your content for unregistered shortcodes 88 2. Scan results showing unregistered shortcodes found across your site 89 3. Expanded view showing context preview and edit options for each shortcode 90 4. By Post view showing all affected posts with their shortcodes 91 73 92 == Changelog == 93 94 = 1.0.0 = 95 * Admin page under Tools menu for scanning and managing unregistered shortcodes 96 * On-demand scanning with progress indicator and cached results 97 * Two view modes: By Shortcode and By Post 98 * Context preview showing surrounding text for each shortcode 99 * Global ignore list for shortcodes you want to keep 100 * Support for all public post types 101 * Fixed false positive shortcode detection 102 * New abstract blue branding 103 * Restructured plugin with class-based architecture 74 104 75 105 = 0.7.0 = -
remove-empty-shortcodes/trunk/remove-empty-shortcodes.php
r3278389 r3455510 15 15 * Plugin URI: https://github.com/tommcfarlin/remove-empty-shortcodes/ 16 16 * Description: Removes empty shortcodes from WordPress standard posts and pages. 17 * Version: 0.7.017 * Version: 1.0.0 18 18 * Author: Tom McFarlin 19 19 * Author URI: https://tommcfarlin.com … … 30 30 31 31 // Define plugin constants. 32 const VERSION = ' 0.6.0';32 const VERSION = '1.0.0'; 33 33 const SUPPORTED_POST_TYPES = array( 'post', 'page' ); 34 const SHORTCODE_PATTERN = '/\[(\[?)([^\s\]]+)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s'; 34 35 // Autoload classes. 36 spl_autoload_register( 37 function ( $class ) { 38 $prefix = 'TomMcFarlin\\RESC\\'; 39 $base_dir = __DIR__ . '/includes/'; 40 41 $len = strlen( $prefix ); 42 if ( strncmp( $prefix, $class, $len ) !== 0 ) { 43 return; 44 } 45 46 $relative_class = substr( $class, $len ); 47 48 // Convert CamelCase to kebab-case. 49 $filename = strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', $relative_class ) ); 50 $file = $base_dir . 'class-' . $filename . '.php'; 51 52 if ( file_exists( $file ) ) { 53 require $file; 54 } 55 } 56 ); 35 57 36 58 /** … … 41 63 function init() { 42 64 add_filter( 'the_content', __NAMESPACE__ . '\process_shortcodes' ); 65 66 // Initialize admin functionality. 67 if ( is_admin() ) { 68 Plugin::get_instance()->init(); 69 } 43 70 } 44 71 add_action( 'init', __NAMESPACE__ . '\init' ); … … 60 87 */ 61 88 function find_shortcodes( $content ) { 62 if ( ! preg_match_all( SHORTCODE_PATTERN, $content, $matches, PREG_SET_ORDER ) ) { 89 $pattern = get_shortcode_regex(); 90 91 if ( ! preg_match_all( '/' . $pattern . '/s', $content, $matches, PREG_SET_ORDER ) ) { 63 92 return array(); 64 93 } … … 77 106 foreach ( $shortcodes as $match ) { 78 107 $original_shortcode = $match[0]; 79 $shortcode_name = $match[2];80 108 81 if ( ! shortcode_exists( $shortcode_name ) ) {82 $content = str_replace( $original_shortcode, '', $content );109 // Skip escaped shortcodes [[like_this]]. 110 if ( ! empty( $match[1] ) && ! empty( $match[6] ) ) { 83 111 continue; 84 112 }
Note: See TracChangeset
for help on using the changeset viewer.