Changeset 3648827
- Timestamp:
- 08/15/2026 04:08:24 PM (3 months ago)
- Location:
- auto-hide-admin-bar
- Files:
-
- 14 edited
- 1 copied
-
tags/1.8.0 (copied) (copied from auto-hide-admin-bar/trunk )
-
tags/1.8.0/app/class-option.php (modified) (6 diffs)
-
tags/1.8.0/app/class-options.php (modified) (1 diff)
-
tags/1.8.0/app/class-render-settings.php (modified) (5 diffs)
-
tags/1.8.0/app/class-sanitize.php (modified) (5 diffs)
-
tags/1.8.0/app/class-settings.php (modified) (2 diffs)
-
tags/1.8.0/auto-hide-admin-bar.php (modified) (2 diffs)
-
tags/1.8.0/readme.txt (modified) (3 diffs)
-
trunk/app/class-option.php (modified) (6 diffs)
-
trunk/app/class-options.php (modified) (1 diff)
-
trunk/app/class-render-settings.php (modified) (5 diffs)
-
trunk/app/class-sanitize.php (modified) (5 diffs)
-
trunk/app/class-settings.php (modified) (2 diffs)
-
trunk/auto-hide-admin-bar.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-hide-admin-bar/tags/1.8.0/app/class-option.php
r3428259 r3648827 13 13 */ 14 14 class Option { 15 16 /**17 * Option slug / name.18 */19 protected string $slug;20 15 21 16 /** … … 41 36 42 37 /** 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 /**63 38 * Register a sub option of AHAB 64 39 * … … 73 48 */ 74 49 public function __construct( 75 string $slug,76 $default_value = null,50 protected string $slug, 51 mixed $default_value = null, 77 52 ?callable $sanitize_callback = null, 78 53 ?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() 83 58 ) { 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; 92 62 } 93 63 … … 98 68 /** 99 69 * Get the default value. 100 *101 * @return array|int|string|bool|null102 70 */ 103 public function get_default_value() {71 public function get_default_value(): mixed { 104 72 return $this->default_value; 105 73 } … … 133 101 * 134 102 * @param mixed $value The value to sanitize. 135 * @return mixed136 103 */ 137 public function sanitize( $value ){104 public function sanitize( mixed $value ): mixed { 138 105 if ( \is_callable( $this->sanitize_callback ) ) { 139 106 return \call_user_func( $this->sanitize_callback, $value, $this ); … … 144 111 /** 145 112 * Get the current value of the option 146 *147 * @return array|int|string|bool|null148 113 */ 149 public function get_current_value() {114 public function get_current_value(): mixed { 150 115 $options = \get_option( Options::OPTION_NAME ); 151 116 -
auto-hide-admin-bar/tags/1.8.0/app/class-options.php
r3428259 r3648827 182 182 * 183 183 * @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 { 187 186 $option = self::get_option( $slug ); 188 187 return $option->get_current_value(); -
auto-hide-admin-bar/tags/1.8.0/app/class-render-settings.php
r3428259 r3648827 45 45 /** 46 46 * The current option. 47 *48 * @var Option $option49 47 */ 50 48 $option = $args['option']; … … 81 79 /** 82 80 * The current option. 83 *84 * @var Option $option85 81 */ 86 82 $option = $args['option']; … … 117 113 /** 118 114 * The current option. 119 *120 * @var Option $option121 115 */ 122 116 $option = $args['option']; … … 156 150 /** 157 151 * The current option. 158 *159 * @var Option $option160 152 */ 161 153 $option = $args['option']; … … 212 204 * @param ?string $label_text Optional label text. 213 205 */ 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 { 215 207 $input_html = '<input '; 216 208 foreach ( $attributes as $attribute => $value ) { -
auto-hide-admin-bar/tags/1.8.0/app/class-sanitize.php
r3428259 r3648827 15 15 * Validate numbers 16 16 * 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. 19 19 */ 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 } 21 24 $number = \filter_var( $value, \FILTER_VALIDATE_INT ); 22 25 if ( ! \is_int( $number ) ) { … … 33 36 * Validate radion options. 34 37 * 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. 38 40 */ 39 public static function radio( $value, Option $option ){41 public static function radio( mixed $value, Option $option ): int|string { 40 42 $allowed_values = $option->get_allowed_values(); 41 43 … … 45 47 } 46 48 47 if ( \array_key_exists( $value, $allowed_values ) ) {49 if ( ( \is_int( $value ) || \is_string( $value ) ) && \array_key_exists( $value, $allowed_values ) ) { 48 50 return $value; 49 51 } … … 52 54 return (int) $default; 53 55 } 54 return (string) $default; // @phpstan-ignore-line56 return (string) $default; 55 57 } 56 58 … … 77 79 * Validate keyboard character. 78 80 * 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. 81 83 */ 82 public static function keyboard_character( $value, Option $option ): string {84 public static function keyboard_character( mixed $value, Option $option ): string { 83 85 // Should be a single character. 84 86 if ( ! \is_string( $value ) || \strlen( $value ) !== 1 ) { -
auto-hide-admin-bar/tags/1.8.0/app/class-settings.php
r3428259 r3648827 55 55 'ahab_plugin', 56 56 $option->get_render_section(), 57 array( 57 array( // @phpstan-ignore-line Extra arguments are allowed. 58 58 'option' => $option, 59 59 'label_for' => 'ahab_setting_' . $option->get_slug(), … … 68 68 * @param mixed $values The values that are send to be saved. 69 69 */ 70 public static function save( $values ): array {70 public static function save( mixed $values ): array { 71 71 if ( ! \is_array( $values ) ) { 72 72 $values = array(); -
auto-hide-admin-bar/tags/1.8.0/auto-hide-admin-bar.php
r3428288 r3648827 11 11 * License: GPLv2 12 12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 13 * Requires at least: 3.114 * Requires PHP: 7.415 * Version: 1. 7.113 * Requires at least: 6.0 14 * Requires PHP: 8.4 15 * Version: 1.8.0 16 16 * 17 17 * @package AHAB … … 23 23 use AHAB\App\Frontend; 24 24 25 \define( 'AHAB_VERSION', '1. 7.1' );25 \define( 'AHAB_VERSION', '1.8.0' ); 26 26 \define( 'AHAB_DIR', \plugin_dir_path( __FILE__ ) ); // Full path with trailing slash. 27 27 \define( 'AHAB_URL', \plugin_dir_url( __FILE__ ) ); // With trailing slash. -
auto-hide-admin-bar/tags/1.8.0/readme.txt
r3575525 r3648827 2 2 Contributors: mbootsman,janwoostendorp 3 3 Tags: admin bar, autohide, hide, toolbar 4 Requires at least: 3.15 Tested up to: 7.0 6 Requires PHP: 7.47 Stable tag: 1. 7.14 Requires at least: 6.0 5 Tested up to: 7.0.4 6 Requires PHP: 8.4 7 Stable tag: 1.8.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 28 28 = This plugin was recently adopted, what's the plan? = 29 29 No 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.31 30 There are no plans to extend the functionality. Feel free to ask in the [support forum](http://wordpress.org/support/plugin/auto-hide-admin-bar) 32 31 … … 36 35 37 36 == Changelog == 37 38 = 1.8.0 = 39 40 * Increased supported PHP version to 8.4 41 * Increased supported WordPress to 6.0 38 42 39 43 = 1.7.1 = -
auto-hide-admin-bar/trunk/app/class-option.php
r3428259 r3648827 13 13 */ 14 14 class Option { 15 16 /**17 * Option slug / name.18 */19 protected string $slug;20 15 21 16 /** … … 41 36 42 37 /** 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 /**63 38 * Register a sub option of AHAB 64 39 * … … 73 48 */ 74 49 public function __construct( 75 string $slug,76 $default_value = null,50 protected string $slug, 51 mixed $default_value = null, 77 52 ?callable $sanitize_callback = null, 78 53 ?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() 83 58 ) { 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; 92 62 } 93 63 … … 98 68 /** 99 69 * Get the default value. 100 *101 * @return array|int|string|bool|null102 70 */ 103 public function get_default_value() {71 public function get_default_value(): mixed { 104 72 return $this->default_value; 105 73 } … … 133 101 * 134 102 * @param mixed $value The value to sanitize. 135 * @return mixed136 103 */ 137 public function sanitize( $value ){104 public function sanitize( mixed $value ): mixed { 138 105 if ( \is_callable( $this->sanitize_callback ) ) { 139 106 return \call_user_func( $this->sanitize_callback, $value, $this ); … … 144 111 /** 145 112 * Get the current value of the option 146 *147 * @return array|int|string|bool|null148 113 */ 149 public function get_current_value() {114 public function get_current_value(): mixed { 150 115 $options = \get_option( Options::OPTION_NAME ); 151 116 -
auto-hide-admin-bar/trunk/app/class-options.php
r3428259 r3648827 182 182 * 183 183 * @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 { 187 186 $option = self::get_option( $slug ); 188 187 return $option->get_current_value(); -
auto-hide-admin-bar/trunk/app/class-render-settings.php
r3428259 r3648827 45 45 /** 46 46 * The current option. 47 *48 * @var Option $option49 47 */ 50 48 $option = $args['option']; … … 81 79 /** 82 80 * The current option. 83 *84 * @var Option $option85 81 */ 86 82 $option = $args['option']; … … 117 113 /** 118 114 * The current option. 119 *120 * @var Option $option121 115 */ 122 116 $option = $args['option']; … … 156 150 /** 157 151 * The current option. 158 *159 * @var Option $option160 152 */ 161 153 $option = $args['option']; … … 212 204 * @param ?string $label_text Optional label text. 213 205 */ 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 { 215 207 $input_html = '<input '; 216 208 foreach ( $attributes as $attribute => $value ) { -
auto-hide-admin-bar/trunk/app/class-sanitize.php
r3428259 r3648827 15 15 * Validate numbers 16 16 * 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. 19 19 */ 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 } 21 24 $number = \filter_var( $value, \FILTER_VALIDATE_INT ); 22 25 if ( ! \is_int( $number ) ) { … … 33 36 * Validate radion options. 34 37 * 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. 38 40 */ 39 public static function radio( $value, Option $option ){41 public static function radio( mixed $value, Option $option ): int|string { 40 42 $allowed_values = $option->get_allowed_values(); 41 43 … … 45 47 } 46 48 47 if ( \array_key_exists( $value, $allowed_values ) ) {49 if ( ( \is_int( $value ) || \is_string( $value ) ) && \array_key_exists( $value, $allowed_values ) ) { 48 50 return $value; 49 51 } … … 52 54 return (int) $default; 53 55 } 54 return (string) $default; // @phpstan-ignore-line56 return (string) $default; 55 57 } 56 58 … … 77 79 * Validate keyboard character. 78 80 * 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. 81 83 */ 82 public static function keyboard_character( $value, Option $option ): string {84 public static function keyboard_character( mixed $value, Option $option ): string { 83 85 // Should be a single character. 84 86 if ( ! \is_string( $value ) || \strlen( $value ) !== 1 ) { -
auto-hide-admin-bar/trunk/app/class-settings.php
r3428259 r3648827 55 55 'ahab_plugin', 56 56 $option->get_render_section(), 57 array( 57 array( // @phpstan-ignore-line Extra arguments are allowed. 58 58 'option' => $option, 59 59 'label_for' => 'ahab_setting_' . $option->get_slug(), … … 68 68 * @param mixed $values The values that are send to be saved. 69 69 */ 70 public static function save( $values ): array {70 public static function save( mixed $values ): array { 71 71 if ( ! \is_array( $values ) ) { 72 72 $values = array(); -
auto-hide-admin-bar/trunk/auto-hide-admin-bar.php
r3428288 r3648827 11 11 * License: GPLv2 12 12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 13 * Requires at least: 3.114 * Requires PHP: 7.415 * Version: 1. 7.113 * Requires at least: 6.0 14 * Requires PHP: 8.4 15 * Version: 1.8.0 16 16 * 17 17 * @package AHAB … … 23 23 use AHAB\App\Frontend; 24 24 25 \define( 'AHAB_VERSION', '1. 7.1' );25 \define( 'AHAB_VERSION', '1.8.0' ); 26 26 \define( 'AHAB_DIR', \plugin_dir_path( __FILE__ ) ); // Full path with trailing slash. 27 27 \define( 'AHAB_URL', \plugin_dir_url( __FILE__ ) ); // With trailing slash. -
auto-hide-admin-bar/trunk/readme.txt
r3575525 r3648827 2 2 Contributors: mbootsman,janwoostendorp 3 3 Tags: admin bar, autohide, hide, toolbar 4 Requires at least: 3.15 Tested up to: 7.0 6 Requires PHP: 7.47 Stable tag: 1. 7.14 Requires at least: 6.0 5 Tested up to: 7.0.4 6 Requires PHP: 8.4 7 Stable tag: 1.8.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 28 28 = This plugin was recently adopted, what's the plan? = 29 29 No 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.31 30 There are no plans to extend the functionality. Feel free to ask in the [support forum](http://wordpress.org/support/plugin/auto-hide-admin-bar) 32 31 … … 36 35 37 36 == Changelog == 37 38 = 1.8.0 = 39 40 * Increased supported PHP version to 8.4 41 * Increased supported WordPress to 6.0 38 42 39 43 = 1.7.1 =
Note:
See TracChangeset
for help on using the changeset viewer.