Plugin Directory

Changeset 3375619


Ignore:
Timestamp:
10/09/2025 09:50:24 AM (4 months ago)
Author:
progressplanner
Message:

Update to version 1.5.1 from GitHub

Location:
aaa-option-optimizer
Files:
1 added
12 edited
1 copied

Legend:

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

    r3347431 r3375619  
    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.5.0
     10 * Version: 1.5.1
    1111 * License: GPL-3.0+
    1212 * Author: Joost de Valk
  • aaa-option-optimizer/tags/1.5.1/css/style.css

    r3324099 r3375619  
    2222.aaa_option_table select {
    2323    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;
    2428}
    2529.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  
    455455        const selectedOptions = table.find( 'input.select-option' );
    456456        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 );
    457461    } );
    458462
  • aaa-option-optimizer/tags/1.5.1/readme.txt

    r3347431 r3375619  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.5.0
     7Stable tag: 1.5.1
    88License: GPL3+
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    5454
    5555== Changelog ==
     56
     57= 1.5.1 =
     58
     59* Add "select all" checkbox.
     60* Fix table filtering by Source column.
    5661
    5762= 1.5.0 =
  • aaa-option-optimizer/tags/1.5.1/src/class-admin-page.php

    r3347431 r3375619  
    231231                        <thead>
    232232                            <tr>
    233                                 <th class="select-all"></th>
     233                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    234234                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    235235                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    251251                        <tfoot>
    252252                            <tr>
    253                                 <th class="select-all"></th>
     253                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    254254                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    255255                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    271271                        <thead>
    272272                            <tr>
    273                                 <th class="select-all"></th>
     273                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    274274                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    275275                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    293293                        <tfoot>
    294294                            <tr>
    295                                 <th class="select-all"></th>
     295                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    296296                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    297297                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    346346                        <thead>
    347347                            <tr>
    348                                 <th class="select-all"></th>
     348                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    349349                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    350350                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    366366                        <tfoot>
    367367                            <tr>
    368                                 <th class="select-all"></th>
     368                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    369369                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    370370                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
  • aaa-option-optimizer/tags/1.5.1/src/class-rest.php

    r3324099 r3375619  
    255255        $autoload_option_keys = array_fill_keys( $autoloaded_option_names, true );
    256256        $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 );
    258265
    259266        // Sort order.
     
    360367        $non_autoloaded_used_keys = array_diff_key( $used_options, $autoload_option_keys );
    361368
     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
    362375        // Search.
    363376        $search = isset( $_GET['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['search']['value'] ) ) ) : '';
     
    477490        // Get used options that are not autoloaded.
    478491        $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        }
    479498
    480499        // Search.
     
    792811        return $this->map_plugin_to_options->get_plugin_name( $option );
    793812    }
     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    }
    794837}
  • aaa-option-optimizer/trunk/aaa-option-optimizer.php

    r3347431 r3375619  
    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.5.0
     10 * Version: 1.5.1
    1111 * License: GPL-3.0+
    1212 * Author: Joost de Valk
  • aaa-option-optimizer/trunk/css/style.css

    r3324099 r3375619  
    2222.aaa_option_table select {
    2323    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;
    2428}
    2529.aaa_option_table .actions .button-delete, .aaa-option-optimizer-reset .button-delete {
  • aaa-option-optimizer/trunk/js/admin-script.js

    r3347431 r3375619  
    455455        const selectedOptions = table.find( 'input.select-option' );
    456456        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 );
    457461    } );
    458462
  • aaa-option-optimizer/trunk/readme.txt

    r3347431 r3375619  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.5.0
     7Stable tag: 1.5.1
    88License: GPL3+
    99License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    5454
    5555== Changelog ==
     56
     57= 1.5.1 =
     58
     59* Add "select all" checkbox.
     60* Fix table filtering by Source column.
    5661
    5762= 1.5.0 =
  • aaa-option-optimizer/trunk/src/class-admin-page.php

    r3347431 r3375619  
    231231                        <thead>
    232232                            <tr>
    233                                 <th class="select-all"></th>
     233                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    234234                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    235235                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    251251                        <tfoot>
    252252                            <tr>
    253                                 <th class="select-all"></th>
     253                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    254254                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    255255                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    271271                        <thead>
    272272                            <tr>
    273                                 <th class="select-all"></th>
     273                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    274274                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    275275                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    293293                        <tfoot>
    294294                            <tr>
    295                                 <th class="select-all"></th>
     295                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    296296                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    297297                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    346346                        <thead>
    347347                            <tr>
    348                                 <th class="select-all"></th>
     348                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    349349                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    350350                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
     
    366366                        <tfoot>
    367367                            <tr>
    368                                 <th class="select-all"></th>
     368                                <th class="select-all"><input type="checkbox" class="select-all-checkbox" /></th>
    369369                                <th><?php \esc_html_e( 'Option', 'aaa-option-optimizer' ); ?></th>
    370370                                <th><?php \esc_html_e( 'Source', 'aaa-option-optimizer' ); ?></th>
  • aaa-option-optimizer/trunk/src/class-rest.php

    r3324099 r3375619  
    255255        $autoload_option_keys = array_fill_keys( $autoloaded_option_names, true );
    256256        $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 );
    258265
    259266        // Sort order.
     
    360367        $non_autoloaded_used_keys = array_diff_key( $used_options, $autoload_option_keys );
    361368
     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
    362375        // Search.
    363376        $search = isset( $_GET['search']['value'] ) ? trim( \sanitize_text_field( \wp_unslash( $_GET['search']['value'] ) ) ) : '';
     
    477490        // Get used options that are not autoloaded.
    478491        $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        }
    479498
    480499        // Search.
     
    792811        return $this->map_plugin_to_options->get_plugin_name( $option );
    793812    }
     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    }
    794837}
Note: See TracChangeset for help on using the changeset viewer.