Plugin Directory

Changeset 3479301


Ignore:
Timestamp:
03/10/2026 05:18:36 PM (3 weeks ago)
Author:
rocketcomunicazione
Message:

2.4.1

Location:
rc-site-manager-optimization/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • rc-site-manager-optimization/trunk/assets/styles/style.css

    r3465880 r3479301  
    11451145    display: inline-block;
    11461146}
     1147
     1148.rc_sm_wp_rocket_rules_form .rc_sm_quick_types_group { margin-top: 40px; }
     1149.rc_sm_wp_rocket_rules_form .rc_sm_quick_types_group label { padding-right: 20px; }
    11471150.rc_sm_settings_user_permissions_form .rc_sm_roles_group { margin-bottom: 30px; }
    11481151.rc_sm_settings_user_permissions_form .rc_sm_roles_group label { padding-right: 40px; }
  • rc-site-manager-optimization/trunk/crons/wp_rocket_cache_rules.php

    r3438010 r3479301  
    158158       
    159159    } else {
    160         // CUSTOM MODE: Clean tagged items + custom URLs
     160        // CUSTOM MODE: Clean tagged items + quick types + custom URLs
    161161       
    162162        // PART 1: Clean items with tag (posts and terms)
     
    169169        // Update last_run after first cleaning
    170170        rc_sm_update_rule_last_run($rule_id);
    171        
    172         // PART 2: Clean custom URLs
     171
     172        // PART 2: Clean quick types (home, post, page, category, etc.)
     173        $quick_types = $rule_data['quick_types'] ?? array();
     174        if (!empty($quick_types) && function_exists('rc_sm_resolve_quick_types_urls')) {
     175            if (RC_SM_DEBUG) {
     176                #error_log('[RC_SM_CRON] PART 2: Resolving quick types: ' . implode(', ', $quick_types));
     177            }
     178
     179            $quick_urls = rc_sm_resolve_quick_types_urls($quick_types);
     180
     181            if (!empty($quick_urls) && function_exists('rocket_clean_files')) {
     182                rocket_clean_files($quick_urls);
     183                $cleaned_count += count($quick_urls);
     184
     185                if (RC_SM_DEBUG) {
     186                    foreach ($quick_urls as $url) {
     187                        #error_log('[RC_SM_CRON] → Cleaned quick type URL: ' . $url);
     188                    }
     189                }
     190            }
     191
     192            rc_sm_update_rule_last_run($rule_id);
     193        } else {
     194            if (RC_SM_DEBUG) {
     195                #error_log('[RC_SM_CRON] PART 2: No quick types to clean');
     196            }
     197        }
     198       
     199        // PART 3: Clean custom URLs
    173200        if (!empty($rule_data['custom_urls'])) {
    174201            if (RC_SM_DEBUG) {
    175                 #error_log('[RC_SM_CRON] PART 2: Cleaning ' . count($rule_data['custom_urls']) . ' custom URLs...');
     202                #error_log('[RC_SM_CRON] PART 3: Cleaning ' . count($rule_data['custom_urls']) . ' custom URLs...');
    176203            }
    177204           
     
    182209        } else {
    183210            if (RC_SM_DEBUG) {
    184                 #error_log('[RC_SM_CRON] PART 2: No custom URLs to clean');
     211                #error_log('[RC_SM_CRON] PART 3: No custom URLs to clean');
    185212            }
    186213        }
  • rc-site-manager-optimization/trunk/plugins/wp_rocket/tab_cache_rules.php

    r3438010 r3479301  
    1616    }
    1717}
     18
     19$quick_types_saved = ($rule_data && !empty($rule_data['quick_types'])) ? $rule_data['quick_types'] : array();
    1820?>
    1921
     
    153155                        <div class="rc_sm_form_divider">
    154156                            <h4><?php echo esc_html__('Cache Scope', 'rc-site-manager-optimization'); ?></h4>
    155                             <div class="rc_sm_box_information rc_sm_bg_lt_warning"><?php echo esc_html__('For a targeted cleanup (e.g., Categories, Tags, ...) you dont need to fill in the section below.', 'rc-site-manager-optimization'); ?> <?php echo wp_kses_post(rc_sm_help_link('plugins_wp_rocket_cache_rules', '?')); ?></div>
     157                            <div class="rc_sm_box_information rc_sm_bg_lt_warning"><?php echo esc_html__('For a targeted cleanup (e.g., Categories, Tags, ...) you don\'t need to fill in the section below.', 'rc-site-manager-optimization'); ?> <?php echo wp_kses_post(rc_sm_help_link('plugins_wp_rocket_cache_rules', '?')); ?></div>
    156158
    157159                            <div class="rc_sm_schedule rc_sm_form_spacer">
     
    166168                            <!-- CUSTOM URLs SECTION -->
    167169                            <div id="rc_sm_custom_urls_section">
     170
     171                                <!-- QUICK SELECT: Contents -->
     172                                <div class="rc_sm_form_spacer">
     173                                    <div class="rc_sm_quick_types_group rc_sm_form_spacer">
     174                                        <strong><?php echo esc_html__('Contents', 'rc-site-manager-optimization'); ?>:&nbsp;&nbsp;&nbsp;</strong>
     175                                        <label>
     176                                            <input type="checkbox" name="quick_types[]" value="home"
     177                                                <?php echo in_array('home', $quick_types_saved) ? 'checked' : ''; ?>>
     178                                            <?php echo esc_html__('Home', 'rc-site-manager-optimization'); ?>
     179                                        </label>
     180                                        <label>
     181                                            <input type="checkbox" name="quick_types[]" value="page"
     182                                                <?php echo in_array('page', $quick_types_saved) ? 'checked' : ''; ?>>
     183                                            <?php echo esc_html__('Pages', 'rc-site-manager-optimization'); ?>
     184                                        </label>
     185                                        <label>
     186                                            <input type="checkbox" name="quick_types[]" value="post"
     187                                                <?php echo in_array('post', $quick_types_saved) ? 'checked' : ''; ?>>
     188                                            <?php echo esc_html__('Posts', 'rc-site-manager-optimization'); ?>
     189                                        </label>
     190                                        <label>
     191                                            <input type="checkbox" name="quick_types[]" value="category"
     192                                                <?php echo in_array('category', $quick_types_saved) ? 'checked' : ''; ?>>
     193                                            <?php echo esc_html__('Post Categories', 'rc-site-manager-optimization'); ?>
     194                                        </label>
     195                                        <label>
     196                                            <input type="checkbox" name="quick_types[]" value="post_tag"
     197                                                <?php echo in_array('post_tag', $quick_types_saved) ? 'checked' : ''; ?>>
     198                                            <?php echo esc_html__('Post Tags', 'rc-site-manager-optimization'); ?>
     199                                        </label>
     200                                        <?php if (post_type_exists('portfolio')): ?>
     201                                        <label>
     202                                            <input type="checkbox" name="quick_types[]" value="portfolio"
     203                                                <?php echo in_array('portfolio', $quick_types_saved) ? 'checked' : ''; ?>>
     204                                            <?php echo esc_html__('Portfolio', 'rc-site-manager-optimization'); ?>
     205                                        </label>
     206                                        <?php endif; ?>
     207                                    </div>
     208                                </div>
     209
     210                                <!-- QUICK SELECT: WooCommerce -->
     211                                <?php if (defined('RC_SM_PLUGIN_WOOCOMMERCE') && RC_SM_PLUGIN_WOOCOMMERCE): ?>
     212                                <div class="rc_sm_form_spacer">
     213                                    <div class="rc_sm_quick_types_group rc_sm_form_spacer">
     214                                        <strong><?php echo esc_html__('WooCommerce', 'rc-site-manager-optimization'); ?>:&nbsp;&nbsp;&nbsp;</strong>
     215                                        <label>
     216                                            <input type="checkbox" name="quick_types[]" value="product"
     217                                                <?php echo in_array('product', $quick_types_saved) ? 'checked' : ''; ?>>
     218                                            <?php echo esc_html__('Products', 'rc-site-manager-optimization'); ?>
     219                                        </label>
     220                                        <label>
     221                                            <input type="checkbox" name="quick_types[]" value="product_cat"
     222                                                <?php echo in_array('product_cat', $quick_types_saved) ? 'checked' : ''; ?>>
     223                                            <?php echo esc_html__('Product Categories', 'rc-site-manager-optimization'); ?>
     224                                        </label>
     225                                        <label>
     226                                            <input type="checkbox" name="quick_types[]" value="product_tag"
     227                                                <?php echo in_array('product_tag', $quick_types_saved) ? 'checked' : ''; ?>>
     228                                            <?php echo esc_html__('Product Tags', 'rc-site-manager-optimization'); ?>
     229                                        </label>
     230                                    </div>
     231                                </div>
     232                                <?php endif; ?>
     233
    168234                                <div class="rc_sm_form_spacer"></div>
    169235                                <label><?php echo esc_html__('Custom URLs', 'rc-site-manager-optimization'); ?></label>
  • rc-site-manager-optimization/trunk/plugins/wp_rocket/wp_rocket_function.php

    r3438010 r3479301  
    274274    $confirm_all_website = rc_sm_security_ajax_get_param('confirm_all_website', '');
    275275    $custom_urls = rc_sm_security_ajax_get_param('custom_urls', '');
     276   
     277    // Quick types (checkboxes)
     278    $allowed_quick_types = array('home', 'page', 'post', 'category', 'post_tag', 'portfolio', 'product', 'product_cat', 'product_tag');
     279    $quick_types_raw = rc_sm_security_ajax_get_text_array('quick_types');
     280    $quick_types = array_values(array_intersect($quick_types_raw, $allowed_quick_types));
    276281   
    277282    // Validate rule name
     
    491496            'all_website' => $all_website,
    492497            'custom_urls' => $urls_array,
     498            'quick_types' => $quick_types,
    493499            'rule_key' => 'rc_sm_wp_rocket_cache_rule_' . $rule_id,
    494500            'last_run' => isset($old_data['last_run']) ? $old_data['last_run'] : null
     
    543549            'all_website' => $all_website,
    544550            'custom_urls' => $urls_array,
     551            'quick_types' => $quick_types,
    545552            'rule_key' => '',
    546553            'last_run' => null
     
    10721079    wp_die();
    10731080});
     1081
     1082
     1083/**
     1084 * Resolve quick_types checkboxes to full URLs for cache cleaning.
     1085 * Supports WPML and Polylang multilingual.
     1086 *
     1087 * @param array $quick_types  Array of type keys e.g. ['home', 'post', 'category']
     1088 * @return array              Array of absolute URLs to clean
     1089 */
     1090function rc_sm_resolve_quick_types_urls( $quick_types ) {
     1091    if ( empty( $quick_types ) ) {
     1092        return array();
     1093    }
     1094
     1095    $urls      = array();
     1096    $use_wpml  = defined( 'RC_SM_PLUGIN_WPML' ) && RC_SM_PLUGIN_WPML;
     1097    $use_pll   = defined( 'RC_SM_PLUGIN_POLYLANG' ) && RC_SM_PLUGIN_POLYLANG;
     1098
     1099    $allowed = array( 'home', 'page', 'post', 'category', 'post_tag', 'portfolio', 'product', 'product_cat', 'product_tag' );
     1100
     1101    foreach ( $quick_types as $type ) {
     1102
     1103        if ( ! in_array( $type, $allowed, true ) ) {
     1104            continue;
     1105        }
     1106
     1107        switch ( $type ) {
     1108
     1109            // ── HOME ─────────────────────────────────────────────────────────
     1110            case 'home':
     1111                if ( $use_wpml ) {
     1112                    $active_langs = apply_filters( 'wpml_active_languages', null, array( 'skip_missing' => 0 ) );
     1113                    if ( is_array( $active_langs ) ) {
     1114                        foreach ( $active_langs as $lang_data ) {
     1115                            if ( ! empty( $lang_data['url'] ) ) {
     1116                                $urls[] = trailingslashit( $lang_data['url'] );
     1117                            }
     1118                        }
     1119                    }
     1120                } elseif ( $use_pll && function_exists( 'pll_languages_list' ) && function_exists( 'pll_home_url' ) ) {
     1121                    $languages = pll_languages_list( array( 'fields' => 'slug' ) );
     1122                    foreach ( $languages as $lang ) {
     1123                        $urls[] = pll_home_url( $lang );
     1124                    }
     1125                } else {
     1126                    $urls[] = home_url( '/' );
     1127                }
     1128                break;
     1129
     1130            // ── POST TYPES (page, post, portfolio, product) ──────────────────
     1131            case 'page':
     1132            case 'post':
     1133            case 'portfolio':
     1134            case 'product':
     1135                if ( ! post_type_exists( $type ) ) {
     1136                    break;
     1137                }
     1138                $post_ids = get_posts( array(
     1139                    'post_type'        => $type,
     1140                    'post_status'      => 'publish',
     1141                    'posts_per_page'   => -1,
     1142                    'fields'           => 'ids',
     1143                    'suppress_filters' => true, // bypass language filters → all languages
     1144                    'no_found_rows'    => true,
     1145                ) );
     1146                foreach ( $post_ids as $post_id ) {
     1147                    $permalink = get_permalink( $post_id );
     1148                    if ( $permalink ) {
     1149                        $urls[] = $permalink;
     1150                    }
     1151                }
     1152                break;
     1153
     1154            // ── TAXONOMIES (category, post_tag, product_cat, product_tag) ────
     1155            case 'category':
     1156            case 'post_tag':
     1157            case 'product_cat':
     1158            case 'product_tag':
     1159                if ( ! taxonomy_exists( $type ) ) {
     1160                    break;
     1161                }
     1162
     1163                $term_args = array(
     1164                    'taxonomy'   => $type,
     1165                    'hide_empty' => false,
     1166                    'fields'     => 'ids',
     1167                );
     1168
     1169                // Polylang: lang='' retrieves terms in all languages
     1170                if ( $use_pll ) {
     1171                    $term_args['lang'] = '';
     1172                }
     1173
     1174                // WPML: temporarily switch to "all" to retrieve all language terms
     1175                if ( $use_wpml ) {
     1176                    global $sitepress;
     1177                    if ( isset( $sitepress ) ) {
     1178                        $current_lang = apply_filters( 'wpml_current_language', null );
     1179                        $sitepress->switch_lang( 'all' );
     1180                    }
     1181                }
     1182
     1183                $term_ids = get_terms( $term_args );
     1184
     1185                // Restore WPML language
     1186                if ( $use_wpml && isset( $sitepress, $current_lang ) ) {
     1187                    $sitepress->switch_lang( $current_lang );
     1188                }
     1189
     1190                if ( ! is_wp_error( $term_ids ) && ! empty( $term_ids ) ) {
     1191                    foreach ( $term_ids as $term_id ) {
     1192                        $term_link = get_term_link( (int) $term_id, $type );
     1193                        if ( ! is_wp_error( $term_link ) ) {
     1194                            $urls[] = $term_link;
     1195                        }
     1196                    }
     1197                }
     1198                break;
     1199        }
     1200    }
     1201
     1202    return array_values( array_unique( array_filter( $urls ) ) );
     1203}
  • rc-site-manager-optimization/trunk/plugins/wp_rocket/wp_rocket_script.js

    r3438010 r3479301  
    310310                confirm_all_website: selectedScope === 'all_website' ? ($('input[name="confirm_all_website"]:checked').val() || 0) : 0,
    311311                hours: [],
    312                 days: []
     312                days: [],
     313                quick_types: []
    313314            };
    314315           
     
    324325                });
    325326            }
     327
     328            // Get selected quick types (checkboxes)
     329            $('input[name="quick_types[]"]:checked').each(function() {
     330                formData.quick_types.push($(this).val());
     331            });
    326332           
    327333            // Send AJAX request
  • rc-site-manager-optimization/trunk/rc-site-manager-optimization.php

    r3477320 r3479301  
    33 * Plugin Name: RC Site Manager & Optimization
    44 * Description: All-in-one Wordpress manager: control WooCommerce, SEO, caching, media, and multilingual tools from one dashboard.
    5  * Version: 2.4.0
     5 * Version: 2.4.1
    66 * Author: Rocket Comunicazione
    77 * Author URI: https://www.rocketcomunicazione.com
     
    1818
    1919
    20 define('RC_SM_PLUGIN_VERSION', '2.4.0');
     20define('RC_SM_PLUGIN_VERSION', '2.4.1');
    2121
    2222define( 'RC_SM_SITE_URL', home_url() );
  • rc-site-manager-optimization/trunk/readme.txt

    r3477320 r3479301  
    55Tested up to: 6.9
    66Requires PHP: 8.1
    7 Stable tag: 2.4.0
     7Stable tag: 2.4.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    160160== Changelog ==
    161161
     162
     163= 2.4.1 - March 10, 2026 =
     164* Minor bug fixes and improvement
    162165
    163166= 2.4.0 - March 8, 2026 =
     
    298301== Upgrade Notice ==
    299302
     303= 2.4.1 - March 10, 2026 =
     304Minor bug fixes.
     305
    300306= 2.4.0 - March 8, 2026 =
    301307Minor bug fixes.
Note: See TracChangeset for help on using the changeset viewer.