Plugin Directory

Changeset 3254065


Ignore:
Timestamp:
03/11/2025 12:59:34 PM (12 months ago)
Author:
progressplanner
Message:

Update to version 1.3 from GitHub

Location:
aaa-option-optimizer
Files:
6 added
4 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • aaa-option-optimizer/tags/1.3/aaa-option-optimizer.php

    r3078085 r3254065  
    88 * Plugin URI: https://joost.blog/plugins/aaa-option-optimizer/
    99 * Description: Tracks autoloaded options usage and allows the user to optimize them.
    10  * Version: 1.2.1
     10 * Version: 1.3
    1111 * License: GPL-3.0+
    1212 * Author: Joost de Valk
     
    2525
    2626register_activation_hook( __FILE__, 'aaa_option_optimizer_activation' );
     27register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' );
    2728
    2829/**
     
    3334function aaa_option_optimizer_activation() {
    3435    global $wpdb;
    35     //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one time query, no caching needed.
    36     $result = $wpdb->get_row( "SELECT count(*) AS count, SUM(LENGTH(option_value)) as autoload_size FROM {$wpdb->options} WHERE autoload='yes'" );
     36    $autoload_values = \wp_autoload_values_to_autoload();
     37    $placeholders    = implode( ',', array_fill( 0, count( $autoload_values ), '%s' ) );
     38
     39    // phpcs:disable WordPress.DB
     40    $result = $wpdb->get_row(
     41        $wpdb->prepare( "SELECT count(*) AS count, SUM( LENGTH( option_value ) ) as autoload_size FROM {$wpdb->options} WHERE autoload IN ( $placeholders )", $autoload_values )
     42    );
     43    // phpcs:enable WordPress.DB
     44
    3745    update_option(
    3846        'option_optimizer',
     
    4856
    4957/**
     58 * Deactivation hooked function to remove autoload from the plugin option.
     59 *
     60 * @return void
     61 */
     62function aaa_option_optimizer_deactivation() {
     63    $aaa_option_value = get_option( 'option_optimizer' );
     64    update_option( 'option_optimizer', $aaa_option_value, false );
     65}
     66
     67/**
    5068 * Initializes the plugin.
    5169 *
  • aaa-option-optimizer/tags/1.3/css/style.css

    r3078030 r3254065  
    88}
    99.aaa_option_table .actions {
     10    width: 50%;
    1011    text-align: right;
    1112}
    1213.aaa_option_table .actions .button {
    13     margin-right: 20px;
     14    margin-right: 10px;
     15}
     16.aaa_option_table select {
     17    max-width: 20% !important;
    1418}
    1519.aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete {
     
    5054    min-height: 200px;
    5155    max-height: 80%;
     56    text-align: left;
    5257}
    5358.aaa-option-optimizer-popover pre {
     
    5964    background-color: #eee;
    6065    overflow: scroll;
    61     text-align: left;
    6266    white-space: pre-wrap;
    6367    word-wrap: anywhere;
     
    7983    cursor: pointer;
    8084}
    81 
    8285.aaa-option-optimizer-reset {
    8386    float: right;
    8487}
    85 
    8688.aaa-option-optimizer-tabs {
    8789    clear: both;
     
    9193    background: #e5e5e5;
    9294    box-shadow: 0 48px 80px -32px rgba(0,0,0,0.3);
    93     }
    94     .aaa-option-optimizer-tabs .input {
     95}
     96.aaa-option-optimizer-tabs .input {
    9597    position: absolute;
    9698    opacity: 0;
    97     }
    98     .aaa-option-optimizer-tabs .label {
     99}
     100.aaa-option-optimizer-tabs .label {
    99101    width: 100%;
    100102    padding: 20px 30px;
     
    105107    color: #7f7f7f;
    106108    transition: background 0.1s, color 0.1s;
    107     }
    108     .aaa-option-optimizer-tabs .label:hover {
     109}
     110.aaa-option-optimizer-tabs .label:hover {
    109111    background: #d8d8d8;
    110     }
    111     .aaa-option-optimizer-tabs .label:active {
     112}
     113.aaa-option-optimizer-tabs .label:active {
    112114    background: #ccc;
    113     }
    114     .aaa-option-optimizer-tabs .input:focus + .label {
     115}
     116.aaa-option-optimizer-tabs .input:focus + .label {
    115117    z-index: 1;
    116     }
    117     .aaa-option-optimizer-tabs .input:checked + .label {
     118}
     119.aaa-option-optimizer-tabs .input:checked + .label {
    118120    background: #fff;
    119121    color: #000;
     122}
     123.aaa-option-optimizer-tabs .panel {
     124    display: none;
     125    padding: 20px 30px 30px;
     126    background: #fff;
     127}
     128.aaa-option-optimizer-tabs .input:checked + .label + .panel {
     129    display: block;
     130    width: 100%;
     131}
     132@media (min-width: 600px) {
     133    .aaa-option-optimizer-tabs .panel {
     134        order: 99;
    120135    }
    121     @media (min-width: 600px) {
    122136    .aaa-option-optimizer-tabs .label {
    123137        width: auto;
    124138    }
    125     }
    126     .aaa-option-optimizer-tabs .panel {
    127     display: none;
    128     padding: 20px 30px 30px;
    129     background: #fff;
    130     }
    131     @media (min-width: 600px) {
    132     .aaa-option-optimizer-tabs .panel {
    133         order: 99;
    134     }
    135     }
    136     .aaa-option-optimizer-tabs .input:checked + .label + .panel {
    137     display: block;
    138     width: 100%;
    139     }
     139}
     140.aaa_option_table .source {
     141    width: 20%;
     142}
  • aaa-option-optimizer/tags/1.3/js/admin-script.js

    r3078030 r3254065  
    4040            const options = {
    4141                pageLength: 25,
     42                autoWidth: false,
     43                responsive: true,
    4244                columns: getColumns( selector ),
    4345                initComplete: function () {
     
    5860            options.language = aaaOptionOptimizer.i18n;
    5961
    60             const dataTable = new DataTable( selector, options );
     62            const dataTable = new DataTable( selector, options ).columns.adjust().responsive.recalc();;
    6163        }
    6264
  • aaa-option-optimizer/tags/1.3/known-plugins/known-plugins.json

    r3078085 r3254065  
    1616        "option_prefixes": ["affwp_"]
    1717    },
     18    "all-in-one-seo-pack": {
     19        "name": "AIOSEO - The Best WordPress SEO Plugin & Toolkit",
     20        "option_prefixes": ["aioseo_","widget_aioseo"]
     21    },
     22    "breeze": {
     23        "name": "Breeze - WordPress Cache Plugin",
     24        "option_prefixes": ["breeze_"]
     25    },
     26    "bunnycdn": {
     27        "name": "bunny.net - WordPress CDN Plugin",
     28        "option_prefixes": ["bunny"]
     29    },
    1830    "burst": {
    1931        "name": "Burst Statistics",
    2032        "option_prefixes": ["burst_"]
    2133    },
     34    "chaty": {
     35        "name": "Floating Chat Widget: Contact Chat Icons, WhatsApp, Telegram Chat, Line Messenger, WeChat, Email, SMS, Call Button – Chaty",
     36        "option_prefixes": ["chaty_"]
     37    },
    2238    "complianz": {
    2339        "name": "Complianz GDPR",
    2440        "option_prefixes": ["cmplz_", "complianz_"]
    2541    },
     42    "cookiebot": {
     43        "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics",
     44        "option_prefixes": ["cookiebot_", "cookiebot-"]
     45    },
    2646    "duplicate-post": {
    2747        "name": "Yoast Duplicate Post",
     
    4060        "option_prefixes": ["fewer_tags"]
    4161    },
     62    "fluentform": {
     63        "name": "Fluent Forms",
     64        "option_prefixes": ["_fluentform_", "fluentform_"]
     65    },
     66    "generateblocks": {
     67        "name": "GenerateBlocks",
     68        "option_prefixes": ["generateblocks_"]
     69    },
    4270    "google-analytics-for-wordpress": {
    4371        "name": "Google Analytics for WordPress by MonsterInsights",
     
    4674    "gravity-forms": {
    4775        "name": "Gravity Forms",
    48         "option_prefixes": ["gf_"]
     76        "option_prefixes": ["gf_","gforms_"]
     77    },
     78    "indeed-membership-pro": {
     79        "name": "Indeed Ultimate Membership Pro",
     80        "option_prefixes": ["ihc_"]
     81    },
     82    "jetpack": {
     83        "name": "Jetpack",
     84        "option_prefixes": ["jetpack_"]
     85    },
     86    "js_composer": {
     87        "name": "Visual Composer Website Builder, Landing Page Builder, Custom Theme Builder, Maintenance Mode & Coming Soon Pages",
     88        "option_prefixes": ["vcv-"]
     89    },
     90    "litespeed-cache": {
     91        "name": "LiteSpeed Cache",
     92        "option_prefixes": ["litespeed-", "_litespeed_"]
     93    },
     94    "loginizer": {
     95        "name": "Loginizer",
     96        "option_prefixes": ["loginizer_"]
     97    },
     98    "perfmatters": {
     99        "name": "Perfmatters",
     100        "option_prefixes": ["perfmatters_"]
     101    },
     102    "pixel-caffeine": {
     103        "name": "Pixel Caffeine",
     104        "option_prefixes": ["aepc_"]
     105    },
     106    "pojo-accessibility": {
     107        "name": "One Click Accessibility",
     108        "option_prefixes": ["pojo_a11y"]
     109    },
     110    "porto-functionality": {
     111        "name": "Porto Theme - Functionality",
     112        "option_prefixes": ["porto_"]
    49113    },
    50114    "really-simple-ssl": {
     
    56120        "option_prefixes": ["redirection_"]
    57121    },
     122    "revslider": {
     123        "name": "Slider Revolution",
     124        "option_prefixes": ["revslider-"]
     125    },
     126    "seedprod": {
     127        "name": "Seedprod",
     128        "option_prefixes": ["seedprod", "seed_"]
     129    },
     130    "seo-by-rank-math": {
     131        "name": "Rank Math SEO with AI Best SEO Tools",
     132        "option_prefixes": ["rank_math_"]
     133    },
    58134    "updraft": {
    59135        "name": "Updraft Plus",
    60         "option_prefixes": ["updraft_"]
     136        "option_prefixes": ["updraft_", "updraftplus_"]
    61137    },
    62138    "yoast": {
     
    67143        "name": "WooCommerce",
    68144        "option_prefixes": ["wc_", "_transient__woocommerce_", "woocommerce_"]
     145    },
     146    "wordfence": {
     147        "name": "Wordfence",
     148        "option_prefixes": ["wordfence_"]
    69149    },
    70150    "wordpress": {
     
    207287        ]
    208288    },
     289    "worker": {
     290        "name": "ManageWP Worker",
     291        "option_prefixes": ["mwp_", "worker_"]
     292    },
     293    "wpcf7": {
     294        "name": "Contact From 7",
     295        "option_prefixes": ["wpcf7"]
     296    },
     297    "wpforms": {
     298        "name": "WPForms",
     299        "option_prefixes": ["wpforms_"]
     300    },
    209301    "wpml": {
    210302        "name": "WPML",
    211303        "option_prefixes": ["_wpml_", "wpml_", "otgs-", "otgs_", "_icl_"]
    212304    },
     305    "wp-optimize": {
     306        "name": "WP Optimize",
     307        "option_prefixes": ["wpo_", "wp-optimize"]
     308    },
     309    "wp-rocket": {
     310        "name": "WP Rocket",
     311        "option_prefixes": ["wp_rocket_", "rocket_"]
     312    },
    213313    "wpvivid-backuprestore": {
    214314        "name": "WPvivid Backup Plugin",
    215315        "option_prefixes": ["wpvivid_"]
    216     },
    217     "revslider": {
    218         "name": "Slider Revolution",
    219         "option_prefixes": ["revslider-"]
    220     },
    221     "wp-rocket": {
    222         "name": "WP Rocket",
    223         "option_prefixes": ["wp_rocket_"]
    224     },
    225     "cookiebot": {
    226         "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics",
    227         "option_prefixes": ["cookiebot_", "cookiebot-"]
    228     },
    229     "litespeed-cache": {
    230         "name": "LiteSpeed Cache",
    231         "option_prefixes": ["litespeed-", "_litespeed_"]
    232     },
    233     "fluentform": {
    234         "name": "Fluent Forms",
    235         "option_prefixes": ["_fluentform_", "fluentform_"]
    236     },
    237     "seo-by-rank-math": {
    238         "name": "Rank Math SEO with AI Best SEO Tools",
    239         "option_prefixes": ["rank_math_"]
    240     },
    241     "all-in-one-seo-pack": {
    242         "name": "AIOSEO - The Best WordPress SEO Plugin & Toolkit",
    243         "option_prefixes": ["aioseo_","widget_aioseo"]
    244     },
    245     "generateblocks": {
    246         "name": "GenerateBlocks",
    247         "option_prefixes": ["generateblocks_"]
    248     },
    249     "perfmatters": {
    250         "name": "Perfmatters",
    251         "option_prefixes": ["perfmatters_"]
    252     },
    253     "bunnycdn": {
    254         "name": "bunny.net - WordPress CDN Plugin",
    255         "option_prefixes": ["bunny"]
    256     },
    257     "gravityforms": {
    258         "name": "Gravity Forms",
    259         "option_prefixes": ["gforms_"]
    260     },
    261     "js_composer": {
    262         "name": "Visual Composer Website Builder, Landing Page Builder, Custom Theme Builder, Maintenance Mode & Coming Soon Pages",
    263         "option_prefixes": ["vcv-"]
    264     },
    265     "porto-functionality": {
    266         "name": "Porto Theme - Functionality",
    267         "option_prefixes": ["porto_"]
    268316    }
    269317}
  • aaa-option-optimizer/tags/1.3/readme.txt

    r3078085 r3254065  
    22Contributors: joostdevalk
    33Tags: options, database, cleanup
    4 Requires at least: 6.2
    5 Tested up to: 6.5
     4Requires at least: 6.6
     5Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 1.2.1
     7Stable tag: 1.3
    88License: GPL3+
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    3434For security issues, please see the next question.
    3535
     36= How can I report security issues? =
     37
     38You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer)
     39
    3640= How can I add recognized plugins? =
    3741
    3842Please do a pull request via GitHub on [this file](https://github.com/Emilia-Capital/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin.
    39 
    40 = How can I report security bugs? =
    41 
    42 You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer)
    4343
    4444== Installation ==
     
    5454
    5555== Changelog ==
     56
     57= 1.3 =
     58
     59* Make plugin work with the latest autoload changes.
    5660
    5761= 1.2.1 =
  • aaa-option-optimizer/tags/1.3/src/class-admin-page.php

    r3078030 r3254065  
    9696        \wp_enqueue_script(
    9797            'datatables',
    98             plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/dataTables.min.js',
     98            plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.js',
    9999            [], // Dependencies.
    100100            '2.0.1',
     
    104104        \wp_enqueue_style(
    105105            'datatables',
    106             plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/dataTables.dataTables.min.css',
     106            plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.css',
    107107            [],
    108108            '2.0.1'
     
    125125                'i18n'  => [
    126126                    'filterBySource' => esc_html__( 'Filter by source', 'aaa-option-optimizer' ),
    127                     'showValue'      => esc_html__( 'Show value', 'aaa-option-optimizer' ),
     127                    'showValue'      => esc_html__( 'Show', 'aaa-option-optimizer' ),
    128128                    'addAutoload'    => esc_html__( 'Add autoload', 'aaa-option-optimizer' ),
    129129                    'removeAutoload' => esc_html__( 'Remove autoload', 'aaa-option-optimizer' ),
    130                     'deleteOption'   => esc_html__( 'Delete option', 'aaa-option-optimizer' ),
     130                    'deleteOption'   => esc_html__( 'Delete', 'aaa-option-optimizer' ),
    131131
    132132                    'search'         => esc_html__( 'Search:', 'aaa-option-optimizer' ),
     
    193193                    break;
    194194                case 'size':
    195                     echo '<th>' . esc_html__( 'Size (in KB)', 'aaa-option-optimizer' ) . '</th>';
     195                    echo '<th>' . esc_html__( 'Size (KB)', 'aaa-option-optimizer' ) . '</th>';
    196196                    break;
    197197                case 'source':
    198                     echo '<th>' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';
     198                    echo '<th class="source">' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';
    199199                    break;
    200200            }
     
    284284
    285285        global $wpdb;
    286         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
    287         $result = $wpdb->get_row( "SELECT count(*) AS count, SUM(LENGTH(option_value)) as autoload_size FROM {$wpdb->options} WHERE autoload='yes'" );
     286        $autoload_values = \wp_autoload_values_to_autoload();
     287        $placeholders    = implode( ',', array_fill( 0, count( $autoload_values ), '%s' ) );
     288
     289        // phpcs:disable WordPress.DB
     290        $result = $wpdb->get_row(
     291            $wpdb->prepare( "SELECT count(*) AS count, SUM( LENGTH( option_value ) ) as autoload_size FROM {$wpdb->options} WHERE autoload IN ( $placeholders )", $autoload_values )
     292        );
     293        // phpcs:enable WordPress.DB
    288294
    289295        echo '<h2>' . esc_html__( 'Stats', 'aaa-option-optimizer' ) . '</h2>';
     
    330336                echo $this->get_value_button( $option, $value );
    331337                echo '<button class="button button-primary remove-autoload" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-minus"></span> ' . esc_html__( 'Remove autoload', 'aaa-option-optimizer' ) . '</button> ';
    332                 echo ' <button class="button button-delete delete-option" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-trash"></span> ' . esc_html__( 'Delete option', 'aaa-option-optimizer' ) . '</button>';
     338                echo ' <button class="button button-delete delete-option" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-trash"></span> ' . esc_html__( 'Delete', 'aaa-option-optimizer' ) . '</button>';
    333339                echo '</td></tr>';
    334340            }
     
    431437        $id     = 'aaa-option-optimizer-' . esc_attr( $name );
    432438        return '
    433         <button class="button" popovertarget="' . $id . '"><span class="dashicons dashicons-search"></span> ' . esc_html__( 'Show value', 'aaa-option-optimizer' ) . '</button>
     439        <button class="button" popovertarget="' . $id . '"><span class="dashicons dashicons-search"></span> ' . esc_html__( 'Show', 'aaa-option-optimizer' ) . '</button>
    434440        <div id="' . $id . '" popover class="aaa-option-optimizer-popover">
    435441        <button class="aaa-option-optimizer-popover__close" popovertarget="' . $id . '" popovertargetaction="hide">X</button>' .
    436442        // translators: %s is the name of the option.
    437443        '<p><strong>' . sprintf( esc_html__( 'Value of %s', 'aaa-option-optimizer' ), '<code>' . esc_html( $name ) . '</code>' ) . '</strong></p>
    438         <pre>' . esc_html( $string ) . '</pre>
     444        <pre>' . htmlentities( $string, ENT_QUOTES | ENT_SUBSTITUTE ) . '</pre>
    439445        </div>';
    440446    }
  • aaa-option-optimizer/tags/1.3/src/class-rest.php

    r3078030 r3254065  
    149149                'name'     => $option->option_name,
    150150                'plugin'   => $this->map_plugin_to_options->get_plugin_name( $option->option_name ),
    151                 'value'    => $option->option_value,
     151                'value'    => htmlentities( $option->option_value, ENT_QUOTES | ENT_SUBSTITUTE ),
    152152                'size'     => number_format( strlen( $option->option_value ) / 1024, 2 ),
    153153                'autoload' => $option->autoload,
     
    170170        $option_value = get_option( $option_name );
    171171
    172         if ( ! in_array( $autoload, [ 'yes', 'no' ], true ) ) {
     172        if ( ! in_array( $autoload, [ 'yes', 'on', 'no', 'off','auto', 'auto-on', 'auto-off' ], true ) ) {
    173173            return new \WP_Error( 'invalid_autoload_value', 'Invalid autoload value', [ 'status' => 400 ] );
    174174        }
     
    179179
    180180        delete_option( $option_name );
    181         $succeeded = add_option( $option_name, $option_value, '', $autoload );
     181        $autoload_values = \wp_autoload_values_to_autoload();
     182        $bool_autoload   = false;
     183        if ( in_array( $autoload, $autoload_values, true ) ) {
     184            $bool_autoload = true;
     185        }
     186        $succeeded = add_option( $option_name, $option_value, '', $bool_autoload );
    182187
    183188        if ( ! $succeeded ) {
     
    211216    public function create_option_false( $request ) {
    212217        $option_name = $request['option_name'];
    213         if ( add_option( $option_name, false, '', 'no' ) ) {
     218        if ( add_option( $option_name, false, '', false ) ) {
    214219            return new \WP_REST_Response( [ 'success' => true ], 200 );
    215220        }
  • aaa-option-optimizer/trunk/aaa-option-optimizer.php

    r3078085 r3254065  
    88 * Plugin URI: https://joost.blog/plugins/aaa-option-optimizer/
    99 * Description: Tracks autoloaded options usage and allows the user to optimize them.
    10  * Version: 1.2.1
     10 * Version: 1.3
    1111 * License: GPL-3.0+
    1212 * Author: Joost de Valk
     
    2525
    2626register_activation_hook( __FILE__, 'aaa_option_optimizer_activation' );
     27register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' );
    2728
    2829/**
     
    3334function aaa_option_optimizer_activation() {
    3435    global $wpdb;
    35     //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one time query, no caching needed.
    36     $result = $wpdb->get_row( "SELECT count(*) AS count, SUM(LENGTH(option_value)) as autoload_size FROM {$wpdb->options} WHERE autoload='yes'" );
     36    $autoload_values = \wp_autoload_values_to_autoload();
     37    $placeholders    = implode( ',', array_fill( 0, count( $autoload_values ), '%s' ) );
     38
     39    // phpcs:disable WordPress.DB
     40    $result = $wpdb->get_row(
     41        $wpdb->prepare( "SELECT count(*) AS count, SUM( LENGTH( option_value ) ) as autoload_size FROM {$wpdb->options} WHERE autoload IN ( $placeholders )", $autoload_values )
     42    );
     43    // phpcs:enable WordPress.DB
     44
    3745    update_option(
    3846        'option_optimizer',
     
    4856
    4957/**
     58 * Deactivation hooked function to remove autoload from the plugin option.
     59 *
     60 * @return void
     61 */
     62function aaa_option_optimizer_deactivation() {
     63    $aaa_option_value = get_option( 'option_optimizer' );
     64    update_option( 'option_optimizer', $aaa_option_value, false );
     65}
     66
     67/**
    5068 * Initializes the plugin.
    5169 *
  • aaa-option-optimizer/trunk/css/style.css

    r3078030 r3254065  
    88}
    99.aaa_option_table .actions {
     10    width: 50%;
    1011    text-align: right;
    1112}
    1213.aaa_option_table .actions .button {
    13     margin-right: 20px;
     14    margin-right: 10px;
     15}
     16.aaa_option_table select {
     17    max-width: 20% !important;
    1418}
    1519.aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete {
     
    5054    min-height: 200px;
    5155    max-height: 80%;
     56    text-align: left;
    5257}
    5358.aaa-option-optimizer-popover pre {
     
    5964    background-color: #eee;
    6065    overflow: scroll;
    61     text-align: left;
    6266    white-space: pre-wrap;
    6367    word-wrap: anywhere;
     
    7983    cursor: pointer;
    8084}
    81 
    8285.aaa-option-optimizer-reset {
    8386    float: right;
    8487}
    85 
    8688.aaa-option-optimizer-tabs {
    8789    clear: both;
     
    9193    background: #e5e5e5;
    9294    box-shadow: 0 48px 80px -32px rgba(0,0,0,0.3);
    93     }
    94     .aaa-option-optimizer-tabs .input {
     95}
     96.aaa-option-optimizer-tabs .input {
    9597    position: absolute;
    9698    opacity: 0;
    97     }
    98     .aaa-option-optimizer-tabs .label {
     99}
     100.aaa-option-optimizer-tabs .label {
    99101    width: 100%;
    100102    padding: 20px 30px;
     
    105107    color: #7f7f7f;
    106108    transition: background 0.1s, color 0.1s;
    107     }
    108     .aaa-option-optimizer-tabs .label:hover {
     109}
     110.aaa-option-optimizer-tabs .label:hover {
    109111    background: #d8d8d8;
    110     }
    111     .aaa-option-optimizer-tabs .label:active {
     112}
     113.aaa-option-optimizer-tabs .label:active {
    112114    background: #ccc;
    113     }
    114     .aaa-option-optimizer-tabs .input:focus + .label {
     115}
     116.aaa-option-optimizer-tabs .input:focus + .label {
    115117    z-index: 1;
    116     }
    117     .aaa-option-optimizer-tabs .input:checked + .label {
     118}
     119.aaa-option-optimizer-tabs .input:checked + .label {
    118120    background: #fff;
    119121    color: #000;
     122}
     123.aaa-option-optimizer-tabs .panel {
     124    display: none;
     125    padding: 20px 30px 30px;
     126    background: #fff;
     127}
     128.aaa-option-optimizer-tabs .input:checked + .label + .panel {
     129    display: block;
     130    width: 100%;
     131}
     132@media (min-width: 600px) {
     133    .aaa-option-optimizer-tabs .panel {
     134        order: 99;
    120135    }
    121     @media (min-width: 600px) {
    122136    .aaa-option-optimizer-tabs .label {
    123137        width: auto;
    124138    }
    125     }
    126     .aaa-option-optimizer-tabs .panel {
    127     display: none;
    128     padding: 20px 30px 30px;
    129     background: #fff;
    130     }
    131     @media (min-width: 600px) {
    132     .aaa-option-optimizer-tabs .panel {
    133         order: 99;
    134     }
    135     }
    136     .aaa-option-optimizer-tabs .input:checked + .label + .panel {
    137     display: block;
    138     width: 100%;
    139     }
     139}
     140.aaa_option_table .source {
     141    width: 20%;
     142}
  • aaa-option-optimizer/trunk/js/admin-script.js

    r3078030 r3254065  
    4040            const options = {
    4141                pageLength: 25,
     42                autoWidth: false,
     43                responsive: true,
    4244                columns: getColumns( selector ),
    4345                initComplete: function () {
     
    5860            options.language = aaaOptionOptimizer.i18n;
    5961
    60             const dataTable = new DataTable( selector, options );
     62            const dataTable = new DataTable( selector, options ).columns.adjust().responsive.recalc();;
    6163        }
    6264
  • aaa-option-optimizer/trunk/known-plugins/known-plugins.json

    r3078085 r3254065  
    1616        "option_prefixes": ["affwp_"]
    1717    },
     18    "all-in-one-seo-pack": {
     19        "name": "AIOSEO - The Best WordPress SEO Plugin & Toolkit",
     20        "option_prefixes": ["aioseo_","widget_aioseo"]
     21    },
     22    "breeze": {
     23        "name": "Breeze - WordPress Cache Plugin",
     24        "option_prefixes": ["breeze_"]
     25    },
     26    "bunnycdn": {
     27        "name": "bunny.net - WordPress CDN Plugin",
     28        "option_prefixes": ["bunny"]
     29    },
    1830    "burst": {
    1931        "name": "Burst Statistics",
    2032        "option_prefixes": ["burst_"]
    2133    },
     34    "chaty": {
     35        "name": "Floating Chat Widget: Contact Chat Icons, WhatsApp, Telegram Chat, Line Messenger, WeChat, Email, SMS, Call Button – Chaty",
     36        "option_prefixes": ["chaty_"]
     37    },
    2238    "complianz": {
    2339        "name": "Complianz GDPR",
    2440        "option_prefixes": ["cmplz_", "complianz_"]
    2541    },
     42    "cookiebot": {
     43        "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics",
     44        "option_prefixes": ["cookiebot_", "cookiebot-"]
     45    },
    2646    "duplicate-post": {
    2747        "name": "Yoast Duplicate Post",
     
    4060        "option_prefixes": ["fewer_tags"]
    4161    },
     62    "fluentform": {
     63        "name": "Fluent Forms",
     64        "option_prefixes": ["_fluentform_", "fluentform_"]
     65    },
     66    "generateblocks": {
     67        "name": "GenerateBlocks",
     68        "option_prefixes": ["generateblocks_"]
     69    },
    4270    "google-analytics-for-wordpress": {
    4371        "name": "Google Analytics for WordPress by MonsterInsights",
     
    4674    "gravity-forms": {
    4775        "name": "Gravity Forms",
    48         "option_prefixes": ["gf_"]
     76        "option_prefixes": ["gf_","gforms_"]
     77    },
     78    "indeed-membership-pro": {
     79        "name": "Indeed Ultimate Membership Pro",
     80        "option_prefixes": ["ihc_"]
     81    },
     82    "jetpack": {
     83        "name": "Jetpack",
     84        "option_prefixes": ["jetpack_"]
     85    },
     86    "js_composer": {
     87        "name": "Visual Composer Website Builder, Landing Page Builder, Custom Theme Builder, Maintenance Mode & Coming Soon Pages",
     88        "option_prefixes": ["vcv-"]
     89    },
     90    "litespeed-cache": {
     91        "name": "LiteSpeed Cache",
     92        "option_prefixes": ["litespeed-", "_litespeed_"]
     93    },
     94    "loginizer": {
     95        "name": "Loginizer",
     96        "option_prefixes": ["loginizer_"]
     97    },
     98    "perfmatters": {
     99        "name": "Perfmatters",
     100        "option_prefixes": ["perfmatters_"]
     101    },
     102    "pixel-caffeine": {
     103        "name": "Pixel Caffeine",
     104        "option_prefixes": ["aepc_"]
     105    },
     106    "pojo-accessibility": {
     107        "name": "One Click Accessibility",
     108        "option_prefixes": ["pojo_a11y"]
     109    },
     110    "porto-functionality": {
     111        "name": "Porto Theme - Functionality",
     112        "option_prefixes": ["porto_"]
    49113    },
    50114    "really-simple-ssl": {
     
    56120        "option_prefixes": ["redirection_"]
    57121    },
     122    "revslider": {
     123        "name": "Slider Revolution",
     124        "option_prefixes": ["revslider-"]
     125    },
     126    "seedprod": {
     127        "name": "Seedprod",
     128        "option_prefixes": ["seedprod", "seed_"]
     129    },
     130    "seo-by-rank-math": {
     131        "name": "Rank Math SEO with AI Best SEO Tools",
     132        "option_prefixes": ["rank_math_"]
     133    },
    58134    "updraft": {
    59135        "name": "Updraft Plus",
    60         "option_prefixes": ["updraft_"]
     136        "option_prefixes": ["updraft_", "updraftplus_"]
    61137    },
    62138    "yoast": {
     
    67143        "name": "WooCommerce",
    68144        "option_prefixes": ["wc_", "_transient__woocommerce_", "woocommerce_"]
     145    },
     146    "wordfence": {
     147        "name": "Wordfence",
     148        "option_prefixes": ["wordfence_"]
    69149    },
    70150    "wordpress": {
     
    207287        ]
    208288    },
     289    "worker": {
     290        "name": "ManageWP Worker",
     291        "option_prefixes": ["mwp_", "worker_"]
     292    },
     293    "wpcf7": {
     294        "name": "Contact From 7",
     295        "option_prefixes": ["wpcf7"]
     296    },
     297    "wpforms": {
     298        "name": "WPForms",
     299        "option_prefixes": ["wpforms_"]
     300    },
    209301    "wpml": {
    210302        "name": "WPML",
    211303        "option_prefixes": ["_wpml_", "wpml_", "otgs-", "otgs_", "_icl_"]
    212304    },
     305    "wp-optimize": {
     306        "name": "WP Optimize",
     307        "option_prefixes": ["wpo_", "wp-optimize"]
     308    },
     309    "wp-rocket": {
     310        "name": "WP Rocket",
     311        "option_prefixes": ["wp_rocket_", "rocket_"]
     312    },
    213313    "wpvivid-backuprestore": {
    214314        "name": "WPvivid Backup Plugin",
    215315        "option_prefixes": ["wpvivid_"]
    216     },
    217     "revslider": {
    218         "name": "Slider Revolution",
    219         "option_prefixes": ["revslider-"]
    220     },
    221     "wp-rocket": {
    222         "name": "WP Rocket",
    223         "option_prefixes": ["wp_rocket_"]
    224     },
    225     "cookiebot": {
    226         "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics",
    227         "option_prefixes": ["cookiebot_", "cookiebot-"]
    228     },
    229     "litespeed-cache": {
    230         "name": "LiteSpeed Cache",
    231         "option_prefixes": ["litespeed-", "_litespeed_"]
    232     },
    233     "fluentform": {
    234         "name": "Fluent Forms",
    235         "option_prefixes": ["_fluentform_", "fluentform_"]
    236     },
    237     "seo-by-rank-math": {
    238         "name": "Rank Math SEO with AI Best SEO Tools",
    239         "option_prefixes": ["rank_math_"]
    240     },
    241     "all-in-one-seo-pack": {
    242         "name": "AIOSEO - The Best WordPress SEO Plugin & Toolkit",
    243         "option_prefixes": ["aioseo_","widget_aioseo"]
    244     },
    245     "generateblocks": {
    246         "name": "GenerateBlocks",
    247         "option_prefixes": ["generateblocks_"]
    248     },
    249     "perfmatters": {
    250         "name": "Perfmatters",
    251         "option_prefixes": ["perfmatters_"]
    252     },
    253     "bunnycdn": {
    254         "name": "bunny.net - WordPress CDN Plugin",
    255         "option_prefixes": ["bunny"]
    256     },
    257     "gravityforms": {
    258         "name": "Gravity Forms",
    259         "option_prefixes": ["gforms_"]
    260     },
    261     "js_composer": {
    262         "name": "Visual Composer Website Builder, Landing Page Builder, Custom Theme Builder, Maintenance Mode & Coming Soon Pages",
    263         "option_prefixes": ["vcv-"]
    264     },
    265     "porto-functionality": {
    266         "name": "Porto Theme - Functionality",
    267         "option_prefixes": ["porto_"]
    268316    }
    269317}
  • aaa-option-optimizer/trunk/readme.txt

    r3078085 r3254065  
    22Contributors: joostdevalk
    33Tags: options, database, cleanup
    4 Requires at least: 6.2
    5 Tested up to: 6.5
     4Requires at least: 6.6
     5Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 1.2.1
     7Stable tag: 1.3
    88License: GPL3+
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    3434For security issues, please see the next question.
    3535
     36= How can I report security issues? =
     37
     38You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer)
     39
    3640= How can I add recognized plugins? =
    3741
    3842Please do a pull request via GitHub on [this file](https://github.com/Emilia-Capital/aaa-option-optimizer/blob/develop/known-plugins/known-plugins.json) in the plugin.
    39 
    40 = How can I report security bugs? =
    41 
    42 You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. [Report a security vulnerability.](https://patchstack.com/database/vdp/aaa-option-optimizer)
    4343
    4444== Installation ==
     
    5454
    5555== Changelog ==
     56
     57= 1.3 =
     58
     59* Make plugin work with the latest autoload changes.
    5660
    5761= 1.2.1 =
  • aaa-option-optimizer/trunk/src/class-admin-page.php

    r3078030 r3254065  
    9696        \wp_enqueue_script(
    9797            'datatables',
    98             plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/dataTables.min.js',
     98            plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.js',
    9999            [], // Dependencies.
    100100            '2.0.1',
     
    104104        \wp_enqueue_style(
    105105            'datatables',
    106             plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/dataTables.dataTables.min.css',
     106            plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.css',
    107107            [],
    108108            '2.0.1'
     
    125125                'i18n'  => [
    126126                    'filterBySource' => esc_html__( 'Filter by source', 'aaa-option-optimizer' ),
    127                     'showValue'      => esc_html__( 'Show value', 'aaa-option-optimizer' ),
     127                    'showValue'      => esc_html__( 'Show', 'aaa-option-optimizer' ),
    128128                    'addAutoload'    => esc_html__( 'Add autoload', 'aaa-option-optimizer' ),
    129129                    'removeAutoload' => esc_html__( 'Remove autoload', 'aaa-option-optimizer' ),
    130                     'deleteOption'   => esc_html__( 'Delete option', 'aaa-option-optimizer' ),
     130                    'deleteOption'   => esc_html__( 'Delete', 'aaa-option-optimizer' ),
    131131
    132132                    'search'         => esc_html__( 'Search:', 'aaa-option-optimizer' ),
     
    193193                    break;
    194194                case 'size':
    195                     echo '<th>' . esc_html__( 'Size (in KB)', 'aaa-option-optimizer' ) . '</th>';
     195                    echo '<th>' . esc_html__( 'Size (KB)', 'aaa-option-optimizer' ) . '</th>';
    196196                    break;
    197197                case 'source':
    198                     echo '<th>' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';
     198                    echo '<th class="source">' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';
    199199                    break;
    200200            }
     
    284284
    285285        global $wpdb;
    286         // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
    287         $result = $wpdb->get_row( "SELECT count(*) AS count, SUM(LENGTH(option_value)) as autoload_size FROM {$wpdb->options} WHERE autoload='yes'" );
     286        $autoload_values = \wp_autoload_values_to_autoload();
     287        $placeholders    = implode( ',', array_fill( 0, count( $autoload_values ), '%s' ) );
     288
     289        // phpcs:disable WordPress.DB
     290        $result = $wpdb->get_row(
     291            $wpdb->prepare( "SELECT count(*) AS count, SUM( LENGTH( option_value ) ) as autoload_size FROM {$wpdb->options} WHERE autoload IN ( $placeholders )", $autoload_values )
     292        );
     293        // phpcs:enable WordPress.DB
    288294
    289295        echo '<h2>' . esc_html__( 'Stats', 'aaa-option-optimizer' ) . '</h2>';
     
    330336                echo $this->get_value_button( $option, $value );
    331337                echo '<button class="button button-primary remove-autoload" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-minus"></span> ' . esc_html__( 'Remove autoload', 'aaa-option-optimizer' ) . '</button> ';
    332                 echo ' <button class="button button-delete delete-option" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-trash"></span> ' . esc_html__( 'Delete option', 'aaa-option-optimizer' ) . '</button>';
     338                echo ' <button class="button button-delete delete-option" data-option="' . esc_attr( $option ) . '"><span class="dashicons dashicons-trash"></span> ' . esc_html__( 'Delete', 'aaa-option-optimizer' ) . '</button>';
    333339                echo '</td></tr>';
    334340            }
     
    431437        $id     = 'aaa-option-optimizer-' . esc_attr( $name );
    432438        return '
    433         <button class="button" popovertarget="' . $id . '"><span class="dashicons dashicons-search"></span> ' . esc_html__( 'Show value', 'aaa-option-optimizer' ) . '</button>
     439        <button class="button" popovertarget="' . $id . '"><span class="dashicons dashicons-search"></span> ' . esc_html__( 'Show', 'aaa-option-optimizer' ) . '</button>
    434440        <div id="' . $id . '" popover class="aaa-option-optimizer-popover">
    435441        <button class="aaa-option-optimizer-popover__close" popovertarget="' . $id . '" popovertargetaction="hide">X</button>' .
    436442        // translators: %s is the name of the option.
    437443        '<p><strong>' . sprintf( esc_html__( 'Value of %s', 'aaa-option-optimizer' ), '<code>' . esc_html( $name ) . '</code>' ) . '</strong></p>
    438         <pre>' . esc_html( $string ) . '</pre>
     444        <pre>' . htmlentities( $string, ENT_QUOTES | ENT_SUBSTITUTE ) . '</pre>
    439445        </div>';
    440446    }
  • aaa-option-optimizer/trunk/src/class-rest.php

    r3078030 r3254065  
    149149                'name'     => $option->option_name,
    150150                'plugin'   => $this->map_plugin_to_options->get_plugin_name( $option->option_name ),
    151                 'value'    => $option->option_value,
     151                'value'    => htmlentities( $option->option_value, ENT_QUOTES | ENT_SUBSTITUTE ),
    152152                'size'     => number_format( strlen( $option->option_value ) / 1024, 2 ),
    153153                'autoload' => $option->autoload,
     
    170170        $option_value = get_option( $option_name );
    171171
    172         if ( ! in_array( $autoload, [ 'yes', 'no' ], true ) ) {
     172        if ( ! in_array( $autoload, [ 'yes', 'on', 'no', 'off','auto', 'auto-on', 'auto-off' ], true ) ) {
    173173            return new \WP_Error( 'invalid_autoload_value', 'Invalid autoload value', [ 'status' => 400 ] );
    174174        }
     
    179179
    180180        delete_option( $option_name );
    181         $succeeded = add_option( $option_name, $option_value, '', $autoload );
     181        $autoload_values = \wp_autoload_values_to_autoload();
     182        $bool_autoload   = false;
     183        if ( in_array( $autoload, $autoload_values, true ) ) {
     184            $bool_autoload = true;
     185        }
     186        $succeeded = add_option( $option_name, $option_value, '', $bool_autoload );
    182187
    183188        if ( ! $succeeded ) {
     
    211216    public function create_option_false( $request ) {
    212217        $option_name = $request['option_name'];
    213         if ( add_option( $option_name, false, '', 'no' ) ) {
     218        if ( add_option( $option_name, false, '', false ) ) {
    214219            return new \WP_REST_Response( [ 'success' => true ], 200 );
    215220        }
Note: See TracChangeset for help on using the changeset viewer.