Changeset 3254065
- Timestamp:
- 03/11/2025 12:59:34 PM (12 months ago)
- Location:
- aaa-option-optimizer
- Files:
-
- 6 added
- 4 deleted
- 14 edited
- 1 copied
-
tags/1.3 (copied) (copied from aaa-option-optimizer/trunk)
-
tags/1.3/aaa-option-optimizer.php (modified) (4 diffs)
-
tags/1.3/css/style.css (modified) (6 diffs)
-
tags/1.3/js/admin-script.js (modified) (2 diffs)
-
tags/1.3/js/vendor/dataTables.dataTables.min.css (deleted)
-
tags/1.3/js/vendor/dataTables.min.js (deleted)
-
tags/1.3/js/vendor/datatables.min.css (added)
-
tags/1.3/js/vendor/datatables.min.js (added)
-
tags/1.3/known-plugins/known-plugins.json (modified) (6 diffs)
-
tags/1.3/readme.txt (modified) (3 diffs)
-
tags/1.3/src/class-admin-page.php (modified) (7 diffs)
-
tags/1.3/src/class-rest.php (modified) (4 diffs)
-
tags/1.3/uninstall.php (added)
-
trunk/aaa-option-optimizer.php (modified) (4 diffs)
-
trunk/css/style.css (modified) (6 diffs)
-
trunk/js/admin-script.js (modified) (2 diffs)
-
trunk/js/vendor/dataTables.dataTables.min.css (deleted)
-
trunk/js/vendor/dataTables.min.js (deleted)
-
trunk/js/vendor/datatables.min.css (added)
-
trunk/js/vendor/datatables.min.js (added)
-
trunk/known-plugins/known-plugins.json (modified) (6 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/class-admin-page.php (modified) (7 diffs)
-
trunk/src/class-rest.php (modified) (4 diffs)
-
trunk/uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
-
aaa-option-optimizer/tags/1.3/aaa-option-optimizer.php
r3078085 r3254065 8 8 * Plugin URI: https://joost.blog/plugins/aaa-option-optimizer/ 9 9 * Description: Tracks autoloaded options usage and allows the user to optimize them. 10 * Version: 1. 2.110 * Version: 1.3 11 11 * License: GPL-3.0+ 12 12 * Author: Joost de Valk … … 25 25 26 26 register_activation_hook( __FILE__, 'aaa_option_optimizer_activation' ); 27 register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' ); 27 28 28 29 /** … … 33 34 function aaa_option_optimizer_activation() { 34 35 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 37 45 update_option( 38 46 'option_optimizer', … … 48 56 49 57 /** 58 * Deactivation hooked function to remove autoload from the plugin option. 59 * 60 * @return void 61 */ 62 function aaa_option_optimizer_deactivation() { 63 $aaa_option_value = get_option( 'option_optimizer' ); 64 update_option( 'option_optimizer', $aaa_option_value, false ); 65 } 66 67 /** 50 68 * Initializes the plugin. 51 69 * -
aaa-option-optimizer/tags/1.3/css/style.css
r3078030 r3254065 8 8 } 9 9 .aaa_option_table .actions { 10 width: 50%; 10 11 text-align: right; 11 12 } 12 13 .aaa_option_table .actions .button { 13 margin-right: 20px; 14 margin-right: 10px; 15 } 16 .aaa_option_table select { 17 max-width: 20% !important; 14 18 } 15 19 .aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete { … … 50 54 min-height: 200px; 51 55 max-height: 80%; 56 text-align: left; 52 57 } 53 58 .aaa-option-optimizer-popover pre { … … 59 64 background-color: #eee; 60 65 overflow: scroll; 61 text-align: left;62 66 white-space: pre-wrap; 63 67 word-wrap: anywhere; … … 79 83 cursor: pointer; 80 84 } 81 82 85 .aaa-option-optimizer-reset { 83 86 float: right; 84 87 } 85 86 88 .aaa-option-optimizer-tabs { 87 89 clear: both; … … 91 93 background: #e5e5e5; 92 94 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 { 95 97 position: absolute; 96 98 opacity: 0; 97 }98 .aaa-option-optimizer-tabs .label {99 } 100 .aaa-option-optimizer-tabs .label { 99 101 width: 100%; 100 102 padding: 20px 30px; … … 105 107 color: #7f7f7f; 106 108 transition: background 0.1s, color 0.1s; 107 }108 .aaa-option-optimizer-tabs .label:hover {109 } 110 .aaa-option-optimizer-tabs .label:hover { 109 111 background: #d8d8d8; 110 }111 .aaa-option-optimizer-tabs .label:active {112 } 113 .aaa-option-optimizer-tabs .label:active { 112 114 background: #ccc; 113 }114 .aaa-option-optimizer-tabs .input:focus + .label {115 } 116 .aaa-option-optimizer-tabs .input:focus + .label { 115 117 z-index: 1; 116 }117 .aaa-option-optimizer-tabs .input:checked + .label {118 } 119 .aaa-option-optimizer-tabs .input:checked + .label { 118 120 background: #fff; 119 121 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; 120 135 } 121 @media (min-width: 600px) {122 136 .aaa-option-optimizer-tabs .label { 123 137 width: auto; 124 138 } 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 40 40 const options = { 41 41 pageLength: 25, 42 autoWidth: false, 43 responsive: true, 42 44 columns: getColumns( selector ), 43 45 initComplete: function () { … … 58 60 options.language = aaaOptionOptimizer.i18n; 59 61 60 const dataTable = new DataTable( selector, options ) ;62 const dataTable = new DataTable( selector, options ).columns.adjust().responsive.recalc();; 61 63 } 62 64 -
aaa-option-optimizer/tags/1.3/known-plugins/known-plugins.json
r3078085 r3254065 16 16 "option_prefixes": ["affwp_"] 17 17 }, 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 }, 18 30 "burst": { 19 31 "name": "Burst Statistics", 20 32 "option_prefixes": ["burst_"] 21 33 }, 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 }, 22 38 "complianz": { 23 39 "name": "Complianz GDPR", 24 40 "option_prefixes": ["cmplz_", "complianz_"] 25 41 }, 42 "cookiebot": { 43 "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics", 44 "option_prefixes": ["cookiebot_", "cookiebot-"] 45 }, 26 46 "duplicate-post": { 27 47 "name": "Yoast Duplicate Post", … … 40 60 "option_prefixes": ["fewer_tags"] 41 61 }, 62 "fluentform": { 63 "name": "Fluent Forms", 64 "option_prefixes": ["_fluentform_", "fluentform_"] 65 }, 66 "generateblocks": { 67 "name": "GenerateBlocks", 68 "option_prefixes": ["generateblocks_"] 69 }, 42 70 "google-analytics-for-wordpress": { 43 71 "name": "Google Analytics for WordPress by MonsterInsights", … … 46 74 "gravity-forms": { 47 75 "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_"] 49 113 }, 50 114 "really-simple-ssl": { … … 56 120 "option_prefixes": ["redirection_"] 57 121 }, 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 }, 58 134 "updraft": { 59 135 "name": "Updraft Plus", 60 "option_prefixes": ["updraft_" ]136 "option_prefixes": ["updraft_", "updraftplus_"] 61 137 }, 62 138 "yoast": { … … 67 143 "name": "WooCommerce", 68 144 "option_prefixes": ["wc_", "_transient__woocommerce_", "woocommerce_"] 145 }, 146 "wordfence": { 147 "name": "Wordfence", 148 "option_prefixes": ["wordfence_"] 69 149 }, 70 150 "wordpress": { … … 207 287 ] 208 288 }, 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 }, 209 301 "wpml": { 210 302 "name": "WPML", 211 303 "option_prefixes": ["_wpml_", "wpml_", "otgs-", "otgs_", "_icl_"] 212 304 }, 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 }, 213 313 "wpvivid-backuprestore": { 214 314 "name": "WPvivid Backup Plugin", 215 315 "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_"]268 316 } 269 317 } -
aaa-option-optimizer/tags/1.3/readme.txt
r3078085 r3254065 2 2 Contributors: joostdevalk 3 3 Tags: options, database, cleanup 4 Requires at least: 6. 25 Tested up to: 6. 54 Requires at least: 6.6 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1. 2.17 Stable tag: 1.3 8 8 License: GPL3+ 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 34 34 For security issues, please see the next question. 35 35 36 = How can I report security issues? = 37 38 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) 39 36 40 = How can I add recognized plugins? = 37 41 38 42 Please 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)43 43 44 44 == Installation == … … 54 54 55 55 == Changelog == 56 57 = 1.3 = 58 59 * Make plugin work with the latest autoload changes. 56 60 57 61 = 1.2.1 = -
aaa-option-optimizer/tags/1.3/src/class-admin-page.php
r3078030 r3254065 96 96 \wp_enqueue_script( 97 97 'datatables', 98 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/data Tables.min.js',98 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.js', 99 99 [], // Dependencies. 100 100 '2.0.1', … … 104 104 \wp_enqueue_style( 105 105 'datatables', 106 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/data Tables.dataTables.min.css',106 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.css', 107 107 [], 108 108 '2.0.1' … … 125 125 'i18n' => [ 126 126 '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' ), 128 128 'addAutoload' => esc_html__( 'Add autoload', 'aaa-option-optimizer' ), 129 129 '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' ), 131 131 132 132 'search' => esc_html__( 'Search:', 'aaa-option-optimizer' ), … … 193 193 break; 194 194 case 'size': 195 echo '<th>' . esc_html__( 'Size ( inKB)', 'aaa-option-optimizer' ) . '</th>';195 echo '<th>' . esc_html__( 'Size (KB)', 'aaa-option-optimizer' ) . '</th>'; 196 196 break; 197 197 case 'source': 198 echo '<th >' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';198 echo '<th class="source">' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>'; 199 199 break; 200 200 } … … 284 284 285 285 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 288 294 289 295 echo '<h2>' . esc_html__( 'Stats', 'aaa-option-optimizer' ) . '</h2>'; … … 330 336 echo $this->get_value_button( $option, $value ); 331 337 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>'; 333 339 echo '</td></tr>'; 334 340 } … … 431 437 $id = 'aaa-option-optimizer-' . esc_attr( $name ); 432 438 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> 434 440 <div id="' . $id . '" popover class="aaa-option-optimizer-popover"> 435 441 <button class="aaa-option-optimizer-popover__close" popovertarget="' . $id . '" popovertargetaction="hide">X</button>' . 436 442 // translators: %s is the name of the option. 437 443 '<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> 439 445 </div>'; 440 446 } -
aaa-option-optimizer/tags/1.3/src/class-rest.php
r3078030 r3254065 149 149 'name' => $option->option_name, 150 150 '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 ), 152 152 'size' => number_format( strlen( $option->option_value ) / 1024, 2 ), 153 153 'autoload' => $option->autoload, … … 170 170 $option_value = get_option( $option_name ); 171 171 172 if ( ! in_array( $autoload, [ 'yes', ' no' ], true ) ) {172 if ( ! in_array( $autoload, [ 'yes', 'on', 'no', 'off','auto', 'auto-on', 'auto-off' ], true ) ) { 173 173 return new \WP_Error( 'invalid_autoload_value', 'Invalid autoload value', [ 'status' => 400 ] ); 174 174 } … … 179 179 180 180 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 ); 182 187 183 188 if ( ! $succeeded ) { … … 211 216 public function create_option_false( $request ) { 212 217 $option_name = $request['option_name']; 213 if ( add_option( $option_name, false, '', 'no') ) {218 if ( add_option( $option_name, false, '', false ) ) { 214 219 return new \WP_REST_Response( [ 'success' => true ], 200 ); 215 220 } -
aaa-option-optimizer/trunk/aaa-option-optimizer.php
r3078085 r3254065 8 8 * Plugin URI: https://joost.blog/plugins/aaa-option-optimizer/ 9 9 * Description: Tracks autoloaded options usage and allows the user to optimize them. 10 * Version: 1. 2.110 * Version: 1.3 11 11 * License: GPL-3.0+ 12 12 * Author: Joost de Valk … … 25 25 26 26 register_activation_hook( __FILE__, 'aaa_option_optimizer_activation' ); 27 register_deactivation_hook( __FILE__, 'aaa_option_optimizer_deactivation' ); 27 28 28 29 /** … … 33 34 function aaa_option_optimizer_activation() { 34 35 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 37 45 update_option( 38 46 'option_optimizer', … … 48 56 49 57 /** 58 * Deactivation hooked function to remove autoload from the plugin option. 59 * 60 * @return void 61 */ 62 function aaa_option_optimizer_deactivation() { 63 $aaa_option_value = get_option( 'option_optimizer' ); 64 update_option( 'option_optimizer', $aaa_option_value, false ); 65 } 66 67 /** 50 68 * Initializes the plugin. 51 69 * -
aaa-option-optimizer/trunk/css/style.css
r3078030 r3254065 8 8 } 9 9 .aaa_option_table .actions { 10 width: 50%; 10 11 text-align: right; 11 12 } 12 13 .aaa_option_table .actions .button { 13 margin-right: 20px; 14 margin-right: 10px; 15 } 16 .aaa_option_table select { 17 max-width: 20% !important; 14 18 } 15 19 .aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete { … … 50 54 min-height: 200px; 51 55 max-height: 80%; 56 text-align: left; 52 57 } 53 58 .aaa-option-optimizer-popover pre { … … 59 64 background-color: #eee; 60 65 overflow: scroll; 61 text-align: left;62 66 white-space: pre-wrap; 63 67 word-wrap: anywhere; … … 79 83 cursor: pointer; 80 84 } 81 82 85 .aaa-option-optimizer-reset { 83 86 float: right; 84 87 } 85 86 88 .aaa-option-optimizer-tabs { 87 89 clear: both; … … 91 93 background: #e5e5e5; 92 94 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 { 95 97 position: absolute; 96 98 opacity: 0; 97 }98 .aaa-option-optimizer-tabs .label {99 } 100 .aaa-option-optimizer-tabs .label { 99 101 width: 100%; 100 102 padding: 20px 30px; … … 105 107 color: #7f7f7f; 106 108 transition: background 0.1s, color 0.1s; 107 }108 .aaa-option-optimizer-tabs .label:hover {109 } 110 .aaa-option-optimizer-tabs .label:hover { 109 111 background: #d8d8d8; 110 }111 .aaa-option-optimizer-tabs .label:active {112 } 113 .aaa-option-optimizer-tabs .label:active { 112 114 background: #ccc; 113 }114 .aaa-option-optimizer-tabs .input:focus + .label {115 } 116 .aaa-option-optimizer-tabs .input:focus + .label { 115 117 z-index: 1; 116 }117 .aaa-option-optimizer-tabs .input:checked + .label {118 } 119 .aaa-option-optimizer-tabs .input:checked + .label { 118 120 background: #fff; 119 121 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; 120 135 } 121 @media (min-width: 600px) {122 136 .aaa-option-optimizer-tabs .label { 123 137 width: auto; 124 138 } 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 40 40 const options = { 41 41 pageLength: 25, 42 autoWidth: false, 43 responsive: true, 42 44 columns: getColumns( selector ), 43 45 initComplete: function () { … … 58 60 options.language = aaaOptionOptimizer.i18n; 59 61 60 const dataTable = new DataTable( selector, options ) ;62 const dataTable = new DataTable( selector, options ).columns.adjust().responsive.recalc();; 61 63 } 62 64 -
aaa-option-optimizer/trunk/known-plugins/known-plugins.json
r3078085 r3254065 16 16 "option_prefixes": ["affwp_"] 17 17 }, 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 }, 18 30 "burst": { 19 31 "name": "Burst Statistics", 20 32 "option_prefixes": ["burst_"] 21 33 }, 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 }, 22 38 "complianz": { 23 39 "name": "Complianz GDPR", 24 40 "option_prefixes": ["cmplz_", "complianz_"] 25 41 }, 42 "cookiebot": { 43 "name": "Cookie banner plugin for WordPress – Cookiebot CMP by Usercentrics", 44 "option_prefixes": ["cookiebot_", "cookiebot-"] 45 }, 26 46 "duplicate-post": { 27 47 "name": "Yoast Duplicate Post", … … 40 60 "option_prefixes": ["fewer_tags"] 41 61 }, 62 "fluentform": { 63 "name": "Fluent Forms", 64 "option_prefixes": ["_fluentform_", "fluentform_"] 65 }, 66 "generateblocks": { 67 "name": "GenerateBlocks", 68 "option_prefixes": ["generateblocks_"] 69 }, 42 70 "google-analytics-for-wordpress": { 43 71 "name": "Google Analytics for WordPress by MonsterInsights", … … 46 74 "gravity-forms": { 47 75 "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_"] 49 113 }, 50 114 "really-simple-ssl": { … … 56 120 "option_prefixes": ["redirection_"] 57 121 }, 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 }, 58 134 "updraft": { 59 135 "name": "Updraft Plus", 60 "option_prefixes": ["updraft_" ]136 "option_prefixes": ["updraft_", "updraftplus_"] 61 137 }, 62 138 "yoast": { … … 67 143 "name": "WooCommerce", 68 144 "option_prefixes": ["wc_", "_transient__woocommerce_", "woocommerce_"] 145 }, 146 "wordfence": { 147 "name": "Wordfence", 148 "option_prefixes": ["wordfence_"] 69 149 }, 70 150 "wordpress": { … … 207 287 ] 208 288 }, 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 }, 209 301 "wpml": { 210 302 "name": "WPML", 211 303 "option_prefixes": ["_wpml_", "wpml_", "otgs-", "otgs_", "_icl_"] 212 304 }, 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 }, 213 313 "wpvivid-backuprestore": { 214 314 "name": "WPvivid Backup Plugin", 215 315 "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_"]268 316 } 269 317 } -
aaa-option-optimizer/trunk/readme.txt
r3078085 r3254065 2 2 Contributors: joostdevalk 3 3 Tags: options, database, cleanup 4 Requires at least: 6. 25 Tested up to: 6. 54 Requires at least: 6.6 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 1. 2.17 Stable tag: 1.3 8 8 License: GPL3+ 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 34 34 For security issues, please see the next question. 35 35 36 = How can I report security issues? = 37 38 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) 39 36 40 = How can I add recognized plugins? = 37 41 38 42 Please 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)43 43 44 44 == Installation == … … 54 54 55 55 == Changelog == 56 57 = 1.3 = 58 59 * Make plugin work with the latest autoload changes. 56 60 57 61 = 1.2.1 = -
aaa-option-optimizer/trunk/src/class-admin-page.php
r3078030 r3254065 96 96 \wp_enqueue_script( 97 97 'datatables', 98 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/data Tables.min.js',98 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.js', 99 99 [], // Dependencies. 100 100 '2.0.1', … … 104 104 \wp_enqueue_style( 105 105 'datatables', 106 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/data Tables.dataTables.min.css',106 plugin_dir_url( AAA_OPTION_OPTIMIZER_FILE ) . 'js/vendor/datatables.min.css', 107 107 [], 108 108 '2.0.1' … … 125 125 'i18n' => [ 126 126 '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' ), 128 128 'addAutoload' => esc_html__( 'Add autoload', 'aaa-option-optimizer' ), 129 129 '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' ), 131 131 132 132 'search' => esc_html__( 'Search:', 'aaa-option-optimizer' ), … … 193 193 break; 194 194 case 'size': 195 echo '<th>' . esc_html__( 'Size ( inKB)', 'aaa-option-optimizer' ) . '</th>';195 echo '<th>' . esc_html__( 'Size (KB)', 'aaa-option-optimizer' ) . '</th>'; 196 196 break; 197 197 case 'source': 198 echo '<th >' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>';198 echo '<th class="source">' . esc_html__( 'Source', 'aaa-option-optimizer' ) . '</th>'; 199 199 break; 200 200 } … … 284 284 285 285 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 288 294 289 295 echo '<h2>' . esc_html__( 'Stats', 'aaa-option-optimizer' ) . '</h2>'; … … 330 336 echo $this->get_value_button( $option, $value ); 331 337 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>'; 333 339 echo '</td></tr>'; 334 340 } … … 431 437 $id = 'aaa-option-optimizer-' . esc_attr( $name ); 432 438 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> 434 440 <div id="' . $id . '" popover class="aaa-option-optimizer-popover"> 435 441 <button class="aaa-option-optimizer-popover__close" popovertarget="' . $id . '" popovertargetaction="hide">X</button>' . 436 442 // translators: %s is the name of the option. 437 443 '<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> 439 445 </div>'; 440 446 } -
aaa-option-optimizer/trunk/src/class-rest.php
r3078030 r3254065 149 149 'name' => $option->option_name, 150 150 '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 ), 152 152 'size' => number_format( strlen( $option->option_value ) / 1024, 2 ), 153 153 'autoload' => $option->autoload, … … 170 170 $option_value = get_option( $option_name ); 171 171 172 if ( ! in_array( $autoload, [ 'yes', ' no' ], true ) ) {172 if ( ! in_array( $autoload, [ 'yes', 'on', 'no', 'off','auto', 'auto-on', 'auto-off' ], true ) ) { 173 173 return new \WP_Error( 'invalid_autoload_value', 'Invalid autoload value', [ 'status' => 400 ] ); 174 174 } … … 179 179 180 180 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 ); 182 187 183 188 if ( ! $succeeded ) { … … 211 216 public function create_option_false( $request ) { 212 217 $option_name = $request['option_name']; 213 if ( add_option( $option_name, false, '', 'no') ) {218 if ( add_option( $option_name, false, '', false ) ) { 214 219 return new \WP_REST_Response( [ 'success' => true ], 200 ); 215 220 }
Note: See TracChangeset
for help on using the changeset viewer.