Changeset 3375619
- Timestamp:
- 10/09/2025 09:50:24 AM (4 months ago)
- Location:
- aaa-option-optimizer
- Files:
-
- 1 added
- 12 edited
- 1 copied
-
assets/blueprints/playground.json (added)
-
tags/1.5.1 (copied) (copied from aaa-option-optimizer/trunk)
-
tags/1.5.1/aaa-option-optimizer.php (modified) (1 diff)
-
tags/1.5.1/css/style.css (modified) (1 diff)
-
tags/1.5.1/js/admin-script.js (modified) (1 diff)
-
tags/1.5.1/readme.txt (modified) (2 diffs)
-
tags/1.5.1/src/class-admin-page.php (modified) (6 diffs)
-
tags/1.5.1/src/class-rest.php (modified) (4 diffs)
-
trunk/aaa-option-optimizer.php (modified) (1 diff)
-
trunk/css/style.css (modified) (1 diff)
-
trunk/js/admin-script.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/class-admin-page.php (modified) (6 diffs)
-
trunk/src/class-rest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aaa-option-optimizer/tags/1.5.1/aaa-option-optimizer.php
r3347431 r3375619 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.5. 010 * Version: 1.5.1 11 11 * License: GPL-3.0+ 12 12 * Author: Joost de Valk -
aaa-option-optimizer/tags/1.5.1/css/style.css
r3324099 r3375619 22 22 .aaa_option_table select { 23 23 max-width: 20% !important; 24 } 25 /* Overrider for the Source <select> in the tfoot. */ 26 .aaa_option_table tfoot select { 27 max-width: 200px !important; 24 28 } 25 29 .aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete { -
aaa-option-optimizer/tags/1.5.1/js/admin-script.js
r3347431 r3375619 455 455 const selectedOptions = table.find( 'input.select-option' ); 456 456 selectedOptions.prop( 'checked', selectValue ); 457 458 // Match the checked value in the other select-all checkbox (not this one). 459 const otherSelectAll = table.find( '.select-all-checkbox' ).not( this ); 460 otherSelectAll.prop( 'checked', selectValue ); 457 461 } ); 458 462 -
aaa-option-optimizer/tags/1.5.1/readme.txt
r3347431 r3375619 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.5. 07 Stable tag: 1.5.1 8 8 License: GPL3+ 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 54 54 55 55 == Changelog == 56 57 = 1.5.1 = 58 59 * Add "select all" checkbox. 60 * Fix table filtering by Source column. 56 61 57 62 = 1.5.0 = -
aaa-option-optimizer/tags/1.5.1/src/class-admin-page.php
r3347431 r3375619 231 231 <thead> 232 232 <tr> 233 <th class="select-all">< /th>233 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 234 234 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 235 235 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 251 251 <tfoot> 252 252 <tr> 253 <th class="select-all">< /th>253 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 254 254 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 255 255 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 271 271 <thead> 272 272 <tr> 273 <th class="select-all">< /th>273 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 274 274 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 275 275 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 293 293 <tfoot> 294 294 <tr> 295 <th class="select-all">< /th>295 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 296 296 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 297 297 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 346 346 <thead> 347 347 <tr> 348 <th class="select-all">< /th>348 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 349 349 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 350 350 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 366 366 <tfoot> 367 367 <tr> 368 <th class="select-all">< /th>368 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 369 369 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 370 370 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> -
aaa-option-optimizer/tags/1.5.1/src/class-rest.php
r3324099 r3375619 255 255 $autoload_option_keys = array_fill_keys( $autoloaded_option_names, true ); 256 256 $unused_keys = array_diff_key( $autoload_option_keys, $used_options ); 257 $total_unused = count( $unused_keys ); 257 258 // Apply source filter to unused keys if specified. 259 $filter_by_source = isset( $_GET['columns'][2]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][2]['search']['value'] ) ) ) : ''; 260 if ( '' !== $filter_by_source ) { 261 $unused_keys = $this->filter_by_source( $unused_keys, $filter_by_source ); 262 } 263 264 $total_unused = count( $unused_keys ); 258 265 259 266 // Sort order. … … 360 367 $non_autoloaded_used_keys = array_diff_key( $used_options, $autoload_option_keys ); 361 368 369 // Filter by source (plugin). 370 $filter_by_source = isset( $_GET['columns'][2]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][2]['search']['value'] ) ) ) : ''; 371 if ( '' !== $filter_by_source ) { 372 $non_autoloaded_used_keys = $this->filter_by_source( $non_autoloaded_used_keys, $filter_by_source ); 373 } 374 362 375 // Search. 363 376 $search = isset( $_GET['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['search']['value'] ) ) ) : ''; … … 477 490 // Get used options that are not autoloaded. 478 491 $non_autoloaded_keys = array_diff_key( $used_options, $autoload_option_keys ); 492 493 // Filter by source (plugin). 494 $filter_by_source = isset( $_GET['columns'][1]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][1]['search']['value'] ) ) ) : ''; 495 if ( '' !== $filter_by_source ) { 496 $non_autoloaded_keys = $this->filter_by_source( $non_autoloaded_keys, $filter_by_source ); 497 } 479 498 480 499 // Search. … … 792 811 return $this->map_plugin_to_options->get_plugin_name( $option ); 793 812 } 813 814 /** 815 * Filter options array by source (plugin) name. 816 * 817 * @param array<string, mixed> $options_array The options array to filter. 818 * @param string $filter_term The filter term to match against plugin names. 819 * 820 * @return array<string, mixed> The filtered options array. 821 */ 822 private function filter_by_source( array $options_array, string $filter_term ): array { 823 824 if ( ! $filter_term ) { 825 return $options_array; 826 } 827 828 return array_filter( 829 $options_array, 830 function ( $option_name ) use ( $filter_term ) { 831 $plugin_name = $this->get_plugin_name( $option_name ); 832 return false !== stripos( $plugin_name, $filter_term ); 833 }, 834 ARRAY_FILTER_USE_KEY 835 ); 836 } 794 837 } -
aaa-option-optimizer/trunk/aaa-option-optimizer.php
r3347431 r3375619 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.5. 010 * Version: 1.5.1 11 11 * License: GPL-3.0+ 12 12 * Author: Joost de Valk -
aaa-option-optimizer/trunk/css/style.css
r3324099 r3375619 22 22 .aaa_option_table select { 23 23 max-width: 20% !important; 24 } 25 /* Overrider for the Source <select> in the tfoot. */ 26 .aaa_option_table tfoot select { 27 max-width: 200px !important; 24 28 } 25 29 .aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete { -
aaa-option-optimizer/trunk/js/admin-script.js
r3347431 r3375619 455 455 const selectedOptions = table.find( 'input.select-option' ); 456 456 selectedOptions.prop( 'checked', selectValue ); 457 458 // Match the checked value in the other select-all checkbox (not this one). 459 const otherSelectAll = table.find( '.select-all-checkbox' ).not( this ); 460 otherSelectAll.prop( 'checked', selectValue ); 457 461 } ); 458 462 -
aaa-option-optimizer/trunk/readme.txt
r3347431 r3375619 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.5. 07 Stable tag: 1.5.1 8 8 License: GPL3+ 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 54 54 55 55 == Changelog == 56 57 = 1.5.1 = 58 59 * Add "select all" checkbox. 60 * Fix table filtering by Source column. 56 61 57 62 = 1.5.0 = -
aaa-option-optimizer/trunk/src/class-admin-page.php
r3347431 r3375619 231 231 <thead> 232 232 <tr> 233 <th class="select-all">< /th>233 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 234 234 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 235 235 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 251 251 <tfoot> 252 252 <tr> 253 <th class="select-all">< /th>253 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 254 254 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 255 255 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 271 271 <thead> 272 272 <tr> 273 <th class="select-all">< /th>273 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 274 274 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 275 275 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 293 293 <tfoot> 294 294 <tr> 295 <th class="select-all">< /th>295 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 296 296 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 297 297 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 346 346 <thead> 347 347 <tr> 348 <th class="select-all">< /th>348 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 349 349 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 350 350 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> … … 366 366 <tfoot> 367 367 <tr> 368 <th class="select-all">< /th>368 <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th> 369 369 <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th> 370 370 <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th> -
aaa-option-optimizer/trunk/src/class-rest.php
r3324099 r3375619 255 255 $autoload_option_keys = array_fill_keys( $autoloaded_option_names, true ); 256 256 $unused_keys = array_diff_key( $autoload_option_keys, $used_options ); 257 $total_unused = count( $unused_keys ); 257 258 // Apply source filter to unused keys if specified. 259 $filter_by_source = isset( $_GET['columns'][2]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][2]['search']['value'] ) ) ) : ''; 260 if ( '' !== $filter_by_source ) { 261 $unused_keys = $this->filter_by_source( $unused_keys, $filter_by_source ); 262 } 263 264 $total_unused = count( $unused_keys ); 258 265 259 266 // Sort order. … … 360 367 $non_autoloaded_used_keys = array_diff_key( $used_options, $autoload_option_keys ); 361 368 369 // Filter by source (plugin). 370 $filter_by_source = isset( $_GET['columns'][2]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][2]['search']['value'] ) ) ) : ''; 371 if ( '' !== $filter_by_source ) { 372 $non_autoloaded_used_keys = $this->filter_by_source( $non_autoloaded_used_keys, $filter_by_source ); 373 } 374 362 375 // Search. 363 376 $search = isset( $_GET['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['search']['value'] ) ) ) : ''; … … 477 490 // Get used options that are not autoloaded. 478 491 $non_autoloaded_keys = array_diff_key( $used_options, $autoload_option_keys ); 492 493 // Filter by source (plugin). 494 $filter_by_source = isset( $_GET['columns'][1]['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['columns'][1]['search']['value'] ) ) ) : ''; 495 if ( '' !== $filter_by_source ) { 496 $non_autoloaded_keys = $this->filter_by_source( $non_autoloaded_keys, $filter_by_source ); 497 } 479 498 480 499 // Search. … … 792 811 return $this->map_plugin_to_options->get_plugin_name( $option ); 793 812 } 813 814 /** 815 * Filter options array by source (plugin) name. 816 * 817 * @param array<string, mixed> $options_array The options array to filter. 818 * @param string $filter_term The filter term to match against plugin names. 819 * 820 * @return array<string, mixed> The filtered options array. 821 */ 822 private function filter_by_source( array $options_array, string $filter_term ): array { 823 824 if ( ! $filter_term ) { 825 return $options_array; 826 } 827 828 return array_filter( 829 $options_array, 830 function ( $option_name ) use ( $filter_term ) { 831 $plugin_name = $this->get_plugin_name( $option_name ); 832 return false !== stripos( $plugin_name, $filter_term ); 833 }, 834 ARRAY_FILTER_USE_KEY 835 ); 836 } 794 837 }
Note: See TracChangeset
for help on using the changeset viewer.