Plugin Directory

Changeset 3648827


Ignore:
Timestamp:
08/15/2026 04:08:24 PM (3 months ago)
Author:
janw.oostendorp
Message:

Update to version 1.8.0 from GitHub

Location:
auto-hide-admin-bar
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • auto-hide-admin-bar/tags/1.8.0/app/class-option.php

    r3428259 r3648827  
    1313 */
    1414class Option {
    15 
    16         /**
    17          * Option slug / name.
    18          */
    19         protected string $slug;
    2015
    2116        /**
    … …  
    4136
    4237        /**
    43          * Section where this option is rendered.
    44          */
    45         protected ?string $render_section = null;
    46 
    47         /**
    48          * Title shown for this option in the UI.
    49          */
    50         protected ?string $render_title = null;
    51 
    52         /**
    53          * Optional description for the option.
    54          */
    55         protected ?string $render_description = null;
    56 
    57         /**
    58          * Allowed values for the option (if applicable).
    59          */
    60         protected array $allowed_values = array();
    61 
    62         /**
    6338         * Register a sub option of AHAB
    6439         *
    … …  
    7348         */
    7449        public function __construct(
    75                 string $slug,
    76                 $default_value = null,
     50                protected string $slug,
     51                mixed $default_value = null,
    7752                ?callable $sanitize_callback = null,
    7853                ?callable $render_callback = null,
    79                 ?string $render_section = null,
    80                 ?string $render_title = null,
    81                 ?string $render_description = null,
    82                 array $allowed_values = array()
     54                protected ?string $render_section = null,
     55                protected ?string $render_title = null,
     56                protected ?string $render_description = null,
     57                protected array $allowed_values = array()
    8358        ) {
    84                 $this->slug               = $slug;
    85                 $this->default_value      = $default_value;
    86                 $this->sanitize_callback  = $sanitize_callback;
    87                 $this->render_callback    = $render_callback;
    88                 $this->render_section     = $render_section;
    89                 $this->render_title       = $render_title;
    90                 $this->render_description = $render_description;
    91                 $this->allowed_values     = $allowed_values;
     59                $this->default_value     = $default_value;
     60                $this->sanitize_callback = $sanitize_callback;
     61                $this->render_callback   = $render_callback;
    9262        }
    9363
    … …  
    9868        /**
    9969         * Get the default value.
    100          *
    101          * @return array|int|string|bool|null
    10270         */
    103         public function get_default_value() {
     71        public function get_default_value(): mixed {
    10472                return $this->default_value;
    10573        }
    … …  
    133101         *
    134102         * @param mixed $value The value to sanitize.
    135          * @return mixed
    136103         */
    137         public function sanitize( $value ) {
     104        public function sanitize( mixed $value ): mixed {
    138105                if ( \is_callable( $this->sanitize_callback ) ) {
    139106                        return \call_user_func( $this->sanitize_callback, $value, $this );
    … …  
    144111        /**
    145112         * Get the current value of the option
    146          *
    147          * @return array|int|string|bool|null
    148113         */
    149         public function get_current_value() {
     114        public function get_current_value(): mixed {
    150115                $options = \get_option( Options::OPTION_NAME );
    151116
  • auto-hide-admin-bar/tags/1.8.0/app/class-options.php

    r3428259 r3648827  
    182182         *
    183183         * @param string $slug The option slug.
    184          * @return mixed
    185          */
    186         public static function get_option_value( string $slug ) {
     184         */
     185        public static function get_option_value( string $slug ): mixed {
    187186                $option = self::get_option( $slug );
    188187                return $option->get_current_value();
  • auto-hide-admin-bar/tags/1.8.0/app/class-render-settings.php

    r3428259 r3648827  
    4545                /**
    4646                 * The current option.
    47                  *
    48                  * @var Option $option
    4947                 */
    5048                $option = $args['option'];
    … …  
    8179                /**
    8280                 * The current option.
    83                  *
    84                  * @var Option $option
    8581                 */
    8682                $option = $args['option'];
    … …  
    117113                /**
    118114                 * The current option.
    119                  *
    120                  * @var Option $option
    121115                 */
    122116                $option = $args['option'];
    … …  
    156150                /**
    157151                 * The current option.
    158                  *
    159                  * @var Option $option
    160152                 */
    161153                $option = $args['option'];
    … …  
    212204         * @param ?string $label_text Optional label text.
    213205         */
    214         protected static function generate_input_tag( array $attributes = array(), string $label_text = null ): string {
     206        protected static function generate_input_tag( array $attributes = array(), ?string $label_text = null ): string {
    215207                $input_html = '<input ';
    216208                foreach ( $attributes as $attribute => $value ) {
  • auto-hide-admin-bar/tags/1.8.0/app/class-sanitize.php

    r3428259 r3648827  
    1515         * Validate numbers
    1616         *
    17          * @param int|string $value The value to sanitize.
    18          * @param Option     $option The option being sanitized.
     17         * @param mixed $value The value to sanitize.
     18         * @param Option $option The option being sanitized.
    1919         */
    20         public static function number( $value, Option $option ): int {
     20        public static function number( mixed $value, Option $option ): int {
     21                if ( ! \is_scalar( $value ) ) {
     22                        return (int) $option->get_default_value();
     23                }
    2124                $number = \filter_var( $value, \FILTER_VALIDATE_INT );
    2225                if ( ! \is_int( $number ) ) {
    … …  
    3336         * Validate radion options.
    3437         *
    35          * @param int|string $value The value to sanitize.
    36          * @param Option     $option The option being sanitized.
    37          * @return int|string
     38         * @param mixed  $value The value to sanitize.
     39         * @param Option $option The option being sanitized.
    3840         */
    39         public static function radio( $value, Option $option ) {
     41        public static function radio( mixed $value, Option $option ): int|string {
    4042                $allowed_values = $option->get_allowed_values();
    4143
    … …  
    4547                }
    4648
    47                 if ( \array_key_exists( $value, $allowed_values ) ) {
     49                if ( ( \is_int( $value ) || \is_string( $value ) ) && \array_key_exists( $value, $allowed_values ) ) {
    4850                        return $value;
    4951                }
    … …  
    5254                        return (int) $default;
    5355                }
    54                 return (string) $default; // @phpstan-ignore-line
     56                return (string) $default;
    5557        }
    5658
    … …  
    7779         * Validate keyboard character.
    7880         *
    79          * @param string|int $value The values to sanitize.
    80          * @param Option     $option The option being sanitized.
     81         * @param mixed $value The values to sanitize.
     82         * @param Option $option The option being sanitized.
    8183         */
    82         public static function keyboard_character( $value, Option $option ): string {
     84        public static function keyboard_character( mixed $value, Option $option ): string {
    8385                // Should be a single character.
    8486                if ( ! \is_string( $value ) || \strlen( $value ) !== 1 ) {
  • auto-hide-admin-bar/tags/1.8.0/app/class-settings.php

    r3428259 r3648827  
    5555                                'ahab_plugin',
    5656                                $option->get_render_section(),
    57                                 array(
     57                                array( // @phpstan-ignore-line Extra arguments are allowed.
    5858                                        'option'    => $option,
    5959                                        'label_for' => 'ahab_setting_' . $option->get_slug(),
    … …  
    6868         * @param mixed $values The values that are send to be saved.
    6969         */
    70         public static function save( $values ): array {
     70        public static function save( mixed $values ): array {
    7171                if ( ! \is_array( $values ) ) {
    7272                        $values = array();
  • auto-hide-admin-bar/tags/1.8.0/auto-hide-admin-bar.php

    r3428288 r3648827  
    1111 * License:           GPLv2
    1212 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    13  * Requires at least: 3.1
    14  * Requires PHP:      7.4
    15  * Version:           1.7.1
     13 * Requires at least: 6.0
     14 * Requires PHP:      8.4
     15 * Version:           1.8.0
    1616 *
    1717 * @package           AHAB
    … …  
    2323use AHAB\App\Frontend;
    2424
    25 \define( 'AHAB_VERSION', '1.7.1' );
     25\define( 'AHAB_VERSION', '1.8.0' );
    2626\define( 'AHAB_DIR', \plugin_dir_path( __FILE__ ) ); // Full path with trailing slash.
    2727\define( 'AHAB_URL', \plugin_dir_url( __FILE__ ) ); // With trailing slash.
  • auto-hide-admin-bar/tags/1.8.0/readme.txt

    r3575525 r3648827  
    22Contributors: mbootsman,janwoostendorp
    33Tags: admin bar, autohide, hide, toolbar
    4 Requires at least: 3.1
    5 Tested up to: 7.0
    6 Requires PHP: 7.4
    7 Stable tag: 1.7.1
     4Requires at least: 6.0
     5Tested up to: 7.0.4
     6Requires PHP: 8.4
     7Stable tag: 1.8.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2828= This plugin was recently adopted, what's the plan? =
    2929No changes are planned for the end user. The plugin will remain backwards compatible.
    30 A big code refactor was done. In Q2 2026 the minimum php version will be updated to 8.2.
    3130There are no plans to extend the functionality. Feel free to ask in the [support forum](http://wordpress.org/support/plugin/auto-hide-admin-bar)
    3231
    … …  
    3635
    3736== Changelog ==
     37
     38= 1.8.0 =
     39
     40* Increased supported PHP version to 8.4
     41* Increased supported WordPress to 6.0
    3842
    3943= 1.7.1 =
  • auto-hide-admin-bar/trunk/app/class-option.php

    r3428259 r3648827  
    1313 */
    1414class Option {
    15 
    16         /**
    17          * Option slug / name.
    18          */
    19         protected string $slug;
    2015
    2116        /**
    … …  
    4136
    4237        /**
    43          * Section where this option is rendered.
    44          */
    45         protected ?string $render_section = null;
    46 
    47         /**
    48          * Title shown for this option in the UI.
    49          */
    50         protected ?string $render_title = null;
    51 
    52         /**
    53          * Optional description for the option.
    54          */
    55         protected ?string $render_description = null;
    56 
    57         /**
    58          * Allowed values for the option (if applicable).
    59          */
    60         protected array $allowed_values = array();
    61 
    62         /**
    6338         * Register a sub option of AHAB
    6439         *
    … …  
    7348         */
    7449        public function __construct(
    75                 string $slug,
    76                 $default_value = null,
     50                protected string $slug,
     51                mixed $default_value = null,
    7752                ?callable $sanitize_callback = null,
    7853                ?callable $render_callback = null,
    79                 ?string $render_section = null,
    80                 ?string $render_title = null,
    81                 ?string $render_description = null,
    82                 array $allowed_values = array()
     54                protected ?string $render_section = null,
     55                protected ?string $render_title = null,
     56                protected ?string $render_description = null,
     57                protected array $allowed_values = array()
    8358        ) {
    84                 $this->slug               = $slug;
    85                 $this->default_value      = $default_value;
    86                 $this->sanitize_callback  = $sanitize_callback;
    87                 $this->render_callback    = $render_callback;
    88                 $this->render_section     = $render_section;
    89                 $this->render_title       = $render_title;
    90                 $this->render_description = $render_description;
    91                 $this->allowed_values     = $allowed_values;
     59                $this->default_value     = $default_value;
     60                $this->sanitize_callback = $sanitize_callback;
     61                $this->render_callback   = $render_callback;
    9262        }
    9363
    … …  
    9868        /**
    9969         * Get the default value.
    100          *
    101          * @return array|int|string|bool|null
    10270         */
    103         public function get_default_value() {
     71        public function get_default_value(): mixed {
    10472                return $this->default_value;
    10573        }
    … …  
    133101         *
    134102         * @param mixed $value The value to sanitize.
    135          * @return mixed
    136103         */
    137         public function sanitize( $value ) {
     104        public function sanitize( mixed $value ): mixed {
    138105                if ( \is_callable( $this->sanitize_callback ) ) {
    139106                        return \call_user_func( $this->sanitize_callback, $value, $this );
    … …  
    144111        /**
    145112         * Get the current value of the option
    146          *
    147          * @return array|int|string|bool|null
    148113         */
    149         public function get_current_value() {
     114        public function get_current_value(): mixed {
    150115                $options = \get_option( Options::OPTION_NAME );
    151116
  • auto-hide-admin-bar/trunk/app/class-options.php

    r3428259 r3648827  
    182182         *
    183183         * @param string $slug The option slug.
    184          * @return mixed
    185          */
    186         public static function get_option_value( string $slug ) {
     184         */
     185        public static function get_option_value( string $slug ): mixed {
    187186                $option = self::get_option( $slug );
    188187                return $option->get_current_value();
  • auto-hide-admin-bar/trunk/app/class-render-settings.php

    r3428259 r3648827  
    4545                /**
    4646                 * The current option.
    47                  *
    48                  * @var Option $option
    4947                 */
    5048                $option = $args['option'];
    … …  
    8179                /**
    8280                 * The current option.
    83                  *
    84                  * @var Option $option
    8581                 */
    8682                $option = $args['option'];
    … …  
    117113                /**
    118114                 * The current option.
    119                  *
    120                  * @var Option $option
    121115                 */
    122116                $option = $args['option'];
    … …  
    156150                /**
    157151                 * The current option.
    158                  *
    159                  * @var Option $option
    160152                 */
    161153                $option = $args['option'];
    … …  
    212204         * @param ?string $label_text Optional label text.
    213205         */
    214         protected static function generate_input_tag( array $attributes = array(), string $label_text = null ): string {
     206        protected static function generate_input_tag( array $attributes = array(), ?string $label_text = null ): string {
    215207                $input_html = '<input ';
    216208                foreach ( $attributes as $attribute => $value ) {
  • auto-hide-admin-bar/trunk/app/class-sanitize.php

    r3428259 r3648827  
    1515         * Validate numbers
    1616         *
    17          * @param int|string $value The value to sanitize.
    18          * @param Option     $option The option being sanitized.
     17         * @param mixed $value The value to sanitize.
     18         * @param Option $option The option being sanitized.
    1919         */
    20         public static function number( $value, Option $option ): int {
     20        public static function number( mixed $value, Option $option ): int {
     21                if ( ! \is_scalar( $value ) ) {
     22                        return (int) $option->get_default_value();
     23                }
    2124                $number = \filter_var( $value, \FILTER_VALIDATE_INT );
    2225                if ( ! \is_int( $number ) ) {
    … …  
    3336         * Validate radion options.
    3437         *
    35          * @param int|string $value The value to sanitize.
    36          * @param Option     $option The option being sanitized.
    37          * @return int|string
     38         * @param mixed  $value The value to sanitize.
     39         * @param Option $option The option being sanitized.
    3840         */
    39         public static function radio( $value, Option $option ) {
     41        public static function radio( mixed $value, Option $option ): int|string {
    4042                $allowed_values = $option->get_allowed_values();
    4143
    … …  
    4547                }
    4648
    47                 if ( \array_key_exists( $value, $allowed_values ) ) {
     49                if ( ( \is_int( $value ) || \is_string( $value ) ) && \array_key_exists( $value, $allowed_values ) ) {
    4850                        return $value;
    4951                }
    … …  
    5254                        return (int) $default;
    5355                }
    54                 return (string) $default; // @phpstan-ignore-line
     56                return (string) $default;
    5557        }
    5658
    … …  
    7779         * Validate keyboard character.
    7880         *
    79          * @param string|int $value The values to sanitize.
    80          * @param Option     $option The option being sanitized.
     81         * @param mixed $value The values to sanitize.
     82         * @param Option $option The option being sanitized.
    8183         */
    82         public static function keyboard_character( $value, Option $option ): string {
     84        public static function keyboard_character( mixed $value, Option $option ): string {
    8385                // Should be a single character.
    8486                if ( ! \is_string( $value ) || \strlen( $value ) !== 1 ) {
  • auto-hide-admin-bar/trunk/app/class-settings.php

    r3428259 r3648827  
    5555                                'ahab_plugin',
    5656                                $option->get_render_section(),
    57                                 array(
     57                                array( // @phpstan-ignore-line Extra arguments are allowed.
    5858                                        'option'    => $option,
    5959                                        'label_for' => 'ahab_setting_' . $option->get_slug(),
    … …  
    6868         * @param mixed $values The values that are send to be saved.
    6969         */
    70         public static function save( $values ): array {
     70        public static function save( mixed $values ): array {
    7171                if ( ! \is_array( $values ) ) {
    7272                        $values = array();
  • auto-hide-admin-bar/trunk/auto-hide-admin-bar.php

    r3428288 r3648827  
    1111 * License:           GPLv2
    1212 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    13  * Requires at least: 3.1
    14  * Requires PHP:      7.4
    15  * Version:           1.7.1
     13 * Requires at least: 6.0
     14 * Requires PHP:      8.4
     15 * Version:           1.8.0
    1616 *
    1717 * @package           AHAB
    … …  
    2323use AHAB\App\Frontend;
    2424
    25 \define( 'AHAB_VERSION', '1.7.1' );
     25\define( 'AHAB_VERSION', '1.8.0' );
    2626\define( 'AHAB_DIR', \plugin_dir_path( __FILE__ ) ); // Full path with trailing slash.
    2727\define( 'AHAB_URL', \plugin_dir_url( __FILE__ ) ); // With trailing slash.
  • auto-hide-admin-bar/trunk/readme.txt

    r3575525 r3648827  
    22Contributors: mbootsman,janwoostendorp
    33Tags: admin bar, autohide, hide, toolbar
    4 Requires at least: 3.1
    5 Tested up to: 7.0
    6 Requires PHP: 7.4
    7 Stable tag: 1.7.1
     4Requires at least: 6.0
     5Tested up to: 7.0.4
     6Requires PHP: 8.4
     7Stable tag: 1.8.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2828= This plugin was recently adopted, what's the plan? =
    2929No changes are planned for the end user. The plugin will remain backwards compatible.
    30 A big code refactor was done. In Q2 2026 the minimum php version will be updated to 8.2.
    3130There are no plans to extend the functionality. Feel free to ask in the [support forum](http://wordpress.org/support/plugin/auto-hide-admin-bar)
    3231
    … …  
    3635
    3736== Changelog ==
     37
     38= 1.8.0 =
     39
     40* Increased supported PHP version to 8.4
     41* Increased supported WordPress to 6.0
    3842
    3943= 1.7.1 =
Note: See TracChangeset for help on using the changeset viewer.