Plugin Directory

Changeset 3455510


Ignore:
Timestamp:
02/06/2026 03:46:34 PM (8 weeks ago)
Author:
tommcfarlin
Message:

Update to version 1.0.0 from GitHub

Location:
remove-empty-shortcodes
Files:
32 added
2 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • remove-empty-shortcodes/tags/1.0.0/README.txt

    r3278389 r3455510  
    11=== Remove Empty Shortcodes ===
    22Contributors: tommcfarlin
     3Donate link: https://buymeacoffee.com/tommcfarlin
    34Tags: shortcodes, content, cleanup, maintenance, content management
    45Requires at least: 5.0
    5 Tested up to: 6.8
    6 Stable tag: 0.7.0
     6Tested up to: 6.9
     7Stable tag: 1.0.0
    78Requires PHP: 7.4
    89License: GPL-3.0
     
    2324* Automatically removes inactive shortcodes from displayed content
    2425* Preserves your original content in the database
    25 * Works with both posts and pages
     26* Works with all public post types
    2627* 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
    2832
    2933= How It Works =
     
    7175No. The plugin works automatically once activated.
    7276
     77= How do I find unregistered shortcodes on my site? =
     78
     79Go 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
     83Ignoring 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
     871. Scanner ready to scan your content for unregistered shortcodes
     882. Scan results showing unregistered shortcodes found across your site
     893. Expanded view showing context preview and edit options for each shortcode
     904. By Post view showing all affected posts with their shortcodes
     91
    7392== 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
    74104
    75105= 0.7.0 =
  • remove-empty-shortcodes/tags/1.0.0/remove-empty-shortcodes.php

    r3278389 r3455510  
    1515 * Plugin URI:        https://github.com/tommcfarlin/remove-empty-shortcodes/
    1616 * Description:       Removes empty shortcodes from WordPress standard posts and pages.
    17  * Version:           0.7.0
     17 * Version:           1.0.0
    1818 * Author:            Tom McFarlin
    1919 * Author URI:        https://tommcfarlin.com
     
    3030
    3131// Define plugin constants.
    32 const VERSION              = '0.6.0';
     32const VERSION              = '1.0.0';
    3333const SUPPORTED_POST_TYPES = array( 'post', 'page' );
    34 const SHORTCODE_PATTERN    = '/\[(\[?)([^\s\]]+)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s';
     34
     35// Autoload classes.
     36spl_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);
    3557
    3658/**
     
    4163function init() {
    4264    add_filter( 'the_content', __NAMESPACE__ . '\process_shortcodes' );
     65
     66    // Initialize admin functionality.
     67    if ( is_admin() ) {
     68        Plugin::get_instance()->init();
     69    }
    4370}
    4471add_action( 'init', __NAMESPACE__ . '\init' );
     
    6087 */
    6188function 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 ) ) {
    6392        return array();
    6493    }
     
    77106    foreach ( $shortcodes as $match ) {
    78107        $original_shortcode = $match[0];
    79         $shortcode_name     = $match[2];
    80108
    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] ) ) {
    83111            continue;
    84112        }
  • remove-empty-shortcodes/trunk/README.txt

    r3278389 r3455510  
    11=== Remove Empty Shortcodes ===
    22Contributors: tommcfarlin
     3Donate link: https://buymeacoffee.com/tommcfarlin
    34Tags: shortcodes, content, cleanup, maintenance, content management
    45Requires at least: 5.0
    5 Tested up to: 6.8
    6 Stable tag: 0.7.0
     6Tested up to: 6.9
     7Stable tag: 1.0.0
    78Requires PHP: 7.4
    89License: GPL-3.0
     
    2324* Automatically removes inactive shortcodes from displayed content
    2425* Preserves your original content in the database
    25 * Works with both posts and pages
     26* Works with all public post types
    2627* 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
    2832
    2933= How It Works =
     
    7175No. The plugin works automatically once activated.
    7276
     77= How do I find unregistered shortcodes on my site? =
     78
     79Go 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
     83Ignoring 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
     871. Scanner ready to scan your content for unregistered shortcodes
     882. Scan results showing unregistered shortcodes found across your site
     893. Expanded view showing context preview and edit options for each shortcode
     904. By Post view showing all affected posts with their shortcodes
     91
    7392== 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
    74104
    75105= 0.7.0 =
  • remove-empty-shortcodes/trunk/remove-empty-shortcodes.php

    r3278389 r3455510  
    1515 * Plugin URI:        https://github.com/tommcfarlin/remove-empty-shortcodes/
    1616 * Description:       Removes empty shortcodes from WordPress standard posts and pages.
    17  * Version:           0.7.0
     17 * Version:           1.0.0
    1818 * Author:            Tom McFarlin
    1919 * Author URI:        https://tommcfarlin.com
     
    3030
    3131// Define plugin constants.
    32 const VERSION              = '0.6.0';
     32const VERSION              = '1.0.0';
    3333const SUPPORTED_POST_TYPES = array( 'post', 'page' );
    34 const SHORTCODE_PATTERN    = '/\[(\[?)([^\s\]]+)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s';
     34
     35// Autoload classes.
     36spl_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);
    3557
    3658/**
     
    4163function init() {
    4264    add_filter( 'the_content', __NAMESPACE__ . '\process_shortcodes' );
     65
     66    // Initialize admin functionality.
     67    if ( is_admin() ) {
     68        Plugin::get_instance()->init();
     69    }
    4370}
    4471add_action( 'init', __NAMESPACE__ . '\init' );
     
    6087 */
    6188function 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 ) ) {
    6392        return array();
    6493    }
     
    77106    foreach ( $shortcodes as $match ) {
    78107        $original_shortcode = $match[0];
    79         $shortcode_name     = $match[2];
    80108
    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] ) ) {
    83111            continue;
    84112        }
Note: See TracChangeset for help on using the changeset viewer.