@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // ** Database settings - You can get this info from your web host ** // |
| 43 | 43 | /** The name of the database for WordPress */ |
| 44 | -define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
|
|
| 44 | +define('DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress'));
|
|
| 45 | 45 | |
| 46 | 46 | /** Database username */ |
| 47 | -define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username') );
|
|
| 47 | +define('DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username'));
|
|
| 48 | 48 | |
| 49 | 49 | /** Database password */ |
| 50 | -define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password') );
|
|
| 50 | +define('DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password'));
|
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Docker image fallback values above are sourced from the official WordPress installation wizard: |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | /** Database hostname */ |
| 59 | -define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql') );
|
|
| 59 | +define('DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql'));
|
|
| 60 | 60 | |
| 61 | 61 | /** Database charset to use in creating database tables. */ |
| 62 | -define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
|
|
| 62 | +define('DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8'));
|
|
| 63 | 63 | |
| 64 | 64 | /** The database collate type. Don't change this if in doubt. */ |
| 65 | -define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
|
|
| 65 | +define('DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', ''));
|
|
| 66 | 66 | |
| 67 | 67 | /**#@+ |
| 68 | 68 | * Authentication unique keys and salts. |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @since 2.6.0 |
| 77 | 77 | */ |
| 78 | -define( 'AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'eeea12a6cfd4373476a78bb31b8e058c2abc0c80') );
|
|
| 79 | -define( 'SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '5f0c5b5c2aa7402950810ad887ee29ebc34ab9be') );
|
|
| 80 | -define( 'LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '5b230d18674226be79df75ac512639ddccef8b6f') );
|
|
| 81 | -define( 'NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', '12f495cf82bc22810128a60819cbc3d5ac696df6') );
|
|
| 82 | -define( 'AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '560279d8689ea9b9b3c9b7ec1114095899295f8c') );
|
|
| 83 | -define( 'SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', 'db7f0e3a98248dac329461bce9e223efec703e95') );
|
|
| 84 | -define( 'LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', '21206bcdcd338de4bd9d44c55aef027d15dbd53b') );
|
|
| 85 | -define( 'NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', '28e4b83cc335c8f3e4d53712f2060c052fa38336') );
|
|
| 78 | +define('AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'eeea12a6cfd4373476a78bb31b8e058c2abc0c80'));
|
|
| 79 | +define('SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '5f0c5b5c2aa7402950810ad887ee29ebc34ab9be'));
|
|
| 80 | +define('LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '5b230d18674226be79df75ac512639ddccef8b6f'));
|
|
| 81 | +define('NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', '12f495cf82bc22810128a60819cbc3d5ac696df6'));
|
|
| 82 | +define('AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '560279d8689ea9b9b3c9b7ec1114095899295f8c'));
|
|
| 83 | +define('SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', 'db7f0e3a98248dac329461bce9e223efec703e95'));
|
|
| 84 | +define('LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', '21206bcdcd338de4bd9d44c55aef027d15dbd53b'));
|
|
| 85 | +define('NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', '28e4b83cc335c8f3e4d53712f2060c052fa38336'));
|
|
| 86 | 86 | // (See also https://wordpress.stackexchange.com/a/152905/199287) |
| 87 | 87 | |
| 88 | 88 | /**#@-*/ |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @link https://wordpress.org/support/article/debugging-in-wordpress/ |
| 109 | 109 | */ |
| 110 | -define( 'WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', '') );
|
|
| 111 | -define( 'WP_DEBUG', false ); |
|
| 110 | +define('WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', ''));
|
|
| 111 | +define('WP_DEBUG', false);
|
|
| 112 | 112 | |
| 113 | 113 | /* Add any custom values between this line and the "stop editing" line. */ |
| 114 | 114 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | /* That's all, stop editing! Happy publishing. */ |
| 127 | 127 | |
| 128 | 128 | /** Absolute path to the WordPress directory. */ |
| 129 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 130 | - define( 'ABSPATH', __DIR__ . '/' ); |
|
| 129 | +if (!defined('ABSPATH')) {
|
|
| 130 | + define('ABSPATH', __DIR__ . '/');
|
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** Sets up WordPress vars and included files. */ |
@@ -29,11 +29,9 @@ |
||
| 29 | 29 | function getenv_docker($env, $default) {
|
| 30 | 30 | if ($fileEnv = getenv($env . '_FILE')) {
|
| 31 | 31 | return rtrim(file_get_contents($fileEnv), "\r\n"); |
| 32 | - } |
|
| 33 | - else if (($val = getenv($env)) !== false) {
|
|
| 32 | + } else if (($val = getenv($env)) !== false) {
|
|
| 34 | 33 | return $val; |
| 35 | - } |
|
| 36 | - else {
|
|
| 34 | + } else {
|
|
| 37 | 35 | return $default; |
| 38 | 36 | } |
| 39 | 37 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @since 3.0.0 |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'kirki_show_upgrade_notification' ) ) : |
|
| 13 | +if (!function_exists('kirki_show_upgrade_notification')) : |
|
| 14 | 14 | /** |
| 15 | 15 | * Fires at the end of the update message container in each |
| 16 | 16 | * row of the plugins list table. |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | * @param array $plugin_data An array of plugin metadata. |
| 22 | 22 | * @param array $response An array of metadata about the available plugin update. |
| 23 | 23 | */ |
| 24 | - function kirki_show_upgrade_notification( $plugin_data, $response ) { |
|
| 24 | + function kirki_show_upgrade_notification($plugin_data, $response) { |
|
| 25 | 25 | |
| 26 | 26 | // Check "upgrade_notice". |
| 27 | - if ( isset( $response->upgrade_notice ) && strlen( trim( $response->upgrade_notice ) ) > 0 ) : ?> |
|
| 27 | + if (isset($response->upgrade_notice) && strlen(trim($response->upgrade_notice)) > 0) : ?> |
|
| 28 | 28 | <style>.kirki-upgrade-notification {background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px;margin-bottom:10px;}.kirki-upgrade-notification + p {display:none;}</style> |
| 29 | 29 | <div class="kirki-upgrade-notification"> |
| 30 | - <strong><?php esc_html_e( 'Important Upgrade Notice:', 'kirki' ); ?></strong> |
|
| 31 | - <?php $upgrade_notice = wp_strip_all_tags( $response->upgrade_notice ); ?> |
|
| 32 | - <?php echo esc_html( $upgrade_notice ); ?> |
|
| 30 | + <strong><?php esc_html_e('Important Upgrade Notice:', 'kirki'); ?></strong> |
|
| 31 | + <?php $upgrade_notice = wp_strip_all_tags($response->upgrade_notice); ?> |
|
| 32 | + <?php echo esc_html($upgrade_notice); ?> |
|
| 33 | 33 | </div> |
| 34 | 34 | <?php |
| 35 | 35 | endif; |
| 36 | 36 | } |
| 37 | 37 | endif; |
| 38 | -add_action( 'in_plugin_update_message-' . plugin_basename( __FILE__ ), 'kirki_show_upgrade_notification', 10, 2 ); |
|
| 38 | +add_action('in_plugin_update_message-' . plugin_basename(__FILE__), 'kirki_show_upgrade_notification', 10, 2); |
|
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | use Kirki\Util\Helper; |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if (!defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Do not proceed if Kirki does not exist. |
| 21 | -if ( ! class_exists( 'Kirki' ) ) { |
|
| 21 | +if (!class_exists('Kirki')) { |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | 'kirki_demo_panel', |
| 40 | 40 | [ |
| 41 | 41 | 'priority' => 10, |
| 42 | - 'title' => esc_html__( 'Kirki Demo Panel', 'kirki' ), |
|
| 43 | - 'description' => esc_html__( 'Contains sections for all kirki controls.', 'kirki' ), |
|
| 42 | + 'title' => esc_html__('Kirki Demo Panel', 'kirki'), |
|
| 43 | + 'description' => esc_html__('Contains sections for all kirki controls.', 'kirki'), |
|
| 44 | 44 | ] |
| 45 | 45 | ); |
| 46 | 46 | |
@@ -53,58 +53,58 @@ discard block |
||
| 53 | 53 | * @link https://kirki.org/docs/getting-started/sections.html |
| 54 | 54 | */ |
| 55 | 55 | $sections = [ |
| 56 | - 'background' => [ esc_html__( 'Background', 'kirki' ), '' ], |
|
| 57 | - 'code' => [ esc_html__( 'Code', 'kirki' ), '' ], |
|
| 58 | - 'checkbox' => [ esc_html__( 'Checkbox', 'kirki' ), '' ], |
|
| 59 | - 'color' => [ esc_html__( 'Color', 'kirki' ), '' ], |
|
| 60 | - 'color_advanced' => [ esc_html__( 'Color — Advanced', 'kirki' ), '' ], |
|
| 61 | - 'color_palette' => [ esc_html__( 'Color Palette', 'kirki' ), '' ], |
|
| 62 | - 'custom' => [ esc_html__( 'Custom', 'kirki' ), '' ], |
|
| 63 | - 'dashicons' => [ esc_html__( 'Dashicons', 'kirki' ), '' ], |
|
| 64 | - 'date' => [ esc_html__( 'Date', 'kirki' ), '' ], |
|
| 65 | - 'dimension' => [ esc_html__( 'Dimension', 'kirki' ), '' ], |
|
| 66 | - 'dimensions' => [ esc_html__( 'Dimensions', 'kirki' ), '' ], |
|
| 67 | - 'dropdown-pages' => [ esc_html__( 'Dropdown Pages', 'kirki' ), '' ], |
|
| 68 | - 'editor' => [ esc_html__( 'Editor', 'kirki' ), '' ], |
|
| 69 | - 'fontawesome' => [ esc_html__( 'Font-Awesome', 'kirki' ), '' ], |
|
| 70 | - 'generic' => [ esc_html__( 'Generic', 'kirki' ), '' ], |
|
| 71 | - 'image' => [ esc_html__( 'Image', 'kirki' ), '' ], |
|
| 72 | - 'multicheck' => [ esc_html__( 'Multicheck', 'kirki' ), '' ], |
|
| 73 | - 'multicolor' => [ esc_html__( 'Multicolor', 'kirki' ), '' ], |
|
| 74 | - 'number' => [ esc_html__( 'Number', 'kirki' ), '' ], |
|
| 75 | - 'palette' => [ esc_html__( 'Palette', 'kirki' ), '' ], |
|
| 76 | - 'preset' => [ esc_html__( 'Preset', 'kirki' ), '' ], |
|
| 77 | - 'radio' => [ esc_html__( 'Radio', 'kirki' ), esc_html__( 'A plain Radio control.', 'kirki' ) ], |
|
| 78 | - 'radio-buttonset' => [ esc_html__( 'Radio Buttonset', 'kirki' ), esc_html__( 'Radio-Buttonset controls are essentially radio controls with some fancy styling to make them look cooler.', 'kirki' ) ], |
|
| 79 | - 'radio-image' => [ esc_html__( 'Radio Image', 'kirki' ), esc_html__( 'Radio-Image controls are essentially radio controls with some fancy styles to use images', 'kirki' ) ], |
|
| 80 | - 'repeater' => [ esc_html__( 'Repeater', 'kirki' ), '' ], |
|
| 81 | - 'select' => [ esc_html__( 'Select', 'kirki' ), '' ], |
|
| 82 | - 'slider' => [ esc_html__( 'Slider', 'kirki' ), '' ], |
|
| 83 | - 'sortable' => [ esc_html__( 'Sortable', 'kirki' ), '' ], |
|
| 84 | - 'switch' => [ esc_html__( 'Switch', 'kirki' ), '', 'outer' ], |
|
| 85 | - 'toggle' => [ esc_html__( 'Toggle', 'kirki' ), '', 'outer' ], |
|
| 86 | - 'typography' => [ esc_html__( 'Typography', 'kirki' ), '' ], |
|
| 87 | - 'upload' => [ esc_html__( 'Upload', 'kirki' ), '' ], |
|
| 56 | + 'background' => [esc_html__('Background', 'kirki'), ''], |
|
| 57 | + 'code' => [esc_html__('Code', 'kirki'), ''], |
|
| 58 | + 'checkbox' => [esc_html__('Checkbox', 'kirki'), ''], |
|
| 59 | + 'color' => [esc_html__('Color', 'kirki'), ''], |
|
| 60 | + 'color_advanced' => [esc_html__('Color — Advanced', 'kirki'), ''], |
|
| 61 | + 'color_palette' => [esc_html__('Color Palette', 'kirki'), ''], |
|
| 62 | + 'custom' => [esc_html__('Custom', 'kirki'), ''], |
|
| 63 | + 'dashicons' => [esc_html__('Dashicons', 'kirki'), ''], |
|
| 64 | + 'date' => [esc_html__('Date', 'kirki'), ''], |
|
| 65 | + 'dimension' => [esc_html__('Dimension', 'kirki'), ''], |
|
| 66 | + 'dimensions' => [esc_html__('Dimensions', 'kirki'), ''], |
|
| 67 | + 'dropdown-pages' => [esc_html__('Dropdown Pages', 'kirki'), ''], |
|
| 68 | + 'editor' => [esc_html__('Editor', 'kirki'), ''], |
|
| 69 | + 'fontawesome' => [esc_html__('Font-Awesome', 'kirki'), ''], |
|
| 70 | + 'generic' => [esc_html__('Generic', 'kirki'), ''], |
|
| 71 | + 'image' => [esc_html__('Image', 'kirki'), ''], |
|
| 72 | + 'multicheck' => [esc_html__('Multicheck', 'kirki'), ''], |
|
| 73 | + 'multicolor' => [esc_html__('Multicolor', 'kirki'), ''], |
|
| 74 | + 'number' => [esc_html__('Number', 'kirki'), ''], |
|
| 75 | + 'palette' => [esc_html__('Palette', 'kirki'), ''], |
|
| 76 | + 'preset' => [esc_html__('Preset', 'kirki'), ''], |
|
| 77 | + 'radio' => [esc_html__('Radio', 'kirki'), esc_html__('A plain Radio control.', 'kirki')], |
|
| 78 | + 'radio-buttonset' => [esc_html__('Radio Buttonset', 'kirki'), esc_html__('Radio-Buttonset controls are essentially radio controls with some fancy styling to make them look cooler.', 'kirki')], |
|
| 79 | + 'radio-image' => [esc_html__('Radio Image', 'kirki'), esc_html__('Radio-Image controls are essentially radio controls with some fancy styles to use images', 'kirki')], |
|
| 80 | + 'repeater' => [esc_html__('Repeater', 'kirki'), ''], |
|
| 81 | + 'select' => [esc_html__('Select', 'kirki'), ''], |
|
| 82 | + 'slider' => [esc_html__('Slider', 'kirki'), ''], |
|
| 83 | + 'sortable' => [esc_html__('Sortable', 'kirki'), ''], |
|
| 84 | + 'switch' => [esc_html__('Switch', 'kirki'), '', 'outer'], |
|
| 85 | + 'toggle' => [esc_html__('Toggle', 'kirki'), '', 'outer'], |
|
| 86 | + 'typography' => [esc_html__('Typography', 'kirki'), ''], |
|
| 87 | + 'upload' => [esc_html__('Upload', 'kirki'), ''], |
|
| 88 | 88 | ]; |
| 89 | 89 | |
| 90 | -foreach ( $sections as $section_id => $section ) { |
|
| 90 | +foreach ($sections as $section_id => $section) { |
|
| 91 | 91 | $section_args = [ |
| 92 | 92 | 'title' => $section[0], |
| 93 | 93 | 'description' => $section[1], |
| 94 | 94 | 'panel' => 'kirki_demo_panel', |
| 95 | 95 | ]; |
| 96 | - if ( isset( $section[2] ) ) { |
|
| 96 | + if (isset($section[2])) { |
|
| 97 | 97 | $section_args['type'] = $section[2]; |
| 98 | 98 | } |
| 99 | - new \Kirki\Section( str_replace( '-', '_', $section_id ) . '_section', $section_args ); |
|
| 99 | + new \Kirki\Section(str_replace('-', '_', $section_id) . '_section', $section_args); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | new \Kirki\Section( |
| 103 | 103 | 'pro_test', |
| 104 | 104 | [ |
| 105 | - 'title' => esc_html__( 'Test Link Section', 'kirki' ), |
|
| 105 | + 'title' => esc_html__('Test Link Section', 'kirki'), |
|
| 106 | 106 | 'type' => 'link', |
| 107 | - 'button_text' => esc_html__( 'Pro', 'kirki' ), |
|
| 107 | + 'button_text' => esc_html__('Pro', 'kirki'), |
|
| 108 | 108 | 'button_url' => 'https://kirki.org', |
| 109 | 109 | ] |
| 110 | 110 | ); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | new \Kirki\Field\Background( |
| 118 | 118 | [ |
| 119 | 119 | 'settings' => 'kirki_demo_background', |
| 120 | - 'label' => esc_html__( 'Background Control', 'kirki' ), |
|
| 121 | - 'description' => esc_html__( 'Background conrols are pretty complex! (but useful if properly used)', 'kirki' ), |
|
| 120 | + 'label' => esc_html__('Background Control', 'kirki'), |
|
| 121 | + 'description' => esc_html__('Background conrols are pretty complex! (but useful if properly used)', 'kirki'), |
|
| 122 | 122 | 'section' => 'background_section', |
| 123 | 123 | 'default' => [ |
| 124 | 124 | 'background-color' => 'rgba(20,20,20,.8)', |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | new \Kirki\Field\Code( |
| 140 | 140 | [ |
| 141 | 141 | 'settings' => 'kirki_demo_code_css', |
| 142 | - 'label' => esc_html__( 'Code Control — CSS', 'kirki' ), |
|
| 143 | - 'description' => esc_html__( 'Sample of code control in CSS format', 'kirki' ), |
|
| 142 | + 'label' => esc_html__('Code Control — CSS', 'kirki'), |
|
| 143 | + 'description' => esc_html__('Sample of code control in CSS format', 'kirki'), |
|
| 144 | 144 | 'section' => 'code_section', |
| 145 | 145 | 'default' => '', |
| 146 | 146 | 'choices' => [ |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | new \Kirki\Field\Checkbox( |
| 158 | 158 | [ |
| 159 | 159 | 'settings' => 'kirki_demo_checkbox', |
| 160 | - 'label' => esc_html__( 'Checkbox Control', 'kirki' ), |
|
| 161 | - 'description' => esc_html__( 'Sample of checkbox control', 'kirki' ), |
|
| 160 | + 'label' => esc_html__('Checkbox Control', 'kirki'), |
|
| 161 | + 'description' => esc_html__('Sample of checkbox control', 'kirki'), |
|
| 162 | 162 | 'section' => 'checkbox_section', |
| 163 | 163 | 'default' => true, |
| 164 | 164 | ] |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | 'type' => 'color', |
| 176 | 176 | 'settings' => 'kirki_demo_color_alpha_old', |
| 177 | 177 | 'label' => 'Using <code>Kirki::add_field</code> — With alpha', |
| 178 | - 'description' => esc_html__( 'This is a color control registered using `Kirki::add_field` with "alpha" => true (the old Kirki API).', 'kirki' ), |
|
| 178 | + 'description' => esc_html__('This is a color control registered using `Kirki::add_field` with "alpha" => true (the old Kirki API).', 'kirki'), |
|
| 179 | 179 | 'section' => 'color_section', |
| 180 | 180 | 'transport' => 'postMessage', |
| 181 | 181 | 'default' => '#ff0055', |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | new \Kirki\Field\Color( |
| 189 | 189 | [ |
| 190 | 190 | 'settings' => 'kirki_demo_color_hex', |
| 191 | - 'label' => __( 'Hex only', 'kirki' ), |
|
| 192 | - 'description' => esc_html__( 'This is a color control without alpha channel.', 'kirki' ), |
|
| 191 | + 'label' => __('Hex only', 'kirki'), |
|
| 192 | + 'description' => esc_html__('This is a color control without alpha channel.', 'kirki'), |
|
| 193 | 193 | 'section' => 'color_section', |
| 194 | 194 | 'transport' => 'postMessage', |
| 195 | 195 | 'default' => '#0008DC', |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | new \Kirki\Field\Color( |
| 200 | 200 | [ |
| 201 | 201 | 'settings' => 'kirki_demo_color_alpha', |
| 202 | - 'label' => __( 'With alpha channel', 'kirki' ), |
|
| 203 | - 'description' => esc_html__( 'This is a color control with alpha channel.', 'kirki' ), |
|
| 202 | + 'label' => __('With alpha channel', 'kirki'), |
|
| 203 | + 'description' => esc_html__('This is a color control with alpha channel.', 'kirki'), |
|
| 204 | 204 | 'section' => 'color_section', |
| 205 | 205 | 'transport' => 'postMessage', |
| 206 | 206 | 'choices' => [ |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | new \Kirki\Field\Color( |
| 213 | 213 | [ |
| 214 | 214 | 'settings' => 'kirki_demo_color_hue', |
| 215 | - 'label' => __( 'Hue only.', 'kirki' ), |
|
| 216 | - 'description' => esc_html__( 'This is a color control with "mode" => "hue" (hue mode).', 'kirki' ), |
|
| 215 | + 'label' => __('Hue only.', 'kirki'), |
|
| 216 | + 'description' => esc_html__('This is a color control with "mode" => "hue" (hue mode).', 'kirki'), |
|
| 217 | 217 | 'section' => 'color_section', |
| 218 | 218 | 'transport' => 'postMessage', |
| 219 | 219 | 'default' => 160, |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | new \Kirki\Field\Color( |
| 235 | 235 | [ |
| 236 | 236 | 'settings' => 'kirki_demo_color_form_component_hex', |
| 237 | - 'label' => __( 'v4 — form_component — HexColorPicker', 'kirki' ), |
|
| 238 | - 'description' => esc_html__( 'This is a color control with form_component value is HexColorPicker.', 'kirki' ), |
|
| 237 | + 'label' => __('v4 — form_component — HexColorPicker', 'kirki'), |
|
| 238 | + 'description' => esc_html__('This is a color control with form_component value is HexColorPicker.', 'kirki'), |
|
| 239 | 239 | 'section' => 'color_advanced_section', |
| 240 | 240 | 'default' => '#ffff00', |
| 241 | 241 | 'choices' => [ |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | new \Kirki\Field\Color( |
| 261 | 261 | [ |
| 262 | 262 | 'settings' => 'kirki_demo_color_form_component_rgb', |
| 263 | - 'label' => __( 'v4 — form_component — RgbColorPicker', 'kirki' ), |
|
| 264 | - 'description' => esc_html__( 'This is a color control with form_component value is RgbColorPicker. The saved value will be an array.', 'kirki' ), |
|
| 263 | + 'label' => __('v4 — form_component — RgbColorPicker', 'kirki'), |
|
| 264 | + 'description' => esc_html__('This is a color control with form_component value is RgbColorPicker. The saved value will be an array.', 'kirki'), |
|
| 265 | 265 | 'section' => 'color_advanced_section', |
| 266 | 266 | 'default' => '#ffff00', |
| 267 | 267 | 'choices' => [ |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | new \Kirki\Field\Color( |
| 282 | 282 | [ |
| 283 | 283 | 'settings' => 'kirki_demo_color_form_component_rgb_string', |
| 284 | - 'label' => __( 'v4 — form_component — RgbStringColorPicker', 'kirki' ), |
|
| 285 | - 'description' => esc_html__( 'This is a color control with form_component value is RgbStringColorPicker. The saved value will be a string.', 'kirki' ), |
|
| 284 | + 'label' => __('v4 — form_component — RgbStringColorPicker', 'kirki'), |
|
| 285 | + 'description' => esc_html__('This is a color control with form_component value is RgbStringColorPicker. The saved value will be a string.', 'kirki'), |
|
| 286 | 286 | 'section' => 'color_advanced_section', |
| 287 | 287 | 'default' => '#ffff00', |
| 288 | 288 | 'choices' => [ |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | new \Kirki\Field\Color( |
| 308 | 308 | [ |
| 309 | 309 | 'settings' => 'kirki_demo_color_form_component_rgba', |
| 310 | - 'label' => __( 'v4 — form_component — RgbaColorPicker', 'kirki' ), |
|
| 311 | - 'description' => esc_html__( 'This is a color control with form_component value is RgbaColorPicker. The saved value will be an array.', 'kirki' ), |
|
| 310 | + 'label' => __('v4 — form_component — RgbaColorPicker', 'kirki'), |
|
| 311 | + 'description' => esc_html__('This is a color control with form_component value is RgbaColorPicker. The saved value will be an array.', 'kirki'), |
|
| 312 | 312 | 'section' => 'color_advanced_section', |
| 313 | 313 | 'default' => '#ffff00', |
| 314 | 314 | 'choices' => [ |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | new \Kirki\Field\Color( |
| 329 | 329 | [ |
| 330 | 330 | 'settings' => 'kirki_demo_color_form_component_rgba_string', |
| 331 | - 'label' => __( 'v4 — form_component — RgbaStringColorPicker', 'kirki' ), |
|
| 332 | - 'description' => esc_html__( 'This is a color control with form_component value is RgbaStringColorPicker. The saved value will be a string.', 'kirki' ), |
|
| 331 | + 'label' => __('v4 — form_component — RgbaStringColorPicker', 'kirki'), |
|
| 332 | + 'description' => esc_html__('This is a color control with form_component value is RgbaStringColorPicker. The saved value will be a string.', 'kirki'), |
|
| 333 | 333 | 'section' => 'color_advanced_section', |
| 334 | 334 | 'default' => '#ffff00', |
| 335 | 335 | 'choices' => [ |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | new \Kirki\Field\Color( |
| 354 | 354 | [ |
| 355 | 355 | 'settings' => 'kirki_demo_color_form_component_hsl', |
| 356 | - 'label' => __( 'v4 — form_component — HslColorPicker', 'kirki' ), |
|
| 357 | - 'description' => esc_html__( 'This is a color control with form_component value is HslColorPicker. The saved value will be an array', 'kirki' ), |
|
| 356 | + 'label' => __('v4 — form_component — HslColorPicker', 'kirki'), |
|
| 357 | + 'description' => esc_html__('This is a color control with form_component value is HslColorPicker. The saved value will be an array', 'kirki'), |
|
| 358 | 358 | 'section' => 'color_advanced_section', |
| 359 | 359 | 'default' => 'hsl(206, 23%, 25%)', |
| 360 | 360 | 'choices' => [ |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | new \Kirki\Field\Color( |
| 375 | 375 | [ |
| 376 | 376 | 'settings' => 'kirki_demo_color_form_component_hsl_string', |
| 377 | - 'label' => __( 'v4 — form_component — HslStringColorPicker', 'kirki' ), |
|
| 378 | - 'description' => esc_html__( 'This is a color control with form_component value is HslStringColorPicker. The saved value will be a string', 'kirki' ), |
|
| 377 | + 'label' => __('v4 — form_component — HslStringColorPicker', 'kirki'), |
|
| 378 | + 'description' => esc_html__('This is a color control with form_component value is HslStringColorPicker. The saved value will be a string', 'kirki'), |
|
| 379 | 379 | 'section' => 'color_advanced_section', |
| 380 | 380 | 'default' => 'hsl(206, 23%, 25%)', |
| 381 | 381 | 'choices' => [ |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | new \Kirki\Field\Color( |
| 401 | 401 | [ |
| 402 | 402 | 'settings' => 'kirki_demo_color_form_component_hsla', |
| 403 | - 'label' => __( 'v4 — form_component — HslaColorPicker', 'kirki' ), |
|
| 404 | - 'description' => esc_html__( 'This is a color control with form_component value is HslaColorPicker. The saved value will be an array', 'kirki' ), |
|
| 403 | + 'label' => __('v4 — form_component — HslaColorPicker', 'kirki'), |
|
| 404 | + 'description' => esc_html__('This is a color control with form_component value is HslaColorPicker. The saved value will be an array', 'kirki'), |
|
| 405 | 405 | 'section' => 'color_advanced_section', |
| 406 | 406 | 'default' => 'hsla(206, 23%, 25%, 0.7)', |
| 407 | 407 | 'choices' => [ |
@@ -421,8 +421,8 @@ discard block |
||
| 421 | 421 | new \Kirki\Field\Color( |
| 422 | 422 | [ |
| 423 | 423 | 'settings' => 'kirki_demo_color_form_component_hsla_string', |
| 424 | - 'label' => __( 'v4 — form_component — HslaStringColorPicker', 'kirki' ), |
|
| 425 | - 'description' => esc_html__( 'This is a color control with form_component value is HslaStringColorPicker. The saved value will be a string', 'kirki' ), |
|
| 424 | + 'label' => __('v4 — form_component — HslaStringColorPicker', 'kirki'), |
|
| 425 | + 'description' => esc_html__('This is a color control with form_component value is HslaStringColorPicker. The saved value will be a string', 'kirki'), |
|
| 426 | 426 | 'section' => 'color_advanced_section', |
| 427 | 427 | 'default' => 'hsla(206, 23%, 25%, 0.7)', |
| 428 | 428 | 'choices' => [ |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | new \Kirki\Field\Date( |
| 439 | 439 | [ |
| 440 | 440 | 'settings' => 'kirki_demo_date', |
| 441 | - 'label' => esc_html__( 'Date Control', 'kirki' ), |
|
| 442 | - 'description' => esc_html__( 'This is a date control.', 'kirki' ), |
|
| 441 | + 'label' => esc_html__('Date Control', 'kirki'), |
|
| 442 | + 'description' => esc_html__('This is a date control.', 'kirki'), |
|
| 443 | 443 | 'section' => 'date_section', |
| 444 | 444 | 'default' => '', |
| 445 | 445 | ] |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | new \Kirki\Field\Date( |
| 449 | 449 | [ |
| 450 | 450 | 'settings' => 'kirki_demo_date_2', |
| 451 | - 'label' => esc_html__( 'Date Control 2', 'kirki' ), |
|
| 452 | - 'description' => esc_html__( 'This is a date control.', 'kirki' ), |
|
| 451 | + 'label' => esc_html__('Date Control 2', 'kirki'), |
|
| 452 | + 'description' => esc_html__('This is a date control.', 'kirki'), |
|
| 453 | 453 | 'section' => 'date_section', |
| 454 | 454 | 'default' => '', |
| 455 | 455 | ] |
@@ -461,8 +461,8 @@ discard block |
||
| 461 | 461 | new \Kirki\Field\Editor( |
| 462 | 462 | [ |
| 463 | 463 | 'settings' => 'kirki_demo_editor_1', |
| 464 | - 'label' => esc_html__( 'First Editor Control', 'kirki' ), |
|
| 465 | - 'description' => esc_html__( 'This is an editor control.', 'kirki' ), |
|
| 464 | + 'label' => esc_html__('First Editor Control', 'kirki'), |
|
| 465 | + 'description' => esc_html__('This is an editor control.', 'kirki'), |
|
| 466 | 466 | 'section' => 'editor_section', |
| 467 | 467 | 'default' => '', |
| 468 | 468 | ] |
@@ -471,10 +471,10 @@ discard block |
||
| 471 | 471 | new \Kirki\Field\Editor( |
| 472 | 472 | [ |
| 473 | 473 | 'settings' => 'kirki_demo_editor_2', |
| 474 | - 'label' => esc_html__( 'Second Editor Control', 'kirki' ), |
|
| 475 | - 'description' => esc_html__( 'This is a 2nd editor control just to check that we do not have issues with multiple instances.', 'kirki' ), |
|
| 474 | + 'label' => esc_html__('Second Editor Control', 'kirki'), |
|
| 475 | + 'description' => esc_html__('This is a 2nd editor control just to check that we do not have issues with multiple instances.', 'kirki'), |
|
| 476 | 476 | 'section' => 'editor_section', |
| 477 | - 'default' => esc_html__( 'Default Text', 'kirki' ), |
|
| 477 | + 'default' => esc_html__('Default Text', 'kirki'), |
|
| 478 | 478 | ] |
| 479 | 479 | ); |
| 480 | 480 | |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | new \Kirki\Field\Color_Palette( |
| 487 | 487 | [ |
| 488 | 488 | 'settings' => 'kirki_demo_color_palette_simple', |
| 489 | - 'label' => esc_html__( 'Simple Colors Set', 'kirki' ), |
|
| 490 | - 'description' => esc_html__( 'With default size (28). The `size` here is inner size (without border)', 'kirki' ), |
|
| 489 | + 'label' => esc_html__('Simple Colors Set', 'kirki'), |
|
| 490 | + 'description' => esc_html__('With default size (28). The `size` here is inner size (without border)', 'kirki'), |
|
| 491 | 491 | 'section' => 'color_palette_section', |
| 492 | 492 | 'default' => '#888888', |
| 493 | 493 | 'transport' => 'postMessage', |
| 494 | 494 | 'choices' => [ |
| 495 | - 'colors' => [ '#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff' ], |
|
| 495 | + 'colors' => ['#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff'], |
|
| 496 | 496 | 'style' => 'round', |
| 497 | 497 | ], |
| 498 | 498 | ] |
@@ -501,13 +501,13 @@ discard block |
||
| 501 | 501 | new \Kirki\Field\Color_Palette( |
| 502 | 502 | [ |
| 503 | 503 | 'settings' => 'kirki_demo_color_palette_material_all', |
| 504 | - 'label' => esc_html__( 'Material Design Colors — All', 'kirki' ), |
|
| 505 | - 'description' => esc_html__( 'Showing all material design colors using `round` shape and size is 17', 'kirki' ), |
|
| 504 | + 'label' => esc_html__('Material Design Colors — All', 'kirki'), |
|
| 505 | + 'description' => esc_html__('Showing all material design colors using `round` shape and size is 17', 'kirki'), |
|
| 506 | 506 | 'section' => 'color_palette_section', |
| 507 | 507 | 'default' => '#D1C4E9', |
| 508 | 508 | 'transport' => 'postMessage', |
| 509 | 509 | 'choices' => [ |
| 510 | - 'colors' => Helper::get_material_design_colors( 'all' ), |
|
| 510 | + 'colors' => Helper::get_material_design_colors('all'), |
|
| 511 | 511 | 'shape' => 'round', |
| 512 | 512 | 'size' => 17, |
| 513 | 513 | ], |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | new \Kirki\Field\Color_Palette( |
| 518 | 518 | [ |
| 519 | 519 | 'settings' => 'kirki_demo_color_palette_material_primary', |
| 520 | - 'label' => esc_html__( 'Material Design Colors — Primary', 'kirki' ), |
|
| 521 | - 'description' => esc_html__( 'Showing primary material design colors', 'kirki' ), |
|
| 520 | + 'label' => esc_html__('Material Design Colors — Primary', 'kirki'), |
|
| 521 | + 'description' => esc_html__('Showing primary material design colors', 'kirki'), |
|
| 522 | 522 | 'section' => 'color_palette_section', |
| 523 | 523 | 'choices' => [ |
| 524 | - 'colors' => Helper::get_material_design_colors( 'primary' ), |
|
| 524 | + 'colors' => Helper::get_material_design_colors('primary'), |
|
| 525 | 525 | 'size' => 25, |
| 526 | 526 | ], |
| 527 | 527 | ] |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | new \Kirki\Field\Color_Palette( |
| 531 | 531 | [ |
| 532 | 532 | 'settings' => 'kirki_demo_color_palette_material_red', |
| 533 | - 'label' => esc_html__( 'Material Design Colors — Red', 'kirki' ), |
|
| 534 | - 'description' => esc_html__( 'Showing red material design colors', 'kirki' ), |
|
| 533 | + 'label' => esc_html__('Material Design Colors — Red', 'kirki'), |
|
| 534 | + 'description' => esc_html__('Showing red material design colors', 'kirki'), |
|
| 535 | 535 | 'section' => 'color_palette_section', |
| 536 | 536 | 'choices' => [ |
| 537 | - 'colors' => Helper::get_material_design_colors( 'red' ), |
|
| 537 | + 'colors' => Helper::get_material_design_colors('red'), |
|
| 538 | 538 | 'size' => 16, |
| 539 | 539 | ], |
| 540 | 540 | ] |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | new \Kirki\Field\Color_Palette( |
| 544 | 544 | [ |
| 545 | 545 | 'settings' => 'kirki_demo_color_palette_a100', |
| 546 | - 'label' => esc_html__( 'Material Design Colors — A100', 'kirki' ), |
|
| 547 | - 'description' => esc_html__( 'Showing "A100" variant of material design colors', 'kirki' ), |
|
| 546 | + 'label' => esc_html__('Material Design Colors — A100', 'kirki'), |
|
| 547 | + 'description' => esc_html__('Showing "A100" variant of material design colors', 'kirki'), |
|
| 548 | 548 | 'section' => 'color_palette_section', |
| 549 | 549 | 'default' => '#FF80AB', |
| 550 | 550 | 'choices' => [ |
| 551 | - 'colors' => Helper::get_material_design_colors( 'A100' ), |
|
| 551 | + 'colors' => Helper::get_material_design_colors('A100'), |
|
| 552 | 552 | 'size' => 60, |
| 553 | 553 | 'style' => 'round', |
| 554 | 554 | ], |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | 'section' => 'color_palette_section', |
| 566 | 566 | 'transport' => 'postMessage', |
| 567 | 567 | 'choices' => [ |
| 568 | - 'colors' => [ '#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff' ], |
|
| 568 | + 'colors' => ['#000000', '#222222', '#444444', '#666666', '#888888', '#aaaaaa', '#cccccc', '#eeeeee', '#ffffff'], |
|
| 569 | 569 | 'style' => 'round', |
| 570 | 570 | ], |
| 571 | 571 | ] |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | add_action( |
| 575 | 575 | 'customize_register', |
| 576 | - function( $wp_customize ) { |
|
| 576 | + function($wp_customize) { |
|
| 577 | 577 | /** |
| 578 | 578 | * The custom control class |
| 579 | 579 | */ |
@@ -585,12 +585,12 @@ discard block |
||
| 585 | 585 | $saved_value = $this->value(); |
| 586 | 586 | ?> |
| 587 | 587 | |
| 588 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 589 | - <span class="customize-control-description description"><?php echo esc_html( $this->description ); ?></span> |
|
| 588 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 589 | + <span class="customize-control-description description"><?php echo esc_html($this->description); ?></span> |
|
| 590 | 590 | |
| 591 | 591 | <div class="kirki-demo-custom-control"> |
| 592 | 592 | <div class="slider"></div> |
| 593 | - <input type="text" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $saved_value ); ?>" class="customize-control-slider-value" <?php $this->link(); ?> /> |
|
| 593 | + <input type="text" id="<?php echo esc_attr($this->id); ?>" name="<?php echo esc_attr($this->id); ?>" value="<?php echo esc_attr($saved_value); ?>" class="customize-control-slider-value" <?php $this->link(); ?> /> |
|
| 594 | 594 | </div> |
| 595 | 595 | |
| 596 | 596 | <?php |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | // Register our custom control with Kirki. |
| 601 | 601 | add_filter( |
| 602 | 602 | 'kirki_control_types', |
| 603 | - function( $controls ) { |
|
| 603 | + function($controls) { |
|
| 604 | 604 | $controls['kirki-demo-custom-control'] = 'Kirki_Demo_Custom_Control'; |
| 605 | 605 | return $controls; |
| 606 | 606 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | [ |
| 615 | 615 | 'type' => 'kirki-demo-custom-control', |
| 616 | 616 | 'settings' => 'kirki_demo_custom_control_old_way', |
| 617 | - 'label' => esc_html__( 'Custom Control', 'kirki' ), |
|
| 617 | + 'label' => esc_html__('Custom Control', 'kirki'), |
|
| 618 | 618 | 'description' => 'A custom control demo, registered by extending `Kirki\\Control\\Base` class.', |
| 619 | 619 | 'section' => 'custom_section', |
| 620 | 620 | 'transport' => 'postMessage', |
@@ -629,8 +629,8 @@ discard block |
||
| 629 | 629 | new \Kirki\Field\Dashicons( |
| 630 | 630 | [ |
| 631 | 631 | 'settings' => 'kirki_demo_dashicons_setting_0', |
| 632 | - 'label' => esc_html__( 'Dashicons Control', 'kirki' ), |
|
| 633 | - 'description' => esc_html__( 'Using a custom array of dashicons', 'kirki' ), |
|
| 632 | + 'label' => esc_html__('Dashicons Control', 'kirki'), |
|
| 633 | + 'description' => esc_html__('Using a custom array of dashicons', 'kirki'), |
|
| 634 | 634 | 'section' => 'dashicons_section', |
| 635 | 635 | 'default' => 'menu', |
| 636 | 636 | 'choices' => [ |
@@ -648,8 +648,8 @@ discard block |
||
| 648 | 648 | new \Kirki\Field\Dashicons( |
| 649 | 649 | [ |
| 650 | 650 | 'settings' => 'kirki_demo_dashicons_setting_1', |
| 651 | - 'label' => esc_html__( 'All Dashicons', 'kirki' ), |
|
| 652 | - 'description' => esc_html__( 'Showing all dashicons', 'kirki' ), |
|
| 651 | + 'label' => esc_html__('All Dashicons', 'kirki'), |
|
| 652 | + 'description' => esc_html__('Showing all dashicons', 'kirki'), |
|
| 653 | 653 | 'section' => 'dashicons_section', |
| 654 | 654 | 'default' => 'menu', |
| 655 | 655 | ] |
@@ -661,8 +661,8 @@ discard block |
||
| 661 | 661 | new \Kirki\Field\Dimension( |
| 662 | 662 | [ |
| 663 | 663 | 'settings' => 'kirki_demo_dimension_0', |
| 664 | - 'label' => esc_html__( 'Dimension Control', 'kirki' ), |
|
| 665 | - 'description' => esc_html__( 'A simple dimension control.', 'kirki' ), |
|
| 664 | + 'label' => esc_html__('Dimension Control', 'kirki'), |
|
| 665 | + 'description' => esc_html__('A simple dimension control.', 'kirki'), |
|
| 666 | 666 | 'section' => 'dimension_section', |
| 667 | 667 | 'default' => '10px', |
| 668 | 668 | 'choices' => [ |
@@ -677,8 +677,8 @@ discard block |
||
| 677 | 677 | new \Kirki\Field\Dimensions( |
| 678 | 678 | [ |
| 679 | 679 | 'settings' => 'kirki_demo_dimensions_0', |
| 680 | - 'label' => esc_html__( 'Dimensions Control', 'kirki' ), |
|
| 681 | - 'description' => esc_html__( 'Sample of dimensions control with 2 fields.', 'kirki' ), |
|
| 680 | + 'label' => esc_html__('Dimensions Control', 'kirki'), |
|
| 681 | + 'description' => esc_html__('Sample of dimensions control with 2 fields.', 'kirki'), |
|
| 682 | 682 | 'section' => 'dimensions_section', |
| 683 | 683 | 'default' => [ |
| 684 | 684 | 'width' => '100px', |
@@ -690,8 +690,8 @@ discard block |
||
| 690 | 690 | new \Kirki\Field\Dimensions( |
| 691 | 691 | [ |
| 692 | 692 | 'settings' => 'kirki_demo_dimensions_1', |
| 693 | - 'label' => esc_html__( 'Dimension Control', 'kirki' ), |
|
| 694 | - 'description' => esc_html__( 'Sample of dimensions control with 4 fields.', 'kirki' ), |
|
| 693 | + 'label' => esc_html__('Dimension Control', 'kirki'), |
|
| 694 | + 'description' => esc_html__('Sample of dimensions control with 4 fields.', 'kirki'), |
|
| 695 | 695 | 'section' => 'dimensions_section', |
| 696 | 696 | 'default' => [ |
| 697 | 697 | 'padding-top' => '1em', |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | new \Kirki\Field\Dimensions( |
| 706 | 706 | [ |
| 707 | 707 | 'settings' => 'kirki_demo_padding', |
| 708 | - 'label' => esc_html__( 'Padding Control', 'kirki' ), |
|
| 709 | - 'description' => esc_html__( 'Sample of padding controls with 3 fields.', 'kirki' ), |
|
| 708 | + 'label' => esc_html__('Padding Control', 'kirki'), |
|
| 709 | + 'description' => esc_html__('Sample of padding controls with 3 fields.', 'kirki'), |
|
| 710 | 710 | 'section' => 'dimensions_section', |
| 711 | 711 | 'default' => [ |
| 712 | 712 | 'top' => '1em', |
@@ -719,8 +719,8 @@ discard block |
||
| 719 | 719 | new \Kirki\Field\Dimensions( |
| 720 | 720 | [ |
| 721 | 721 | 'settings' => 'kirki_demo_spacing', |
| 722 | - 'label' => esc_html__( 'Spacing Control', 'kirki' ), |
|
| 723 | - 'description' => esc_html__( 'Sample of spacing controls with 4 fields.', 'kirki' ), |
|
| 722 | + 'label' => esc_html__('Spacing Control', 'kirki'), |
|
| 723 | + 'description' => esc_html__('Sample of spacing controls with 4 fields.', 'kirki'), |
|
| 724 | 724 | 'section' => 'dimensions_section', |
| 725 | 725 | 'default' => [ |
| 726 | 726 | 'top' => '1em', |
@@ -737,8 +737,8 @@ discard block |
||
| 737 | 737 | new \Kirki\Field\Dropdown_Pages( |
| 738 | 738 | [ |
| 739 | 739 | 'settings' => 'kirki_demo_dropdown_pages', |
| 740 | - 'label' => esc_html__( 'Dropdown Pages Control', 'kirki' ), |
|
| 741 | - 'description' => esc_html__( 'Sample of dropdown pages control.', 'kirki' ), |
|
| 740 | + 'label' => esc_html__('Dropdown Pages Control', 'kirki'), |
|
| 741 | + 'description' => esc_html__('Sample of dropdown pages control.', 'kirki'), |
|
| 742 | 742 | 'section' => 'dropdown_pages_section', |
| 743 | 743 | 'default' => [ |
| 744 | 744 | 'width' => '100px', |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | new \Kirki\Field\Text( |
| 754 | 754 | [ |
| 755 | 755 | 'settings' => 'kirki_demo_generic_text', |
| 756 | - 'label' => esc_html__( 'Generic Control — Text Field', 'kirki' ), |
|
| 757 | - 'description' => esc_html__( 'The demo of this control has partial refresh with transport is postMessage', 'kirki' ), |
|
| 756 | + 'label' => esc_html__('Generic Control — Text Field', 'kirki'), |
|
| 757 | + 'description' => esc_html__('The demo of this control has partial refresh with transport is postMessage', 'kirki'), |
|
| 758 | 758 | 'section' => 'generic_section', |
| 759 | 759 | 'transport' => 'postMessage', |
| 760 | 760 | 'default' => '', |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | 'generic_text_refresh' => [ |
| 763 | 763 | 'selector' => '.kirki-partial-refresh-demo', |
| 764 | 764 | 'render_callback' => function() { |
| 765 | - $value = get_theme_mod( 'kirki_demo_generic_text' ); |
|
| 765 | + $value = get_theme_mod('kirki_demo_generic_text'); |
|
| 766 | 766 | return $value ? 'value of Generic URL Field control is: ' . $value : ''; |
| 767 | 767 | }, |
| 768 | 768 | ], |
@@ -773,15 +773,15 @@ discard block |
||
| 773 | 773 | new \Kirki\Field\URL( |
| 774 | 774 | [ |
| 775 | 775 | 'settings' => 'kirki_demo_generic_url', |
| 776 | - 'label' => esc_html__( 'Generic Control — URL Field', 'kirki' ), |
|
| 777 | - 'description' => esc_html__( 'The demo of this control has partial refresh without transport is defined', 'kirki' ), |
|
| 776 | + 'label' => esc_html__('Generic Control — URL Field', 'kirki'), |
|
| 777 | + 'description' => esc_html__('The demo of this control has partial refresh without transport is defined', 'kirki'), |
|
| 778 | 778 | 'section' => 'generic_section', |
| 779 | 779 | 'default' => '', |
| 780 | 780 | 'partial_refresh' => [ |
| 781 | 781 | 'generic_text_refresh2' => [ |
| 782 | 782 | 'selector' => '.kirki-partial-refresh-demo2', |
| 783 | 783 | 'render_callback' => function() { |
| 784 | - $value = get_theme_mod( 'kirki_demo_generic_url' ); |
|
| 784 | + $value = get_theme_mod('kirki_demo_generic_url'); |
|
| 785 | 785 | return $value ? 'value of Generic URL Field control is: ' . $value : ''; |
| 786 | 786 | }, |
| 787 | 787 | ], |
@@ -792,8 +792,8 @@ discard block |
||
| 792 | 792 | new \Kirki\Field\Textarea( |
| 793 | 793 | [ |
| 794 | 794 | 'settings' => 'kirki_demo_generic_textarea', |
| 795 | - 'label' => esc_html__( 'Generic Control — Textarea Field', 'kirki' ), |
|
| 796 | - 'description' => esc_html__( 'Description', 'kirki' ), |
|
| 795 | + 'label' => esc_html__('Generic Control — Textarea Field', 'kirki'), |
|
| 796 | + 'description' => esc_html__('Description', 'kirki'), |
|
| 797 | 797 | 'section' => 'generic_section', |
| 798 | 798 | 'default' => '', |
| 799 | 799 | ] |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | new \Kirki\Field\Generic( |
| 803 | 803 | [ |
| 804 | 804 | 'settings' => 'kirki_demo_generic_custom', |
| 805 | - 'label' => esc_html__( 'Generic Control — Custom Input.', 'kirki' ), |
|
| 806 | - 'description' => esc_html__( 'The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki' ), |
|
| 805 | + 'label' => esc_html__('Generic Control — Custom Input.', 'kirki'), |
|
| 806 | + 'description' => esc_html__('The "generic" control allows you to add any input type you want. In this case we use type="password" and define custom styles.', 'kirki'), |
|
| 807 | 807 | 'section' => 'generic_section', |
| 808 | 808 | 'default' => '', |
| 809 | 809 | 'choices' => [ |
@@ -821,8 +821,8 @@ discard block |
||
| 821 | 821 | new \Kirki\Field\Image( |
| 822 | 822 | [ |
| 823 | 823 | 'settings' => 'kirki_demo_image_url', |
| 824 | - 'label' => esc_html__( 'Image Control (URL)', 'kirki' ), |
|
| 825 | - 'description' => esc_html__( 'The saved value will be the URL.', 'kirki' ), |
|
| 824 | + 'label' => esc_html__('Image Control (URL)', 'kirki'), |
|
| 825 | + 'description' => esc_html__('The saved value will be the URL.', 'kirki'), |
|
| 826 | 826 | 'section' => 'image_section', |
| 827 | 827 | 'default' => '', |
| 828 | 828 | ] |
@@ -831,8 +831,8 @@ discard block |
||
| 831 | 831 | new \Kirki\Field\Image( |
| 832 | 832 | [ |
| 833 | 833 | 'settings' => 'kirki_demo_image_id', |
| 834 | - 'label' => esc_html__( 'Image Control (ID)', 'kirki' ), |
|
| 835 | - 'description' => esc_html__( 'The saved value will an ID.', 'kirki' ), |
|
| 834 | + 'label' => esc_html__('Image Control (ID)', 'kirki'), |
|
| 835 | + 'description' => esc_html__('The saved value will an ID.', 'kirki'), |
|
| 836 | 836 | 'section' => 'image_section', |
| 837 | 837 | 'default' => '', |
| 838 | 838 | 'choices' => [ |
@@ -844,8 +844,8 @@ discard block |
||
| 844 | 844 | new \Kirki\Field\Image( |
| 845 | 845 | [ |
| 846 | 846 | 'settings' => 'kirki_demo_image_array', |
| 847 | - 'label' => esc_html__( 'Image Control (array)', 'kirki' ), |
|
| 848 | - 'description' => esc_html__( 'The saved value will an array.', 'kirki' ), |
|
| 847 | + 'label' => esc_html__('Image Control (array)', 'kirki'), |
|
| 848 | + 'description' => esc_html__('The saved value will an array.', 'kirki'), |
|
| 849 | 849 | 'section' => 'image_section', |
| 850 | 850 | 'default' => '', |
| 851 | 851 | 'choices' => [ |
@@ -860,8 +860,8 @@ discard block |
||
| 860 | 860 | new \Kirki\Field\Upload( |
| 861 | 861 | [ |
| 862 | 862 | 'settings' => 'kirki_demo_upload_url', |
| 863 | - 'label' => esc_html__( 'Upload Control (URL)', 'kirki' ), |
|
| 864 | - 'description' => esc_html__( 'The saved value will the URL.', 'kirki' ), |
|
| 863 | + 'label' => esc_html__('Upload Control (URL)', 'kirki'), |
|
| 864 | + 'description' => esc_html__('The saved value will the URL.', 'kirki'), |
|
| 865 | 865 | 'section' => 'upload_section', |
| 866 | 866 | 'default' => '', |
| 867 | 867 | 'transport' => 'postMessage', |
@@ -874,16 +874,16 @@ discard block |
||
| 874 | 874 | new \Kirki\Field\Multicheck( |
| 875 | 875 | [ |
| 876 | 876 | 'settings' => 'kirki_demo_multicheck', |
| 877 | - 'label' => esc_html__( 'Multickeck Control', 'kirki' ), |
|
| 877 | + 'label' => esc_html__('Multickeck Control', 'kirki'), |
|
| 878 | 878 | 'section' => 'multicheck_section', |
| 879 | - 'default' => [ 'option-1', 'option-3', 'option-4' ], |
|
| 879 | + 'default' => ['option-1', 'option-3', 'option-4'], |
|
| 880 | 880 | 'priority' => 10, |
| 881 | 881 | 'choices' => [ |
| 882 | - 'option-1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 883 | - 'option-2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 884 | - 'option-3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 885 | - 'option-4' => esc_html__( 'Option 4', 'kirki' ), |
|
| 886 | - 'option-5' => esc_html__( 'Option 5', 'kirki' ), |
|
| 882 | + 'option-1' => esc_html__('Option 1', 'kirki'), |
|
| 883 | + 'option-2' => esc_html__('Option 2', 'kirki'), |
|
| 884 | + 'option-3' => esc_html__('Option 3', 'kirki'), |
|
| 885 | + 'option-4' => esc_html__('Option 4', 'kirki'), |
|
| 886 | + 'option-5' => esc_html__('Option 5', 'kirki'), |
|
| 887 | 887 | ], |
| 888 | 888 | ] |
| 889 | 889 | ); |
@@ -894,29 +894,29 @@ discard block |
||
| 894 | 894 | new \Kirki\Field\Multicolor( |
| 895 | 895 | [ |
| 896 | 896 | 'settings' => 'kirki_demo_multicolor', |
| 897 | - 'label' => esc_html__( 'Multicolor Control', 'kirki' ), |
|
| 897 | + 'label' => esc_html__('Multicolor Control', 'kirki'), |
|
| 898 | 898 | 'section' => 'multicolor_section', |
| 899 | 899 | 'priority' => 10, |
| 900 | 900 | 'transport' => 'postMessage', |
| 901 | 901 | 'choices' => [ |
| 902 | - 'link' => esc_html__( 'Link Color', 'kirki' ), |
|
| 903 | - 'hover' => esc_html__( 'And this is hover color with long label so you know how it is displayed.', 'kirki' ), |
|
| 904 | - 'active' => esc_html__( 'Active Color', 'kirki' ), |
|
| 905 | - 'another1' => esc_html__( 'Another color 1', 'kirki' ), |
|
| 906 | - 'another2' => esc_html__( 'Another color 2', 'kirki' ), |
|
| 907 | - 'another3' => esc_html__( 'Another color 3', 'kirki' ), |
|
| 908 | - 'another4' => esc_html__( 'Another color 4', 'kirki' ), |
|
| 909 | - 'another5' => esc_html__( 'Another color 5', 'kirki' ), |
|
| 910 | - 'another6' => esc_html__( 'Another color 6', 'kirki' ), |
|
| 911 | - 'another7' => esc_html__( 'Another color 7', 'kirki' ), |
|
| 912 | - 'another8' => esc_html__( 'Another color 8', 'kirki' ), |
|
| 913 | - 'another9' => esc_html__( 'Another color 9', 'kirki' ), |
|
| 914 | - 'another10' => esc_html__( 'Another color 10', 'kirki' ), |
|
| 915 | - 'another11' => esc_html__( 'Another color 11', 'kirki' ), |
|
| 916 | - 'another12' => esc_html__( 'Another color 12', 'kirki' ), |
|
| 917 | - 'another13' => esc_html__( 'Another color 13', 'kirki' ), |
|
| 918 | - 'another14' => esc_html__( 'Another color 14', 'kirki' ), |
|
| 919 | - 'another15' => esc_html__( 'Another color 15', 'kirki' ), |
|
| 902 | + 'link' => esc_html__('Link Color', 'kirki'), |
|
| 903 | + 'hover' => esc_html__('And this is hover color with long label so you know how it is displayed.', 'kirki'), |
|
| 904 | + 'active' => esc_html__('Active Color', 'kirki'), |
|
| 905 | + 'another1' => esc_html__('Another color 1', 'kirki'), |
|
| 906 | + 'another2' => esc_html__('Another color 2', 'kirki'), |
|
| 907 | + 'another3' => esc_html__('Another color 3', 'kirki'), |
|
| 908 | + 'another4' => esc_html__('Another color 4', 'kirki'), |
|
| 909 | + 'another5' => esc_html__('Another color 5', 'kirki'), |
|
| 910 | + 'another6' => esc_html__('Another color 6', 'kirki'), |
|
| 911 | + 'another7' => esc_html__('Another color 7', 'kirki'), |
|
| 912 | + 'another8' => esc_html__('Another color 8', 'kirki'), |
|
| 913 | + 'another9' => esc_html__('Another color 9', 'kirki'), |
|
| 914 | + 'another10' => esc_html__('Another color 10', 'kirki'), |
|
| 915 | + 'another11' => esc_html__('Another color 11', 'kirki'), |
|
| 916 | + 'another12' => esc_html__('Another color 12', 'kirki'), |
|
| 917 | + 'another13' => esc_html__('Another color 13', 'kirki'), |
|
| 918 | + 'another14' => esc_html__('Another color 14', 'kirki'), |
|
| 919 | + 'another15' => esc_html__('Another color 15', 'kirki'), |
|
| 920 | 920 | ], |
| 921 | 921 | 'alpha' => true, |
| 922 | 922 | 'default' => [ |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | new \Kirki\Field\Number( |
| 934 | 934 | [ |
| 935 | 935 | 'settings' => 'kirki_demo_number', |
| 936 | - 'label' => esc_html__( 'Number Control', 'kirki' ), |
|
| 936 | + 'label' => esc_html__('Number Control', 'kirki'), |
|
| 937 | 937 | 'section' => 'number_section', |
| 938 | 938 | 'priority' => 10, |
| 939 | 939 | 'choices' => [ |
@@ -950,14 +950,14 @@ discard block |
||
| 950 | 950 | new \Kirki\Field\Palette( |
| 951 | 951 | array( |
| 952 | 952 | 'settings' => 'kirki_demo_palette', |
| 953 | - 'label' => esc_html__( 'Control Palette', 'kirki' ), |
|
| 953 | + 'label' => esc_html__('Control Palette', 'kirki'), |
|
| 954 | 954 | 'section' => 'palette_section', |
| 955 | 955 | 'default' => 'blue', |
| 956 | 956 | 'choices' => array( |
| 957 | - 'a200' => Kirki_Helper::get_material_design_colors( 'A200' ), |
|
| 958 | - 'blue' => Kirki_Helper::get_material_design_colors( 'blue' ), |
|
| 959 | - 'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ), |
|
| 960 | - 'bnw' => array( '#000000', '#ffffff' ), |
|
| 957 | + 'a200' => Kirki_Helper::get_material_design_colors('A200'), |
|
| 958 | + 'blue' => Kirki_Helper::get_material_design_colors('blue'), |
|
| 959 | + 'green' => array('#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853'), |
|
| 960 | + 'bnw' => array('#000000', '#ffffff'), |
|
| 961 | 961 | ), |
| 962 | 962 | ) |
| 963 | 963 | ); |
@@ -968,16 +968,16 @@ discard block |
||
| 968 | 968 | new \Kirki\Field\Radio( |
| 969 | 969 | [ |
| 970 | 970 | 'settings' => 'kirki_demo_radio', |
| 971 | - 'label' => esc_html__( 'Radio Control', 'kirki' ), |
|
| 972 | - 'description' => esc_html__( 'The description here.', 'kirki' ), |
|
| 971 | + 'label' => esc_html__('Radio Control', 'kirki'), |
|
| 972 | + 'description' => esc_html__('The description here.', 'kirki'), |
|
| 973 | 973 | 'section' => 'radio_section', |
| 974 | 974 | 'default' => 'option-3', |
| 975 | 975 | 'choices' => [ |
| 976 | - 'option-1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 977 | - 'option-2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 978 | - 'option-3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 979 | - 'option-4' => esc_html__( 'Option 4', 'kirki' ), |
|
| 980 | - 'option-5' => esc_html__( 'Option 5', 'kirki' ), |
|
| 976 | + 'option-1' => esc_html__('Option 1', 'kirki'), |
|
| 977 | + 'option-2' => esc_html__('Option 2', 'kirki'), |
|
| 978 | + 'option-3' => esc_html__('Option 3', 'kirki'), |
|
| 979 | + 'option-4' => esc_html__('Option 4', 'kirki'), |
|
| 980 | + 'option-5' => esc_html__('Option 5', 'kirki'), |
|
| 981 | 981 | ], |
| 982 | 982 | ] |
| 983 | 983 | ); |
@@ -988,14 +988,14 @@ discard block |
||
| 988 | 988 | new \Kirki\Field\Radio_Buttonset( |
| 989 | 989 | [ |
| 990 | 990 | 'settings' => 'kirki_demo_radio_buttonset', |
| 991 | - 'label' => esc_html__( 'Radio-Buttonset Control', 'kirki' ), |
|
| 992 | - 'description' => esc_html__( 'Sample of radio-buttonset control.', 'kirki' ), |
|
| 991 | + 'label' => esc_html__('Radio-Buttonset Control', 'kirki'), |
|
| 992 | + 'description' => esc_html__('Sample of radio-buttonset control.', 'kirki'), |
|
| 993 | 993 | 'section' => 'radio_buttonset_section', |
| 994 | 994 | 'default' => 'option-2', |
| 995 | 995 | 'choices' => [ |
| 996 | - 'option-1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 997 | - 'option-2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 998 | - 'option-3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 996 | + 'option-1' => esc_html__('Option 1', 'kirki'), |
|
| 997 | + 'option-2' => esc_html__('Option 2', 'kirki'), |
|
| 998 | + 'option-3' => esc_html__('Option 3', 'kirki'), |
|
| 999 | 999 | ], |
| 1000 | 1000 | ] |
| 1001 | 1001 | ); |
@@ -1006,8 +1006,8 @@ discard block |
||
| 1006 | 1006 | new \Kirki\Field\Radio_Image( |
| 1007 | 1007 | [ |
| 1008 | 1008 | 'settings' => 'kirki_demo_radio_image', |
| 1009 | - 'label' => esc_html__( 'Radio-Image Control', 'kirki' ), |
|
| 1010 | - 'description' => esc_html__( 'Sample of radio image control.', 'kirki' ), |
|
| 1009 | + 'label' => esc_html__('Radio-Image Control', 'kirki'), |
|
| 1010 | + 'description' => esc_html__('Sample of radio image control.', 'kirki'), |
|
| 1011 | 1011 | 'section' => 'radio_image_section', |
| 1012 | 1012 | 'default' => 'travel', |
| 1013 | 1013 | 'choices' => [ |
@@ -1024,18 +1024,18 @@ discard block |
||
| 1024 | 1024 | new \Kirki\Field\Repeater( |
| 1025 | 1025 | [ |
| 1026 | 1026 | 'settings' => 'kirki_demo_repeater', |
| 1027 | - 'label' => esc_html__( 'Repeater Control', 'kirki' ), |
|
| 1028 | - 'description' => esc_html__( 'Sample of repeater control.', 'kirki' ), |
|
| 1027 | + 'label' => esc_html__('Repeater Control', 'kirki'), |
|
| 1028 | + 'description' => esc_html__('Sample of repeater control.', 'kirki'), |
|
| 1029 | 1029 | 'section' => 'repeater_section', |
| 1030 | 1030 | 'default' => [ |
| 1031 | 1031 | [ |
| 1032 | - 'link_text' => esc_html__( 'Kirki Site', 'kirki' ), |
|
| 1032 | + 'link_text' => esc_html__('Kirki Site', 'kirki'), |
|
| 1033 | 1033 | 'link_url' => 'https://kirki.org/', |
| 1034 | 1034 | 'link_target' => '_self', |
| 1035 | 1035 | 'checkbox' => false, |
| 1036 | 1036 | ], |
| 1037 | 1037 | [ |
| 1038 | - 'link_text' => esc_html__( 'Kirki Repository', 'kirki' ), |
|
| 1038 | + 'link_text' => esc_html__('Kirki Repository', 'kirki'), |
|
| 1039 | 1039 | 'link_url' => 'https://github.com/aristath/kirki', |
| 1040 | 1040 | 'link_target' => '_self', |
| 1041 | 1041 | 'checkbox' => false, |
@@ -1044,29 +1044,29 @@ discard block |
||
| 1044 | 1044 | 'fields' => [ |
| 1045 | 1045 | 'link_text' => [ |
| 1046 | 1046 | 'type' => 'text', |
| 1047 | - 'label' => esc_html__( 'Link Text', 'kirki' ), |
|
| 1048 | - 'description' => esc_html__( 'This will be the label for your link', 'kirki' ), |
|
| 1047 | + 'label' => esc_html__('Link Text', 'kirki'), |
|
| 1048 | + 'description' => esc_html__('This will be the label for your link', 'kirki'), |
|
| 1049 | 1049 | 'default' => '', |
| 1050 | 1050 | ], |
| 1051 | 1051 | 'link_url' => [ |
| 1052 | 1052 | 'type' => 'text', |
| 1053 | - 'label' => esc_html__( 'Link URL', 'kirki' ), |
|
| 1054 | - 'description' => esc_html__( 'This will be the link URL', 'kirki' ), |
|
| 1053 | + 'label' => esc_html__('Link URL', 'kirki'), |
|
| 1054 | + 'description' => esc_html__('This will be the link URL', 'kirki'), |
|
| 1055 | 1055 | 'default' => '', |
| 1056 | 1056 | ], |
| 1057 | 1057 | 'link_target' => [ |
| 1058 | 1058 | 'type' => 'select', |
| 1059 | - 'label' => esc_html__( 'Link Target', 'kirki' ), |
|
| 1060 | - 'description' => esc_html__( 'This will be the link target', 'kirki' ), |
|
| 1059 | + 'label' => esc_html__('Link Target', 'kirki'), |
|
| 1060 | + 'description' => esc_html__('This will be the link target', 'kirki'), |
|
| 1061 | 1061 | 'default' => '_self', |
| 1062 | 1062 | 'choices' => [ |
| 1063 | - '_blank' => esc_html__( 'New Window', 'kirki' ), |
|
| 1064 | - '_self' => esc_html__( 'Same Frame', 'kirki' ), |
|
| 1063 | + '_blank' => esc_html__('New Window', 'kirki'), |
|
| 1064 | + '_self' => esc_html__('Same Frame', 'kirki'), |
|
| 1065 | 1065 | ], |
| 1066 | 1066 | ], |
| 1067 | 1067 | 'checkbox' => [ |
| 1068 | 1068 | 'type' => 'checkbox', |
| 1069 | - 'label' => esc_html__( 'Checkbox', 'kirki' ), |
|
| 1069 | + 'label' => esc_html__('Checkbox', 'kirki'), |
|
| 1070 | 1070 | 'default' => false, |
| 1071 | 1071 | ], |
| 1072 | 1072 | ], |
@@ -1079,17 +1079,17 @@ discard block |
||
| 1079 | 1079 | new \Kirki\Field\Select( |
| 1080 | 1080 | [ |
| 1081 | 1081 | 'settings' => 'kirki_demo_select', |
| 1082 | - 'label' => esc_html__( 'Select Control', 'kirki' ), |
|
| 1083 | - 'description' => esc_html__( 'Sample of single mode select control.', 'kirki' ), |
|
| 1082 | + 'label' => esc_html__('Select Control', 'kirki'), |
|
| 1083 | + 'description' => esc_html__('Sample of single mode select control.', 'kirki'), |
|
| 1084 | 1084 | 'section' => 'select_section', |
| 1085 | 1085 | 'default' => 'option-3', |
| 1086 | - 'placeholder' => esc_html__( 'Select an option', 'kirki' ), |
|
| 1086 | + 'placeholder' => esc_html__('Select an option', 'kirki'), |
|
| 1087 | 1087 | 'choices' => [ |
| 1088 | - 'option-1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 1089 | - 'option-2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 1090 | - 'option-3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 1091 | - 'option-4' => esc_html__( 'Option 4', 'kirki' ), |
|
| 1092 | - 'option-5' => esc_html__( 'Option 5', 'kirki' ), |
|
| 1088 | + 'option-1' => esc_html__('Option 1', 'kirki'), |
|
| 1089 | + 'option-2' => esc_html__('Option 2', 'kirki'), |
|
| 1090 | + 'option-3' => esc_html__('Option 3', 'kirki'), |
|
| 1091 | + 'option-4' => esc_html__('Option 4', 'kirki'), |
|
| 1092 | + 'option-5' => esc_html__('Option 5', 'kirki'), |
|
| 1093 | 1093 | ], |
| 1094 | 1094 | ] |
| 1095 | 1095 | ); |
@@ -1097,17 +1097,17 @@ discard block |
||
| 1097 | 1097 | new \Kirki\Field\Select( |
| 1098 | 1098 | [ |
| 1099 | 1099 | 'settings' => 'kirki_demo_select_multiple', |
| 1100 | - 'label' => esc_html__( 'Select Control', 'kirki' ), |
|
| 1101 | - 'description' => esc_html__( 'Sample of multiple mode select control.', 'kirki' ), |
|
| 1100 | + 'label' => esc_html__('Select Control', 'kirki'), |
|
| 1101 | + 'description' => esc_html__('Sample of multiple mode select control.', 'kirki'), |
|
| 1102 | 1102 | 'section' => 'select_section', |
| 1103 | 1103 | 'default' => 'option-3', |
| 1104 | 1104 | 'multiple' => 3, |
| 1105 | 1105 | 'choices' => [ |
| 1106 | - 'option-1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 1107 | - 'option-2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 1108 | - 'option-3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 1109 | - 'option-4' => esc_html__( 'Option 4', 'kirki' ), |
|
| 1110 | - 'option-5' => esc_html__( 'Option 5', 'kirki' ), |
|
| 1106 | + 'option-1' => esc_html__('Option 1', 'kirki'), |
|
| 1107 | + 'option-2' => esc_html__('Option 2', 'kirki'), |
|
| 1108 | + 'option-3' => esc_html__('Option 3', 'kirki'), |
|
| 1109 | + 'option-4' => esc_html__('Option 4', 'kirki'), |
|
| 1110 | + 'option-5' => esc_html__('Option 5', 'kirki'), |
|
| 1111 | 1111 | ], |
| 1112 | 1112 | ] |
| 1113 | 1113 | ); |
@@ -1118,12 +1118,12 @@ discard block |
||
| 1118 | 1118 | new \Kirki\Field\Slider( |
| 1119 | 1119 | [ |
| 1120 | 1120 | 'settings' => 'kirki_demo_slider', |
| 1121 | - 'label' => esc_html__( 'Slider Control', 'kirki' ), |
|
| 1122 | - 'description' => esc_html__( 'Sample of slider control.', 'kirki' ), |
|
| 1121 | + 'label' => esc_html__('Slider Control', 'kirki'), |
|
| 1122 | + 'description' => esc_html__('Sample of slider control.', 'kirki'), |
|
| 1123 | 1123 | 'section' => 'slider_section', |
| 1124 | 1124 | 'default' => '10', |
| 1125 | 1125 | 'transport' => 'postMessage', |
| 1126 | - 'tooltip' => esc_html__( 'This is the tooltip', 'kirki' ), |
|
| 1126 | + 'tooltip' => esc_html__('This is the tooltip', 'kirki'), |
|
| 1127 | 1127 | 'choices' => [ |
| 1128 | 1128 | 'min' => 0, |
| 1129 | 1129 | 'max' => 100, |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | [ |
| 1138 | 1138 | 'type' => 'slider', |
| 1139 | 1139 | 'settings' => 'kirki_demo_slider_old', |
| 1140 | - 'label' => esc_html__( 'Slider Control — Using Old Way', 'kirki' ), |
|
| 1140 | + 'label' => esc_html__('Slider Control — Using Old Way', 'kirki'), |
|
| 1141 | 1141 | 'description' => 'Added using `Kirki::add_field` (the old Kirki API)', |
| 1142 | 1142 | 'section' => 'slider_section', |
| 1143 | 1143 | 'transport' => 'postMessage', |
@@ -1155,16 +1155,16 @@ discard block |
||
| 1155 | 1155 | new \Kirki\Field\Sortable( |
| 1156 | 1156 | [ |
| 1157 | 1157 | 'settings' => 'kirki_demo_sortable', |
| 1158 | - 'label' => __( 'This is a sortable control.', 'kirki' ), |
|
| 1158 | + 'label' => __('This is a sortable control.', 'kirki'), |
|
| 1159 | 1159 | 'section' => 'sortable_section', |
| 1160 | - 'default' => [ 'option3', 'option1', 'option4' ], |
|
| 1160 | + 'default' => ['option3', 'option1', 'option4'], |
|
| 1161 | 1161 | 'choices' => [ |
| 1162 | - 'option1' => esc_html__( 'Option 1', 'kirki' ), |
|
| 1163 | - 'option2' => esc_html__( 'Option 2', 'kirki' ), |
|
| 1164 | - 'option3' => esc_html__( 'Option 3', 'kirki' ), |
|
| 1165 | - 'option4' => esc_html__( 'Option 4', 'kirki' ), |
|
| 1166 | - 'option5' => esc_html__( 'Option 5', 'kirki' ), |
|
| 1167 | - 'option6' => esc_html__( 'Option 6', 'kirki' ), |
|
| 1162 | + 'option1' => esc_html__('Option 1', 'kirki'), |
|
| 1163 | + 'option2' => esc_html__('Option 2', 'kirki'), |
|
| 1164 | + 'option3' => esc_html__('Option 3', 'kirki'), |
|
| 1165 | + 'option4' => esc_html__('Option 4', 'kirki'), |
|
| 1166 | + 'option5' => esc_html__('Option 5', 'kirki'), |
|
| 1167 | + 'option6' => esc_html__('Option 6', 'kirki'), |
|
| 1168 | 1168 | ], |
| 1169 | 1169 | ] |
| 1170 | 1170 | ); |
@@ -1175,8 +1175,8 @@ discard block |
||
| 1175 | 1175 | new \Kirki\Field\Checkbox_Switch( |
| 1176 | 1176 | [ |
| 1177 | 1177 | 'settings' => 'kirki_demo_switch', |
| 1178 | - 'label' => esc_html__( 'Switch Field', 'kirki' ), |
|
| 1179 | - 'description' => esc_html__( 'Simple switch control', 'kirki' ), |
|
| 1178 | + 'label' => esc_html__('Switch Field', 'kirki'), |
|
| 1179 | + 'description' => esc_html__('Simple switch control', 'kirki'), |
|
| 1180 | 1180 | 'section' => 'switch_section', |
| 1181 | 1181 | 'transport' => 'postMessage', |
| 1182 | 1182 | 'default' => true, |
@@ -1186,13 +1186,13 @@ discard block |
||
| 1186 | 1186 | new \Kirki\Field\Checkbox_Switch( |
| 1187 | 1187 | [ |
| 1188 | 1188 | 'settings' => 'kirki_demo_switch_custom_label', |
| 1189 | - 'label' => esc_html__( 'Switch Field — With custom labels', 'kirki' ), |
|
| 1190 | - 'description' => esc_html__( 'Switch control using custom labels', 'kirki' ), |
|
| 1189 | + 'label' => esc_html__('Switch Field — With custom labels', 'kirki'), |
|
| 1190 | + 'description' => esc_html__('Switch control using custom labels', 'kirki'), |
|
| 1191 | 1191 | 'section' => 'switch_section', |
| 1192 | 1192 | 'default' => true, |
| 1193 | 1193 | 'choices' => [ |
| 1194 | - 'on' => esc_html__( 'Enabled', 'kirki' ), |
|
| 1195 | - 'off' => esc_html__( 'Disabled', 'kirki' ), |
|
| 1194 | + 'on' => esc_html__('Enabled', 'kirki'), |
|
| 1195 | + 'off' => esc_html__('Disabled', 'kirki'), |
|
| 1196 | 1196 | ], |
| 1197 | 1197 | 'active_callback' => [ |
| 1198 | 1198 | [ |
@@ -1212,8 +1212,8 @@ discard block |
||
| 1212 | 1212 | [ |
| 1213 | 1213 | 'type' => 'toggle', |
| 1214 | 1214 | 'settings' => 'kirki_demo_toggle_setting', |
| 1215 | - 'label' => esc_html__( 'Toggle Field', 'kirki' ), |
|
| 1216 | - 'description' => esc_html__( 'Toggle is just utilizing switch control but aligned horizontally & without the text', 'kirki' ), |
|
| 1215 | + 'label' => esc_html__('Toggle Field', 'kirki'), |
|
| 1216 | + 'description' => esc_html__('Toggle is just utilizing switch control but aligned horizontally & without the text', 'kirki'), |
|
| 1217 | 1217 | 'section' => 'toggle_section', |
| 1218 | 1218 | 'default' => '1', |
| 1219 | 1219 | 'priority' => 10, |
@@ -1227,8 +1227,8 @@ discard block |
||
| 1227 | 1227 | new \Kirki\Field\Typography( |
| 1228 | 1228 | [ |
| 1229 | 1229 | 'settings' => 'kirki_demo_kirki_typography_setting', |
| 1230 | - 'label' => esc_html__( 'Typography Control', 'kirki' ), |
|
| 1231 | - 'description' => esc_html__( 'The full set of options.', 'kirki' ), |
|
| 1230 | + 'label' => esc_html__('Typography Control', 'kirki'), |
|
| 1231 | + 'description' => esc_html__('The full set of options.', 'kirki'), |
|
| 1232 | 1232 | 'section' => 'typography_section', |
| 1233 | 1233 | 'priority' => 10, |
| 1234 | 1234 | 'transport' => 'postMessage', |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | ], |
| 1254 | 1254 | 'choices' => [ |
| 1255 | 1255 | 'fonts' => [ |
| 1256 | - 'google' => [ 'popularity', 60 ], |
|
| 1256 | + 'google' => ['popularity', 60], |
|
| 1257 | 1257 | 'families' => [ |
| 1258 | 1258 | 'custom' => [ |
| 1259 | 1259 | 'text' => 'My Custom Fonts (demo only)', |
@@ -1270,8 +1270,8 @@ discard block |
||
| 1270 | 1270 | ], |
| 1271 | 1271 | ], |
| 1272 | 1272 | 'variants' => [ |
| 1273 | - 'helvetica-neue' => [ 'regular', '900' ], |
|
| 1274 | - 'linotype-authentic' => [ 'regular', '100', '300' ], |
|
| 1273 | + 'helvetica-neue' => ['regular', '900'], |
|
| 1274 | + 'linotype-authentic' => ['regular', '100', '300'], |
|
| 1275 | 1275 | ], |
| 1276 | 1276 | ], |
| 1277 | 1277 | ], |
@@ -1281,8 +1281,8 @@ discard block |
||
| 1281 | 1281 | new \Kirki\Field\Typography( |
| 1282 | 1282 | [ |
| 1283 | 1283 | 'settings' => 'kirki_demo_typography_setting_1', |
| 1284 | - 'label' => esc_html__( 'Typography Control', 'kirki' ), |
|
| 1285 | - 'description' => esc_html__( 'Just the font-family and font-weight.', 'kirki' ), |
|
| 1284 | + 'label' => esc_html__('Typography Control', 'kirki'), |
|
| 1285 | + 'description' => esc_html__('Just the font-family and font-weight.', 'kirki'), |
|
| 1286 | 1286 | 'section' => 'typography_section', |
| 1287 | 1287 | 'priority' => 10, |
| 1288 | 1288 | 'transport' => 'auto', |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | ], |
| 1292 | 1292 | 'output' => [ |
| 1293 | 1293 | [ |
| 1294 | - 'element' => [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ], |
|
| 1294 | + 'element' => ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], |
|
| 1295 | 1295 | ], |
| 1296 | 1296 | ], |
| 1297 | 1297 | ] |
@@ -1304,21 +1304,21 @@ discard block |
||
| 1304 | 1304 | */ |
| 1305 | 1305 | function kirki_sidebars_select_example() { |
| 1306 | 1306 | $sidebars = []; |
| 1307 | - if ( isset( $GLOBALS['wp_registered_sidebars'] ) ) { |
|
| 1307 | + if (isset($GLOBALS['wp_registered_sidebars'])) { |
|
| 1308 | 1308 | $sidebars = $GLOBALS['wp_registered_sidebars']; |
| 1309 | 1309 | } |
| 1310 | 1310 | $sidebars_choices = []; |
| 1311 | - foreach ( $sidebars as $sidebar ) { |
|
| 1312 | - $sidebars_choices[ $sidebar['id'] ] = $sidebar['name']; |
|
| 1311 | + foreach ($sidebars as $sidebar) { |
|
| 1312 | + $sidebars_choices[$sidebar['id']] = $sidebar['name']; |
|
| 1313 | 1313 | } |
| 1314 | - if ( ! class_exists( 'Kirki' ) ) { |
|
| 1314 | + if (!class_exists('Kirki')) { |
|
| 1315 | 1315 | return; |
| 1316 | 1316 | } |
| 1317 | 1317 | new \Kirki\Field\Select( |
| 1318 | 1318 | [ |
| 1319 | 1319 | 'settings' => 'kirki_demo_sidebars_select', |
| 1320 | - 'label' => esc_html__( 'Sidebars Select', 'kirki' ), |
|
| 1321 | - 'description' => esc_html__( 'An example of how to implement sidebars selection.', 'kirki' ), |
|
| 1320 | + 'label' => esc_html__('Sidebars Select', 'kirki'), |
|
| 1321 | + 'description' => esc_html__('An example of how to implement sidebars selection.', 'kirki'), |
|
| 1322 | 1322 | 'section' => 'select_section', |
| 1323 | 1323 | 'default' => 'primary', |
| 1324 | 1324 | 'choices' => $sidebars_choices, |
@@ -1326,4 +1326,4 @@ discard block |
||
| 1326 | 1326 | ] |
| 1327 | 1327 | ); |
| 1328 | 1328 | } |
| 1329 | -add_action( 'init', 'kirki_sidebars_select_example', 999 ); |
|
| 1329 | +add_action('init', 'kirki_sidebars_select_example', 999); |
|
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | // phpcs:ignoreFile |
| 15 | 15 | |
| 16 | 16 | // Exit if accessed directly. |
| 17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 17 | +if (!defined('ABSPATH')) { |
|
| 18 | 18 | exit; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @param bool $hash Whether we want to include a hash (#) at the beginning or not. |
| 31 | 31 | * @return string The sanitized hex color. |
| 32 | 32 | */ |
| 33 | - public static function sanitize_hex( $color = '#FFFFFF', $hash = true ) { |
|
| 34 | - if ( ! $hash ) { |
|
| 35 | - return ltrim( self::sanitize_color( $color, 'hex' ), '#' ); |
|
| 33 | + public static function sanitize_hex($color = '#FFFFFF', $hash = true) { |
|
| 34 | + if (!$hash) { |
|
| 35 | + return ltrim(self::sanitize_color($color, 'hex'), '#'); |
|
| 36 | 36 | } |
| 37 | - return self::sanitize_color( $color, 'hex' ); |
|
| 37 | + return self::sanitize_color($color, 'hex'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @param string $color The color. |
| 46 | 46 | * @return string |
| 47 | 47 | */ |
| 48 | - public static function sanitize_rgba( $color ) { |
|
| 49 | - return self::sanitize_color( $color, 'rgba' ); |
|
| 48 | + public static function sanitize_rgba($color) { |
|
| 49 | + return self::sanitize_color($color, 'rgba'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | * @param string $mode The mode to be used. |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public static function sanitize_color( $color = '', $mode = 'auto' ) { |
|
| 64 | - if ( is_string( $color ) && 'transparent' == trim( $color ) ) { |
|
| 63 | + public static function sanitize_color($color = '', $mode = 'auto') { |
|
| 64 | + if (is_string($color) && 'transparent' == trim($color)) { |
|
| 65 | 65 | return 'transparent'; |
| 66 | 66 | } |
| 67 | - $obj = ariColor::newColor( $color ); |
|
| 68 | - if ( 'auto' == $mode ) { |
|
| 67 | + $obj = ariColor::newColor($color); |
|
| 68 | + if ('auto' == $mode) { |
|
| 69 | 69 | $mode = $obj->mode; |
| 70 | 70 | } |
| 71 | - return $obj->toCSS( $mode ); |
|
| 71 | + return $obj->toCSS($mode); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | * @param boolean $implode Whether we want to implode the values or not. |
| 81 | 81 | * @return array|string |
| 82 | 82 | */ |
| 83 | - public static function get_rgb( $color, $implode = false ) { |
|
| 84 | - $obj = ariColor::newColor( $color ); |
|
| 85 | - if ( $implode ) { |
|
| 86 | - return $obj->toCSS( 'rgb' ); |
|
| 83 | + public static function get_rgb($color, $implode = false) { |
|
| 84 | + $obj = ariColor::newColor($color); |
|
| 85 | + if ($implode) { |
|
| 86 | + return $obj->toCSS('rgb'); |
|
| 87 | 87 | } |
| 88 | - return array( $obj->red, $obj->green, $obj->blue ); |
|
| 88 | + return array($obj->red, $obj->green, $obj->blue); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @param string|array $color The color to convert. |
| 97 | 97 | * @return string The hex value of the color. |
| 98 | 98 | */ |
| 99 | - public static function rgba2hex( $color ) { |
|
| 100 | - return self::sanitize_color( $color, 'hex' ); |
|
| 99 | + public static function rgba2hex($color) { |
|
| 100 | + return self::sanitize_color($color, 'hex'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | * @param string $color The rgba color formatted like rgba(r,g,b,a). |
| 109 | 109 | * @return int|float The alpha value of the color. |
| 110 | 110 | */ |
| 111 | - public static function get_alpha_from_rgba( $color ) { |
|
| 112 | - $obj = ariColor::newColor( $color ); |
|
| 111 | + public static function get_alpha_from_rgba($color) { |
|
| 112 | + $obj = ariColor::newColor($color); |
|
| 113 | 113 | return $obj->alpha; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -122,25 +122,25 @@ discard block |
||
| 122 | 122 | * @param int|float $alpha Opacity level (0-1). |
| 123 | 123 | * @return string |
| 124 | 124 | */ |
| 125 | - public static function get_rgba( $color = '#fff', $alpha = 1 ) { |
|
| 126 | - $obj = ariColor::newColor( $color ); |
|
| 127 | - if ( 1 == $alpha ) { |
|
| 128 | - return $obj->toCSS( 'rgba' ); |
|
| 125 | + public static function get_rgba($color = '#fff', $alpha = 1) { |
|
| 126 | + $obj = ariColor::newColor($color); |
|
| 127 | + if (1 == $alpha) { |
|
| 128 | + return $obj->toCSS('rgba'); |
|
| 129 | 129 | } |
| 130 | 130 | // Make sure that opacity is properly formatted. |
| 131 | 131 | // Converts 1-100 values to 0-1. |
| 132 | - if ( $alpha > 1 || $alpha < -1 ) { |
|
| 132 | + if ($alpha > 1 || $alpha < -1) { |
|
| 133 | 133 | // Divide by 100. |
| 134 | 134 | $alpha /= 100; |
| 135 | 135 | } |
| 136 | 136 | // Get absolute value. |
| 137 | - $alpha = abs( $alpha ); |
|
| 137 | + $alpha = abs($alpha); |
|
| 138 | 138 | // Max 1. |
| 139 | - if ( 1 < $alpha ) { |
|
| 139 | + if (1 < $alpha) { |
|
| 140 | 140 | $alpha = 1; |
| 141 | 141 | } |
| 142 | - $new_obj = $obj->getNew( 'alpha', $alpha ); |
|
| 143 | - return $new_obj->toCSS( 'rgba' ); |
|
| 142 | + $new_obj = $obj->getNew('alpha', $alpha); |
|
| 143 | + return $new_obj->toCSS('rgba'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | * @param string $color The RGBA color string. |
| 152 | 152 | * @return string The corresponding RGB string. |
| 153 | 153 | */ |
| 154 | - public static function rgba_to_rgb( $color ) { |
|
| 155 | - $obj = ariColor::newColor( $color ); |
|
| 156 | - return $obj->toCSS( 'rgb' ); |
|
| 154 | + public static function rgba_to_rgb($color) { |
|
| 155 | + $obj = ariColor::newColor($color); |
|
| 156 | + return $obj->toCSS('rgb'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | * @param string $hex The hex value of a color. |
| 165 | 165 | * @return int Value between 0 and 255. |
| 166 | 166 | */ |
| 167 | - public static function get_brightness( $hex ) { |
|
| 168 | - $hex = self::sanitize_hex( $hex, false ); |
|
| 167 | + public static function get_brightness($hex) { |
|
| 168 | + $hex = self::sanitize_hex($hex, false); |
|
| 169 | 169 | |
| 170 | 170 | // Returns brightness value from 0 to 255. |
| 171 | - return intval( ( ( hexdec( substr( $hex, 0, 2 ) ) * 299 ) + ( hexdec( substr( $hex, 2, 2 ) ) * 587 ) + ( hexdec( substr( $hex, 4, 2 ) ) * 114 ) ) / 1000 ); |
|
| 171 | + return intval(((hexdec(substr($hex, 0, 2)) * 299) + (hexdec(substr($hex, 2, 2)) * 587) + (hexdec(substr($hex, 4, 2)) * 114)) / 1000); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -180,19 +180,19 @@ discard block |
||
| 180 | 180 | * @param integer $steps Should be between -255 and 255. Negative = darker, positive = lighter. |
| 181 | 181 | * @return string Returns hex color. |
| 182 | 182 | */ |
| 183 | - public static function adjust_brightness( $hex, $steps ) { |
|
| 184 | - $hex = self::sanitize_hex( $hex, false ); |
|
| 185 | - $steps = max( -255, min( 255, $steps ) ); |
|
| 183 | + public static function adjust_brightness($hex, $steps) { |
|
| 184 | + $hex = self::sanitize_hex($hex, false); |
|
| 185 | + $steps = max( -255, min(255, $steps) ); |
|
| 186 | 186 | |
| 187 | 187 | // Adjust number of steps and keep it inside 0 to 255. |
| 188 | - $red = max( 0, min( 255, hexdec( substr( $hex, 0, 2 ) ) + $steps ) ); |
|
| 189 | - $green = max( 0, min( 255, hexdec( substr( $hex, 2, 2 ) ) + $steps ) ); |
|
| 190 | - $blue = max( 0, min( 255, hexdec( substr( $hex, 4, 2 ) ) + $steps ) ); |
|
| 188 | + $red = max(0, min(255, hexdec(substr($hex, 0, 2)) + $steps)); |
|
| 189 | + $green = max(0, min(255, hexdec(substr($hex, 2, 2)) + $steps)); |
|
| 190 | + $blue = max(0, min(255, hexdec(substr($hex, 4, 2)) + $steps)); |
|
| 191 | 191 | |
| 192 | - $red_hex = str_pad( dechex( $red ), 2, '0', STR_PAD_LEFT ); |
|
| 193 | - $green_hex = str_pad( dechex( $green ), 2, '0', STR_PAD_LEFT ); |
|
| 194 | - $blue_hex = str_pad( dechex( $blue ), 2, '0', STR_PAD_LEFT ); |
|
| 195 | - return self::sanitize_hex( $red_hex . $green_hex . $blue_hex ); |
|
| 192 | + $red_hex = str_pad(dechex($red), 2, '0', STR_PAD_LEFT); |
|
| 193 | + $green_hex = str_pad(dechex($green), 2, '0', STR_PAD_LEFT); |
|
| 194 | + $blue_hex = str_pad(dechex($blue), 2, '0', STR_PAD_LEFT); |
|
| 195 | + return self::sanitize_hex($red_hex . $green_hex . $blue_hex); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | * @param int $percentage A value between 0 and 100. |
| 208 | 208 | * @return string Returns hex color. |
| 209 | 209 | */ |
| 210 | - public static function mix_colors( $hex1, $hex2, $percentage ) { |
|
| 211 | - $hex1 = self::sanitize_hex( $hex1, false ); |
|
| 212 | - $hex2 = self::sanitize_hex( $hex2, false ); |
|
| 213 | - $red = ( $percentage * hexdec( substr( $hex1, 0, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 0, 2 ) ) ) / 100; |
|
| 214 | - $green = ( $percentage * hexdec( substr( $hex1, 2, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 2, 2 ) ) ) / 100; |
|
| 215 | - $blue = ( $percentage * hexdec( substr( $hex1, 4, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 4, 2 ) ) ) / 100; |
|
| 216 | - $red_hex = str_pad( dechex( $red ), 2, '0', STR_PAD_LEFT ); |
|
| 217 | - $green_hex = str_pad( dechex( $green ), 2, '0', STR_PAD_LEFT ); |
|
| 218 | - $blue_hex = str_pad( dechex( $blue ), 2, '0', STR_PAD_LEFT ); |
|
| 219 | - return self::sanitize_hex( $red_hex . $green_hex . $blue_hex ); |
|
| 210 | + public static function mix_colors($hex1, $hex2, $percentage) { |
|
| 211 | + $hex1 = self::sanitize_hex($hex1, false); |
|
| 212 | + $hex2 = self::sanitize_hex($hex2, false); |
|
| 213 | + $red = ($percentage * hexdec(substr($hex1, 0, 2)) + (100 - $percentage) * hexdec(substr($hex2, 0, 2))) / 100; |
|
| 214 | + $green = ($percentage * hexdec(substr($hex1, 2, 2)) + (100 - $percentage) * hexdec(substr($hex2, 2, 2))) / 100; |
|
| 215 | + $blue = ($percentage * hexdec(substr($hex1, 4, 2)) + (100 - $percentage) * hexdec(substr($hex2, 4, 2))) / 100; |
|
| 216 | + $red_hex = str_pad(dechex($red), 2, '0', STR_PAD_LEFT); |
|
| 217 | + $green_hex = str_pad(dechex($green), 2, '0', STR_PAD_LEFT); |
|
| 218 | + $blue_hex = str_pad(dechex($blue), 2, '0', STR_PAD_LEFT); |
|
| 219 | + return self::sanitize_hex($red_hex . $green_hex . $blue_hex); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | * @param string $hex The hex value of color 1. |
| 228 | 228 | * @return array Returns array( 'h', 's', 'v' ). |
| 229 | 229 | */ |
| 230 | - public static function hex_to_hsv( $hex ) { |
|
| 231 | - $rgb = (array) (array) self::get_rgb( self::sanitize_hex( $hex, false ) ); |
|
| 232 | - return self::rgb_to_hsv( $rgb ); |
|
| 230 | + public static function hex_to_hsv($hex) { |
|
| 231 | + $rgb = (array) (array) self::get_rgb(self::sanitize_hex($hex, false)); |
|
| 232 | + return self::rgb_to_hsv($rgb); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -240,39 +240,39 @@ discard block |
||
| 240 | 240 | * @param string $color The rgb color to convert array( 'r', 'g', 'b' ). |
| 241 | 241 | * @return array Returns array( 'h', 's', 'v' ). |
| 242 | 242 | */ |
| 243 | - public static function rgb_to_hsv( $color = array() ) { |
|
| 244 | - $var_r = ( $color[0] / 255 ); |
|
| 245 | - $var_g = ( $color[1] / 255 ); |
|
| 246 | - $var_b = ( $color[2] / 255 ); |
|
| 247 | - $var_min = min( $var_r, $var_g, $var_b ); |
|
| 248 | - $var_max = max( $var_r, $var_g, $var_b ); |
|
| 243 | + public static function rgb_to_hsv($color = array()) { |
|
| 244 | + $var_r = ($color[0] / 255); |
|
| 245 | + $var_g = ($color[1] / 255); |
|
| 246 | + $var_b = ($color[2] / 255); |
|
| 247 | + $var_min = min($var_r, $var_g, $var_b); |
|
| 248 | + $var_max = max($var_r, $var_g, $var_b); |
|
| 249 | 249 | $del_max = $var_max - $var_min; |
| 250 | 250 | $h = 0; |
| 251 | 251 | $s = 0; |
| 252 | 252 | $v = $var_max; |
| 253 | - if ( 0 != $del_max ) { |
|
| 253 | + if (0 != $del_max) { |
|
| 254 | 254 | $s = $del_max / $var_max; |
| 255 | - $del_r = ( ( ( $var_max - $var_r ) / 6 ) + ( $del_max / 2 ) ) / $del_max; |
|
| 256 | - $del_g = ( ( ( $var_max - $var_g ) / 6 ) + ( $del_max / 2 ) ) / $del_max; |
|
| 257 | - $del_b = ( ( ( $var_max - $var_b ) / 6 ) + ( $del_max / 2 ) ) / $del_max; |
|
| 258 | - if ( $var_r == $var_max ) { |
|
| 255 | + $del_r = ((($var_max - $var_r) / 6) + ($del_max / 2)) / $del_max; |
|
| 256 | + $del_g = ((($var_max - $var_g) / 6) + ($del_max / 2)) / $del_max; |
|
| 257 | + $del_b = ((($var_max - $var_b) / 6) + ($del_max / 2)) / $del_max; |
|
| 258 | + if ($var_r == $var_max) { |
|
| 259 | 259 | $h = $del_b - $del_g; |
| 260 | - } elseif ( $var_g == $var_max ) { |
|
| 261 | - $h = ( 1 / 3 ) + $del_r - $del_b; |
|
| 262 | - } elseif ( $var_b == $var_max ) { |
|
| 263 | - $h = ( 2 / 3 ) + $del_g - $del_r; |
|
| 260 | + } elseif ($var_g == $var_max) { |
|
| 261 | + $h = (1 / 3) + $del_r - $del_b; |
|
| 262 | + } elseif ($var_b == $var_max) { |
|
| 263 | + $h = (2 / 3) + $del_g - $del_r; |
|
| 264 | 264 | } |
| 265 | - if ( $h < 0 ) { |
|
| 265 | + if ($h < 0) { |
|
| 266 | 266 | $h++; |
| 267 | 267 | } |
| 268 | - if ( $h > 1 ) { |
|
| 268 | + if ($h > 1) { |
|
| 269 | 269 | $h--; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | return array( |
| 273 | - 'h' => round( $h, 2 ), |
|
| 274 | - 's' => round( $s, 2 ), |
|
| 275 | - 'v' => round( $v, 2 ), |
|
| 273 | + 'h' => round($h, 2), |
|
| 274 | + 's' => round($s, 2), |
|
| 275 | + 'v' => round($v, 2), |
|
| 276 | 276 | ); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | * @param string $color_2 The 2nd color. |
| 287 | 287 | * @return string |
| 288 | 288 | */ |
| 289 | - public static function color_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) { |
|
| 290 | - $color_1 = self::sanitize_hex( $color_1, false ); |
|
| 291 | - $color_2 = self::sanitize_hex( $color_2, false ); |
|
| 292 | - $color_1_rgb = self::get_rgb( $color_1 ); |
|
| 293 | - $color_2_rgb = self::get_rgb( $color_2 ); |
|
| 294 | - $r_diff = max( $color_1_rgb[0], $color_2_rgb[0] ) - min( $color_1_rgb[0], $color_2_rgb[0] ); |
|
| 295 | - $g_diff = max( $color_1_rgb[1], $color_2_rgb[1] ) - min( $color_1_rgb[1], $color_2_rgb[1] ); |
|
| 296 | - $b_diff = max( $color_1_rgb[2], $color_2_rgb[2] ) - min( $color_1_rgb[2], $color_2_rgb[2] ); |
|
| 289 | + public static function color_difference($color_1 = '#ffffff', $color_2 = '#000000') { |
|
| 290 | + $color_1 = self::sanitize_hex($color_1, false); |
|
| 291 | + $color_2 = self::sanitize_hex($color_2, false); |
|
| 292 | + $color_1_rgb = self::get_rgb($color_1); |
|
| 293 | + $color_2_rgb = self::get_rgb($color_2); |
|
| 294 | + $r_diff = max($color_1_rgb[0], $color_2_rgb[0]) - min($color_1_rgb[0], $color_2_rgb[0]); |
|
| 295 | + $g_diff = max($color_1_rgb[1], $color_2_rgb[1]) - min($color_1_rgb[1], $color_2_rgb[1]); |
|
| 296 | + $b_diff = max($color_1_rgb[2], $color_2_rgb[2]) - min($color_1_rgb[2], $color_2_rgb[2]); |
|
| 297 | 297 | $color_diff = $r_diff + $g_diff + $b_diff; |
| 298 | 298 | return $color_diff; |
| 299 | 299 | } |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | * @param string $color_2 The 2nd color. |
| 310 | 310 | * @return string |
| 311 | 311 | */ |
| 312 | - public static function brightness_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) { |
|
| 313 | - $color_1 = self::sanitize_hex( $color_1, false ); |
|
| 314 | - $color_2 = self::sanitize_hex( $color_2, false ); |
|
| 315 | - $color_1_rgb = self::get_rgb( $color_1 ); |
|
| 316 | - $color_2_rgb = self::get_rgb( $color_2 ); |
|
| 317 | - $br_1 = ( 299 * $color_1_rgb[0] + 587 * $color_1_rgb[1] + 114 * $color_1_rgb[2] ) / 1000; |
|
| 318 | - $br_2 = ( 299 * $color_2_rgb[0] + 587 * $color_2_rgb[1] + 114 * $color_2_rgb[2] ) / 1000; |
|
| 319 | - return intval( abs( $br_1 - $br_2 ) ); |
|
| 312 | + public static function brightness_difference($color_1 = '#ffffff', $color_2 = '#000000') { |
|
| 313 | + $color_1 = self::sanitize_hex($color_1, false); |
|
| 314 | + $color_2 = self::sanitize_hex($color_2, false); |
|
| 315 | + $color_1_rgb = self::get_rgb($color_1); |
|
| 316 | + $color_2_rgb = self::get_rgb($color_2); |
|
| 317 | + $br_1 = (299 * $color_1_rgb[0] + 587 * $color_1_rgb[1] + 114 * $color_1_rgb[2]) / 1000; |
|
| 318 | + $br_2 = (299 * $color_2_rgb[0] + 587 * $color_2_rgb[1] + 114 * $color_2_rgb[2]) / 1000; |
|
| 319 | + return intval(abs($br_1 - $br_2)); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | * @param string $color_2 The 2nd color. |
| 330 | 330 | * @return string |
| 331 | 331 | */ |
| 332 | - public static function lumosity_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) { |
|
| 333 | - $color_1 = self::sanitize_hex( $color_1, false ); |
|
| 334 | - $color_2 = self::sanitize_hex( $color_2, false ); |
|
| 335 | - $color_1_rgb = self::get_rgb( $color_1 ); |
|
| 336 | - $color_2_rgb = self::get_rgb( $color_2 ); |
|
| 337 | - $l1 = 0.2126 * pow( $color_1_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_1_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_1_rgb[2] / 255, 2.2 ); |
|
| 338 | - $l2 = 0.2126 * pow( $color_2_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_2_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_2_rgb[2] / 255, 2.2 ); |
|
| 339 | - $lum_diff = ( $l1 > $l2 ) ? ( $l1 + 0.05 ) / ( $l2 + 0.05 ) : ( $l2 + 0.05 ) / ( $l1 + 0.05 ); |
|
| 340 | - return round( $lum_diff, 2 ); |
|
| 332 | + public static function lumosity_difference($color_1 = '#ffffff', $color_2 = '#000000') { |
|
| 333 | + $color_1 = self::sanitize_hex($color_1, false); |
|
| 334 | + $color_2 = self::sanitize_hex($color_2, false); |
|
| 335 | + $color_1_rgb = self::get_rgb($color_1); |
|
| 336 | + $color_2_rgb = self::get_rgb($color_2); |
|
| 337 | + $l1 = 0.2126 * pow($color_1_rgb[0] / 255, 2.2) + 0.7152 * pow($color_1_rgb[1] / 255, 2.2) + 0.0722 * pow($color_1_rgb[2] / 255, 2.2); |
|
| 338 | + $l2 = 0.2126 * pow($color_2_rgb[0] / 255, 2.2) + 0.7152 * pow($color_2_rgb[1] / 255, 2.2) + 0.0722 * pow($color_2_rgb[2] / 255, 2.2); |
|
| 339 | + $lum_diff = ($l1 > $l2) ? ($l1 + 0.05) / ($l2 + 0.05) : ($l2 + 0.05) / ($l1 + 0.05); |
|
| 340 | + return round($lum_diff, 2); |
|
| 341 | 341 | } |
| 342 | 342 | } |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | // phpcs:ignoreFile |
| 3 | 3 | |
| 4 | 4 | // Exit if accessed directly. |
| 5 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 5 | +if (!defined('ABSPATH')) { |
|
| 6 | 6 | exit; |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if ( ! class_exists( 'ariColor' ) ) { |
|
| 9 | +if (!class_exists('ariColor')) { |
|
| 10 | 10 | /** |
| 11 | 11 | * The color calculations class. |
| 12 | 12 | */ |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @since 1.0.0 |
| 85 | 85 | * @var int |
| 86 | 86 | */ |
| 87 | - public $red = 0; |
|
| 87 | + public $red = 0; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Green value. |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @since 1.0.0 |
| 103 | 103 | * @var int |
| 104 | 104 | */ |
| 105 | - public $blue = 0; |
|
| 105 | + public $blue = 0; |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Alpha value (min:0, max: 1) |
@@ -175,21 +175,21 @@ discard block |
||
| 175 | 175 | * @param string|array $color The color. |
| 176 | 176 | * @param string $mode The color mode. Leave empty to auto-detect. |
| 177 | 177 | */ |
| 178 | - protected function __construct( $color = '', $mode = 'auto' ) { |
|
| 178 | + protected function __construct($color = '', $mode = 'auto') { |
|
| 179 | 179 | $this->color = $color; |
| 180 | 180 | |
| 181 | - if ( is_array( $color ) && isset( $color['fallback'] ) ) { |
|
| 181 | + if (is_array($color) && isset($color['fallback'])) { |
|
| 182 | 182 | $this->fallback = $color['fallback']; |
| 183 | - $this->fallback_obj = self::newColor( $this->fallback ); |
|
| 183 | + $this->fallback_obj = self::newColor($this->fallback); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if ( ! method_exists( $this, 'from_' . $mode ) ) { |
|
| 187 | - $mode = $this->get_mode( $color ); |
|
| 186 | + if (!method_exists($this, 'from_' . $mode)) { |
|
| 187 | + $mode = $this->get_mode($color); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $this->mode = $mode; |
| 191 | 191 | |
| 192 | - if ( ! $mode ) { |
|
| 192 | + if (!$mode) { |
|
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -212,15 +212,15 @@ discard block |
||
| 212 | 212 | * @param string $mode Mode to be used. |
| 213 | 213 | * @return ariColor (object) |
| 214 | 214 | */ |
| 215 | - public static function newColor( $color, $mode = 'auto' ) { |
|
| 215 | + public static function newColor($color, $mode = 'auto') { |
|
| 216 | 216 | |
| 217 | 217 | // Get an md5 for this color. |
| 218 | - $color_md5 = ( is_array( $color ) ) ? md5( wp_json_encode( $color ) . $mode ) : md5( $color . $mode ); |
|
| 218 | + $color_md5 = (is_array($color)) ? md5(wp_json_encode($color) . $mode) : md5($color . $mode); |
|
| 219 | 219 | // Set the instance if it does not already exist. |
| 220 | - if ( ! isset( self::$instances[ $color_md5 ] ) ) { |
|
| 221 | - self::$instances[ $color_md5 ] = new self( $color, $mode ); |
|
| 220 | + if (!isset(self::$instances[$color_md5])) { |
|
| 221 | + self::$instances[$color_md5] = new self($color, $mode); |
|
| 222 | 222 | } |
| 223 | - return self::$instances[ $color_md5 ]; |
|
| 223 | + return self::$instances[$color_md5]; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * @param string $mode Mode to be used. |
| 234 | 234 | * @return ariColor (object) |
| 235 | 235 | */ |
| 236 | - public static function new_color( $color, $mode = 'auto' ) { |
|
| 237 | - return self::newColor( $color, $mode ); |
|
| 236 | + public static function new_color($color, $mode = 'auto') { |
|
| 237 | + return self::newColor($color, $mode); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -254,46 +254,46 @@ discard block |
||
| 254 | 254 | * @param int|float|string $value The new value. |
| 255 | 255 | * @return ariColor|null |
| 256 | 256 | */ |
| 257 | - public function getNew( $property = '', $value = '' ) { |
|
| 257 | + public function getNew($property = '', $value = '') { |
|
| 258 | 258 | |
| 259 | - if ( in_array( $property, array( 'red', 'green', 'blue', 'alpha' ), true ) ) { |
|
| 259 | + if (in_array($property, array('red', 'green', 'blue', 'alpha'), true)) { |
|
| 260 | 260 | // Check if we're changing any of the rgba values. |
| 261 | - $value = max( 0, min( 255, $value ) ); |
|
| 262 | - if ( 'red' === $property ) { |
|
| 263 | - return self::new_color( 'rgba(' . $value . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba' ); |
|
| 264 | - } elseif ( 'green' === $property ) { |
|
| 265 | - return self::new_color( 'rgba(' . $this->red . ',' . $value . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba' ); |
|
| 266 | - } elseif ( 'blue' === $property ) { |
|
| 267 | - return self::new_color( 'rgba(' . $this->red . ',' . $this->green . ',' . $value . ',' . $this->alpha . ')', 'rgba' ); |
|
| 268 | - } elseif ( 'alpha' === $property ) { |
|
| 269 | - return self::new_color( 'rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $value . ')', 'rgba' ); |
|
| 261 | + $value = max(0, min(255, $value)); |
|
| 262 | + if ('red' === $property) { |
|
| 263 | + return self::new_color('rgba(' . $value . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba'); |
|
| 264 | + } elseif ('green' === $property) { |
|
| 265 | + return self::new_color('rgba(' . $this->red . ',' . $value . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba'); |
|
| 266 | + } elseif ('blue' === $property) { |
|
| 267 | + return self::new_color('rgba(' . $this->red . ',' . $this->green . ',' . $value . ',' . $this->alpha . ')', 'rgba'); |
|
| 268 | + } elseif ('alpha' === $property) { |
|
| 269 | + return self::new_color('rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $value . ')', 'rgba'); |
|
| 270 | 270 | } |
| 271 | - } elseif ( in_array( $property, array( 'hue', 'saturation', 'lightness' ), true ) ) { |
|
| 271 | + } elseif (in_array($property, array('hue', 'saturation', 'lightness'), true)) { |
|
| 272 | 272 | // Check if we're changing any of the hsl values. |
| 273 | - $value = ( 'hue' === $property ) ? max( 0, min( 360, $value ) ) : max( 0, min( 100, $value ) ); |
|
| 274 | - |
|
| 275 | - if ( 'hue' === $property ) { |
|
| 276 | - return self::new_color( 'hsla(' . $value . ',' . $this->saturation . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' ); |
|
| 277 | - } elseif ( 'saturation' === $property ) { |
|
| 278 | - return self::new_color( 'hsla(' . $this->hue . ',' . $value . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' ); |
|
| 279 | - } elseif ( 'lightness' === $property ) { |
|
| 280 | - return self::new_color( 'hsla(' . $this->hue . ',' . $this->saturation . '%,' . $value . '%,' . $this->alpha . ')', 'hsla' ); |
|
| 273 | + $value = ('hue' === $property) ? max(0, min(360, $value)) : max(0, min(100, $value)); |
|
| 274 | + |
|
| 275 | + if ('hue' === $property) { |
|
| 276 | + return self::new_color('hsla(' . $value . ',' . $this->saturation . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla'); |
|
| 277 | + } elseif ('saturation' === $property) { |
|
| 278 | + return self::new_color('hsla(' . $this->hue . ',' . $value . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla'); |
|
| 279 | + } elseif ('lightness' === $property) { |
|
| 280 | + return self::new_color('hsla(' . $this->hue . ',' . $this->saturation . '%,' . $value . '%,' . $this->alpha . ')', 'hsla'); |
|
| 281 | 281 | } |
| 282 | - } elseif ( 'brightness' === $property ) { |
|
| 282 | + } elseif ('brightness' === $property) { |
|
| 283 | 283 | // Check if we're changing the brightness. |
| 284 | - if ( $value < $this->brightness['total'] ) { |
|
| 285 | - $red = max( 0, min( 255, $this->red - ( $this->brightness['total'] - $value ) ) ); |
|
| 286 | - $green = max( 0, min( 255, $this->green - ( $this->brightness['total'] - $value ) ) ); |
|
| 287 | - $blue = max( 0, min( 255, $this->blue - ( $this->brightness['total'] - $value ) ) ); |
|
| 288 | - } elseif ( $value > $this->brightness['total'] ) { |
|
| 289 | - $red = max( 0, min( 255, $this->red + ( $value - $this->brightness['total'] ) ) ); |
|
| 290 | - $green = max( 0, min( 255, $this->green + ( $value - $this->brightness['total'] ) ) ); |
|
| 291 | - $blue = max( 0, min( 255, $this->blue + ( $value - $this->brightness['total'] ) ) ); |
|
| 284 | + if ($value < $this->brightness['total']) { |
|
| 285 | + $red = max(0, min(255, $this->red - ($this->brightness['total'] - $value))); |
|
| 286 | + $green = max(0, min(255, $this->green - ($this->brightness['total'] - $value))); |
|
| 287 | + $blue = max(0, min(255, $this->blue - ($this->brightness['total'] - $value))); |
|
| 288 | + } elseif ($value > $this->brightness['total']) { |
|
| 289 | + $red = max(0, min(255, $this->red + ($value - $this->brightness['total']))); |
|
| 290 | + $green = max(0, min(255, $this->green + ($value - $this->brightness['total']))); |
|
| 291 | + $blue = max(0, min(255, $this->blue + ($value - $this->brightness['total']))); |
|
| 292 | 292 | } else { |
| 293 | 293 | // If it's not smaller and it's not greater, then it's equal. |
| 294 | 294 | return $this; |
| 295 | 295 | } |
| 296 | - return self::new_color( 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $this->alpha . ')', 'rgba' ); |
|
| 296 | + return self::new_color('rgba(' . $red . ',' . $green . ',' . $blue . ',' . $this->alpha . ')', 'rgba'); |
|
| 297 | 297 | } |
| 298 | 298 | return null; |
| 299 | 299 | } |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | * @param int|float|string $value The new value. |
| 316 | 316 | * @return ariColor|null |
| 317 | 317 | */ |
| 318 | - public function get_new( $property = '', $value = '' ) { |
|
| 319 | - return $this->getNew( $property, $value ); |
|
| 318 | + public function get_new($property = '', $value = '') { |
|
| 319 | + return $this->getNew($property, $value); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -327,29 +327,29 @@ discard block |
||
| 327 | 327 | * @param string|array $color The color we're querying. |
| 328 | 328 | * @return string |
| 329 | 329 | */ |
| 330 | - public function get_mode( $color ) { |
|
| 330 | + public function get_mode($color) { |
|
| 331 | 331 | |
| 332 | 332 | // Check if value is an array. |
| 333 | - if ( is_array( $color ) ) { |
|
| 333 | + if (is_array($color)) { |
|
| 334 | 334 | // Does the array have an 'rgba' key? |
| 335 | - if ( isset( $color['rgba'] ) ) { |
|
| 335 | + if (isset($color['rgba'])) { |
|
| 336 | 336 | $this->color = $color['rgba']; |
| 337 | 337 | return 'rgba'; |
| 338 | - } elseif ( isset( $color['color'] ) ) { |
|
| 338 | + } elseif (isset($color['color'])) { |
|
| 339 | 339 | // Does the array have a 'color' key? |
| 340 | 340 | $this->color = $color['color']; |
| 341 | - if ( is_string( $color['color'] ) && false !== strpos( $color['color'], 'rgba' ) ) { |
|
| 341 | + if (is_string($color['color']) && false !== strpos($color['color'], 'rgba')) { |
|
| 342 | 342 | return 'rgba'; |
| 343 | 343 | } |
| 344 | 344 | return 'hex'; |
| 345 | 345 | } |
| 346 | 346 | // Is this a simple array with 4 items? |
| 347 | - if ( 4 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) && isset( $color[3] ) ) { |
|
| 348 | - $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',' . intval( $color[3] ) . ')'; |
|
| 347 | + if (4 === count($color) && isset($color[0]) && isset($color[1]) && isset($color[2]) && isset($color[3])) { |
|
| 348 | + $this->color = 'rgba(' . intval($color[0]) . ',' . intval($color[1]) . ',' . intval($color[2]) . ',' . intval($color[3]) . ')'; |
|
| 349 | 349 | return 'rgba'; |
| 350 | - } elseif ( 3 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) ) { |
|
| 350 | + } elseif (3 === count($color) && isset($color[0]) && isset($color[1]) && isset($color[2])) { |
|
| 351 | 351 | // Is this a simple array with 3 items? |
| 352 | - $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',1)'; |
|
| 352 | + $this->color = 'rgba(' . intval($color[0]) . ',' . intval($color[1]) . ',' . intval($color[2]) . ',1)'; |
|
| 353 | 353 | return 'rgba'; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -366,15 +366,15 @@ discard block |
||
| 366 | 366 | 'opacity' => 'alpha', |
| 367 | 367 | ); |
| 368 | 368 | $found = false; |
| 369 | - foreach ( $finders_keepers as $finder => $keeper ) { |
|
| 370 | - if ( isset( $color[ $finder ] ) ) { |
|
| 369 | + foreach ($finders_keepers as $finder => $keeper) { |
|
| 370 | + if (isset($color[$finder])) { |
|
| 371 | 371 | $found = true; |
| 372 | - $this->$keeper = $color[ $finder ]; |
|
| 372 | + $this->$keeper = $color[$finder]; |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | // We failed, use fallback. |
| 377 | - if ( ! $found ) { |
|
| 377 | + if (!$found) { |
|
| 378 | 378 | $this->from_fallback(); |
| 379 | 379 | return $this->mode; |
| 380 | 380 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // If a string and 3 or 6 characters long, add # since it's a hex. |
| 388 | - if ( 3 === strlen( $this->color ) || 6 === strlen( $this->color ) && false === strpos( $this->color, '#' ) ) { |
|
| 388 | + if (3 === strlen($this->color) || 6 === strlen($this->color) && false === strpos($this->color, '#')) { |
|
| 389 | 389 | $this->color = '#' . $this->color; |
| 390 | 390 | $color = $this->color; |
| 391 | 391 | } |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | 'hsla' => 'hsla', |
| 400 | 400 | 'hsl' => 'hsl', |
| 401 | 401 | ); |
| 402 | - foreach ( $finders_keepers as $finder => $keeper ) { |
|
| 403 | - if ( false !== strrpos( $color, $finder ) ) { |
|
| 402 | + foreach ($finders_keepers as $finder => $keeper) { |
|
| 403 | + if (false !== strrpos($color, $finder)) { |
|
| 404 | 404 | |
| 405 | 405 | // Make sure hex colors have 6 digits and not more. |
| 406 | - if ( '#' === $finder && 7 < strlen( $color ) ) { |
|
| 407 | - $this->color = substr( $color, 0, 7 ); |
|
| 406 | + if ('#' === $finder && 7 < strlen($color)) { |
|
| 407 | + $this->color = substr($color, 0, 7); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | return $keeper; |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | } |
| 413 | 413 | // Perhaps we're using a word like "orange"? |
| 414 | 414 | $wordcolors = $this->get_word_colors(); |
| 415 | - if ( is_string( $color ) && array_key_exists( $color, $wordcolors ) ) { |
|
| 416 | - $this->color = '#' . $wordcolors[ $color ]; |
|
| 415 | + if (is_string($color) && array_key_exists($color, $wordcolors)) { |
|
| 416 | + $this->color = '#' . $wordcolors[$color]; |
|
| 417 | 417 | return 'hex'; |
| 418 | 418 | } |
| 419 | 419 | // Fallback to hex. |
@@ -431,33 +431,33 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | protected function from_hex() { |
| 433 | 433 | |
| 434 | - if ( ! function_exists( 'sanitize_hex_color' ) ) { |
|
| 435 | - require_once wp_normalize_path( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); |
|
| 434 | + if (!function_exists('sanitize_hex_color')) { |
|
| 435 | + require_once wp_normalize_path(ABSPATH . WPINC . '/class-wp-customize-manager.php'); |
|
| 436 | 436 | } |
| 437 | 437 | // Is this perhaps a word-color? |
| 438 | 438 | $word_colors = $this->get_word_colors(); |
| 439 | - if ( array_key_exists( $this->color, $word_colors ) ) { |
|
| 440 | - $this->color = '#' . $word_colors[ $this->color ]; |
|
| 439 | + if (array_key_exists($this->color, $word_colors)) { |
|
| 440 | + $this->color = '#' . $word_colors[$this->color]; |
|
| 441 | 441 | } |
| 442 | 442 | // Sanitize color. |
| 443 | - $this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->color ) ); |
|
| 444 | - $hex = ltrim( $this->hex, '#' ); |
|
| 443 | + $this->hex = sanitize_hex_color(maybe_hash_hex_color($this->color)); |
|
| 444 | + $hex = ltrim($this->hex, '#'); |
|
| 445 | 445 | |
| 446 | 446 | // Fallback if needed. |
| 447 | - if ( ! $hex || 3 > strlen( $hex ) ) { |
|
| 447 | + if (!$hex || 3 > strlen($hex)) { |
|
| 448 | 448 | $this->from_fallback(); |
| 449 | 449 | return; |
| 450 | 450 | } |
| 451 | 451 | // Make sure we have 6 digits for the below calculations. |
| 452 | - if ( 3 === strlen( $hex ) ) { |
|
| 453 | - $hex = ltrim( $this->hex, '#' ); |
|
| 454 | - $hex = substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ); |
|
| 452 | + if (3 === strlen($hex)) { |
|
| 453 | + $hex = ltrim($this->hex, '#'); |
|
| 454 | + $hex = substr($hex, 0, 1) . substr($hex, 0, 1) . substr($hex, 1, 1) . substr($hex, 1, 1) . substr($hex, 2, 1) . substr($hex, 2, 1); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | // Set red, green, blue. |
| 458 | - $this->red = hexdec( substr( $hex, 0, 2 ) ); |
|
| 459 | - $this->green = hexdec( substr( $hex, 2, 2 ) ); |
|
| 460 | - $this->blue = hexdec( substr( $hex, 4, 2 ) ); |
|
| 458 | + $this->red = hexdec(substr($hex, 0, 2)); |
|
| 459 | + $this->green = hexdec(substr($hex, 2, 2)); |
|
| 460 | + $this->blue = hexdec(substr($hex, 4, 2)); |
|
| 461 | 461 | $this->alpha = 1; |
| 462 | 462 | // Set other color properties. |
| 463 | 463 | $this->set_brightness(); |
@@ -474,14 +474,14 @@ discard block |
||
| 474 | 474 | * @return null |
| 475 | 475 | */ |
| 476 | 476 | protected function from_rgb() { |
| 477 | - $value = explode( ',', str_replace( array( ' ', 'rgb', '(', ')' ), '', $this->color ) ); |
|
| 477 | + $value = explode(',', str_replace(array(' ', 'rgb', '(', ')'), '', $this->color)); |
|
| 478 | 478 | // Set red, green, blue. |
| 479 | - $this->red = ( isset( $value[0] ) ) ? intval( $value[0] ) : 255; |
|
| 480 | - $this->green = ( isset( $value[1] ) ) ? intval( $value[1] ) : 255; |
|
| 481 | - $this->blue = ( isset( $value[2] ) ) ? intval( $value[2] ) : 255; |
|
| 479 | + $this->red = (isset($value[0])) ? intval($value[0]) : 255; |
|
| 480 | + $this->green = (isset($value[1])) ? intval($value[1]) : 255; |
|
| 481 | + $this->blue = (isset($value[2])) ? intval($value[2]) : 255; |
|
| 482 | 482 | $this->alpha = 1; |
| 483 | 483 | // Set the hex. |
| 484 | - $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue ); |
|
| 484 | + $this->hex = $this->rgb_to_hex($this->red, $this->green, $this->blue); |
|
| 485 | 485 | // Set other color properties. |
| 486 | 486 | $this->set_brightness(); |
| 487 | 487 | $this->set_hsl(); |
@@ -497,19 +497,19 @@ discard block |
||
| 497 | 497 | */ |
| 498 | 498 | protected function from_rgba() { |
| 499 | 499 | // Set r, g, b, a properties. |
| 500 | - $value = explode( ',', str_replace( array( ' ', 'rgba', '(', ')' ), '', $this->color ) ); |
|
| 501 | - $this->red = ( isset( $value[0] ) ) ? intval( $value[0] ) : 255; |
|
| 502 | - $this->green = ( isset( $value[1] ) ) ? intval( $value[1] ) : 255; |
|
| 503 | - $this->blue = ( isset( $value[2] ) ) ? intval( $value[2] ) : 255; |
|
| 504 | - $this->alpha = ( isset( $value[3] ) ) ? filter_var( $value[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : 1; |
|
| 500 | + $value = explode(',', str_replace(array(' ', 'rgba', '(', ')'), '', $this->color)); |
|
| 501 | + $this->red = (isset($value[0])) ? intval($value[0]) : 255; |
|
| 502 | + $this->green = (isset($value[1])) ? intval($value[1]) : 255; |
|
| 503 | + $this->blue = (isset($value[2])) ? intval($value[2]) : 255; |
|
| 504 | + $this->alpha = (isset($value[3])) ? filter_var($value[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) : 1; |
|
| 505 | 505 | // Limit values in the range of 0 - 255. |
| 506 | - $this->red = max( 0, min( 255, $this->red ) ); |
|
| 507 | - $this->green = max( 0, min( 255, $this->green ) ); |
|
| 508 | - $this->blue = max( 0, min( 255, $this->blue ) ); |
|
| 506 | + $this->red = max(0, min(255, $this->red)); |
|
| 507 | + $this->green = max(0, min(255, $this->green)); |
|
| 508 | + $this->blue = max(0, min(255, $this->blue)); |
|
| 509 | 509 | // Limit values 0 - 1. |
| 510 | - $this->alpha = max( 0, min( 1, $this->alpha ) ); |
|
| 510 | + $this->alpha = max(0, min(1, $this->alpha)); |
|
| 511 | 511 | // Set hex. |
| 512 | - $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue ); |
|
| 512 | + $this->hex = $this->rgb_to_hex($this->red, $this->green, $this->blue); |
|
| 513 | 513 | // Set other color properties. |
| 514 | 514 | $this->set_brightness(); |
| 515 | 515 | $this->set_hsl(); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | * @return null |
| 525 | 525 | */ |
| 526 | 526 | protected function from_hsl() { |
| 527 | - $value = explode( ',', str_replace( array( ' ', 'hsl', '(', ')', '%' ), '', $this->color ) ); |
|
| 527 | + $value = explode(',', str_replace(array(' ', 'hsl', '(', ')', '%'), '', $this->color)); |
|
| 528 | 528 | $this->hue = $value[0]; |
| 529 | 529 | $this->saturation = $value[1]; |
| 530 | 530 | $this->lightness = $value[2]; |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | * @return null |
| 540 | 540 | */ |
| 541 | 541 | protected function from_hsla() { |
| 542 | - $value = explode( ',', str_replace( array( ' ', 'hsla', '(', ')', '%' ), '', $this->color ) ); |
|
| 542 | + $value = explode(',', str_replace(array(' ', 'hsla', '(', ')', '%'), '', $this->color)); |
|
| 543 | 543 | $this->hue = $value[0]; |
| 544 | 544 | $this->saturation = $value[1]; |
| 545 | 545 | $this->lightness = $value[2]; |
@@ -557,11 +557,11 @@ discard block |
||
| 557 | 557 | * @param int|string $blue The blue value of this color. |
| 558 | 558 | * @return string |
| 559 | 559 | */ |
| 560 | - protected function rgb_to_hex( $red, $green, $blue ) { |
|
| 560 | + protected function rgb_to_hex($red, $green, $blue) { |
|
| 561 | 561 | // Get hex values properly formatted. |
| 562 | - $hex_red = $this->dexhex_double_digit( $red ); |
|
| 563 | - $hex_green = $this->dexhex_double_digit( $green ); |
|
| 564 | - $hex_blue = $this->dexhex_double_digit( $blue ); |
|
| 562 | + $hex_red = $this->dexhex_double_digit($red); |
|
| 563 | + $hex_green = $this->dexhex_double_digit($green); |
|
| 564 | + $hex_blue = $this->dexhex_double_digit($blue); |
|
| 565 | 565 | return '#' . $hex_red . $hex_green . $hex_blue; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -573,9 +573,9 @@ discard block |
||
| 573 | 573 | * @param int|string $value The value to convert. |
| 574 | 574 | * @return string |
| 575 | 575 | */ |
| 576 | - protected function dexhex_double_digit( $value ) { |
|
| 577 | - $value = dechex( $value ); |
|
| 578 | - if ( 1 === strlen( $value ) ) { |
|
| 576 | + protected function dexhex_double_digit($value) { |
|
| 577 | + $value = dechex($value); |
|
| 578 | + if (1 === strlen($value)) { |
|
| 579 | 579 | $value = '0' . $value; |
| 580 | 580 | } |
| 581 | 581 | return $value; |
@@ -596,17 +596,17 @@ discard block |
||
| 596 | 596 | $r = $l; |
| 597 | 597 | $g = $l; |
| 598 | 598 | $b = $l; |
| 599 | - $v = ( $l <= 0.5 ) ? ( $l * ( 1.0 + $s ) ) : ( $l + $s - $l * $s ); |
|
| 600 | - if ( $v > 0 ) { |
|
| 599 | + $v = ($l <= 0.5) ? ($l * (1.0 + $s)) : ($l + $s - $l * $s); |
|
| 600 | + if ($v > 0) { |
|
| 601 | 601 | $m = $l + $l - $v; |
| 602 | - $sv = ( $v - $m ) / $v; |
|
| 602 | + $sv = ($v - $m) / $v; |
|
| 603 | 603 | $h *= 6.0; |
| 604 | - $sextant = floor( $h ); |
|
| 604 | + $sextant = floor($h); |
|
| 605 | 605 | $fract = $h - $sextant; |
| 606 | 606 | $vsf = $v * $sv * $fract; |
| 607 | 607 | $mid1 = $m + $vsf; |
| 608 | 608 | $mid2 = $v - $vsf; |
| 609 | - switch ( $sextant ) { |
|
| 609 | + switch ($sextant) { |
|
| 610 | 610 | case 0: |
| 611 | 611 | $r = $v; |
| 612 | 612 | $g = $mid1; |
@@ -639,11 +639,11 @@ discard block |
||
| 639 | 639 | break; |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | - $this->red = round( $r * 255, 0 ); |
|
| 643 | - $this->green = round( $g * 255, 0 ); |
|
| 644 | - $this->blue = round( $b * 255, 0 ); |
|
| 642 | + $this->red = round($r * 255, 0); |
|
| 643 | + $this->green = round($g * 255, 0); |
|
| 644 | + $this->blue = round($b * 255, 0); |
|
| 645 | 645 | |
| 646 | - $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue ); |
|
| 646 | + $this->hex = $this->rgb_to_hex($this->red, $this->green, $this->blue); |
|
| 647 | 647 | $this->set_luminance(); |
| 648 | 648 | } |
| 649 | 649 | |
@@ -655,13 +655,13 @@ discard block |
||
| 655 | 655 | * @param string $mode The mode we're using. |
| 656 | 656 | * @return string |
| 657 | 657 | */ |
| 658 | - public function toCSS( $mode = 'hex' ) { |
|
| 658 | + public function toCSS($mode = 'hex') { |
|
| 659 | 659 | |
| 660 | 660 | $value = ''; |
| 661 | 661 | |
| 662 | - switch ( $mode ) { |
|
| 662 | + switch ($mode) { |
|
| 663 | 663 | case 'hex': |
| 664 | - $value = strtolower( $this->hex ); |
|
| 664 | + $value = strtolower($this->hex); |
|
| 665 | 665 | break; |
| 666 | 666 | case 'rgba': |
| 667 | 667 | $value = 'rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')'; |
@@ -670,10 +670,10 @@ discard block |
||
| 670 | 670 | $value = 'rgb(' . $this->red . ',' . $this->green . ',' . $this->blue . ')'; |
| 671 | 671 | break; |
| 672 | 672 | case 'hsl': |
| 673 | - $value = 'hsl(' . $this->hue . ',' . round( $this->saturation ) . '%,' . round( $this->lightness ) . '%)'; |
|
| 673 | + $value = 'hsl(' . $this->hue . ',' . round($this->saturation) . '%,' . round($this->lightness) . '%)'; |
|
| 674 | 674 | break; |
| 675 | 675 | case 'hsla': |
| 676 | - $value = 'hsla(' . $this->hue . ',' . round( $this->saturation ) . '%,' . round( $this->lightness ) . '%,' . $this->alpha . ')'; |
|
| 676 | + $value = 'hsla(' . $this->hue . ',' . round($this->saturation) . '%,' . round($this->lightness) . '%,' . $this->alpha . ')'; |
|
| 677 | 677 | break; |
| 678 | 678 | } |
| 679 | 679 | return $value; |
@@ -687,8 +687,8 @@ discard block |
||
| 687 | 687 | * @param string $mode The mode we're using. |
| 688 | 688 | * @return string |
| 689 | 689 | */ |
| 690 | - public function to_css( $mode = 'hex' ) { |
|
| 691 | - return $this->toCSS( $mode ); |
|
| 690 | + public function to_css($mode = 'hex') { |
|
| 691 | + return $this->toCSS($mode); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -702,35 +702,35 @@ discard block |
||
| 702 | 702 | $green = $this->green / 255; |
| 703 | 703 | $blue = $this->blue / 255; |
| 704 | 704 | |
| 705 | - $max = max( $red, $green, $blue ); |
|
| 706 | - $min = min( $red, $green, $blue ); |
|
| 705 | + $max = max($red, $green, $blue); |
|
| 706 | + $min = min($red, $green, $blue); |
|
| 707 | 707 | |
| 708 | - $lightness = ( $max + $min ) / 2; |
|
| 708 | + $lightness = ($max + $min) / 2; |
|
| 709 | 709 | $difference = $max - $min; |
| 710 | 710 | |
| 711 | - if ( ! $difference ) { |
|
| 711 | + if (!$difference) { |
|
| 712 | 712 | $hue = $saturation = 0; // Achromatic. |
| 713 | 713 | } else { |
| 714 | - $saturation = $difference / ( 1 - abs( 2 * $lightness - 1 ) ); |
|
| 715 | - switch ( $max ) { |
|
| 714 | + $saturation = $difference / (1 - abs(2 * $lightness - 1)); |
|
| 715 | + switch ($max) { |
|
| 716 | 716 | case $red: |
| 717 | - $hue = 60 * fmod( ( ( $green - $blue ) / $difference ), 6 ); |
|
| 718 | - if ( $blue > $green ) { |
|
| 717 | + $hue = 60 * fmod((($green - $blue) / $difference), 6); |
|
| 718 | + if ($blue > $green) { |
|
| 719 | 719 | $hue += 360; |
| 720 | 720 | } |
| 721 | 721 | break; |
| 722 | 722 | case $green: |
| 723 | - $hue = 60 * ( ( $blue - $red ) / $difference + 2 ); |
|
| 723 | + $hue = 60 * (($blue - $red) / $difference + 2); |
|
| 724 | 724 | break; |
| 725 | 725 | case $blue: |
| 726 | - $hue = 60 * ( ( $red - $green ) / $difference + 4 ); |
|
| 726 | + $hue = 60 * (($red - $green) / $difference + 4); |
|
| 727 | 727 | break; |
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $this->hue = round( $hue ); |
|
| 732 | - $this->saturation = round( $saturation * 100 ); |
|
| 733 | - $this->lightness = round( $lightness * 100 ); |
|
| 731 | + $this->hue = round($hue); |
|
| 732 | + $this->saturation = round($saturation * 100); |
|
| 733 | + $this->lightness = round($lightness * 100); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | /** |
@@ -741,10 +741,10 @@ discard block |
||
| 741 | 741 | */ |
| 742 | 742 | protected function set_brightness() { |
| 743 | 743 | $this->brightness = array( |
| 744 | - 'red' => round( $this->red * .299 ), |
|
| 745 | - 'green' => round( $this->green * .587 ), |
|
| 746 | - 'blue' => round( $this->blue * .114 ), |
|
| 747 | - 'total' => intval( ( $this->red * .299 ) + ( $this->green * .587 ) + ( $this->blue * .114 ) ), |
|
| 744 | + 'red' => round($this->red * .299), |
|
| 745 | + 'green' => round($this->green * .587), |
|
| 746 | + 'blue' => round($this->blue * .114), |
|
| 747 | + 'total' => intval(($this->red * .299) + ($this->green * .587) + ($this->blue * .114)), |
|
| 748 | 748 | ); |
| 749 | 749 | } |
| 750 | 750 | |
@@ -755,8 +755,8 @@ discard block |
||
| 755 | 755 | * @since 1.0.0 |
| 756 | 756 | */ |
| 757 | 757 | protected function set_luminance() { |
| 758 | - $lum = ( 0.2126 * $this->red ) + ( 0.7152 * $this->green ) + ( 0.0722 * $this->blue ); |
|
| 759 | - $this->luminance = round( $lum ); |
|
| 758 | + $lum = (0.2126 * $this->red) + (0.7152 * $this->green) + (0.0722 * $this->blue); |
|
| 759 | + $this->luminance = round($lum); |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | /** |
@@ -928,8 +928,8 @@ discard block |
||
| 928 | 928 | protected function from_fallback() { |
| 929 | 929 | $this->color = $this->fallback; |
| 930 | 930 | |
| 931 | - if ( ! $this->fallback_obj ) { |
|
| 932 | - $this->fallback_obj = self::newColor( $this->fallback ); |
|
| 931 | + if (!$this->fallback_obj) { |
|
| 932 | + $this->fallback_obj = self::newColor($this->fallback); |
|
| 933 | 933 | } |
| 934 | 934 | $this->color = $this->fallback_obj->color; |
| 935 | 935 | $this->mode = $this->fallback_obj->mode; |
@@ -953,9 +953,9 @@ discard block |
||
| 953 | 953 | * @param mixed $arguments The method arguments. |
| 954 | 954 | * @return mixed |
| 955 | 955 | */ |
| 956 | - public function __call( $name, $arguments ) { |
|
| 957 | - if ( method_exists( $this, $name ) ) { |
|
| 958 | - call_user_func( array( $this, $name ), $arguments ); |
|
| 956 | + public function __call($name, $arguments) { |
|
| 957 | + if (method_exists($this, $name)) { |
|
| 958 | + call_user_func(array($this, $name), $arguments); |
|
| 959 | 959 | } else { |
| 960 | 960 | return $arguments; |
| 961 | 961 | } |
@@ -971,9 +971,9 @@ discard block |
||
| 971 | 971 | * @param mixed $arguments The method arguments. |
| 972 | 972 | * @return mixed |
| 973 | 973 | */ |
| 974 | - public static function __callStatic( $name, $arguments ) { |
|
| 975 | - if ( method_exists( __CLASS__, $name ) ) { |
|
| 976 | - call_user_func( array( __CLASS__, $name ), $arguments ); |
|
| 974 | + public static function __callStatic($name, $arguments) { |
|
| 975 | + if (method_exists(__CLASS__, $name)) { |
|
| 976 | + call_user_func(array(__CLASS__, $name), $arguments); |
|
| 977 | 977 | } else { |
| 978 | 978 | return $arguments; |
| 979 | 979 | } |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @param array $output The `output` item. |
| 26 | 26 | * @param array $value The field's value. |
| 27 | 27 | */ |
| 28 | - protected function process_output( $output, $value ) { |
|
| 29 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
| 28 | + protected function process_output($output, $value) { |
|
| 29 | + if (!isset($output['element']) || !isset($output['property'])) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | $output = wp_parse_args( |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | 'suffix' => '', |
| 39 | 39 | ] |
| 40 | 40 | ); |
| 41 | - if ( is_array( $value ) ) { |
|
| 42 | - if ( isset( $output['choice'] ) && $output['choice'] ) { |
|
| 43 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
| 41 | + if (is_array($value)) { |
|
| 42 | + if (isset($output['choice']) && $output['choice']) { |
|
| 43 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value($output['property'], $value[$output['choice']]) . $output['units'] . $output['suffix']; |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | - if ( isset( $value['url'] ) ) { |
|
| 47 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
| 46 | + if (isset($value['url'])) { |
|
| 47 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value($output['property'], $value['url']) . $output['units'] . $output['suffix']; |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 52 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value($output['property'], $value) . $output['units'] . $output['suffix']; |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @param array $args The field arguments. |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - protected function init( $args ) { |
|
| 56 | - add_filter( 'kirki_output_item_args', [ $this, 'output_item_args' ], 10, 4 ); |
|
| 57 | - add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); |
|
| 55 | + protected function init($args) { |
|
| 56 | + add_filter('kirki_output_item_args', [$this, 'output_item_args'], 10, 4); |
|
| 57 | + add_filter('kirki_output_control_classnames', [$this, 'output_control_classnames']); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -66,25 +66,25 @@ discard block |
||
| 66 | 66 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
| 67 | 67 | * @return array |
| 68 | 68 | */ |
| 69 | - public function filter_setting_args( $args, $wp_customize ) { |
|
| 70 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
| 71 | - $args = parent::filter_setting_args( $args, $wp_customize ); |
|
| 69 | + public function filter_setting_args($args, $wp_customize) { |
|
| 70 | + if ($args['settings'] === $this->args['settings']) { |
|
| 71 | + $args = parent::filter_setting_args($args, $wp_customize); |
|
| 72 | 72 | |
| 73 | 73 | // Set the sanitize-callback if none is defined. |
| 74 | - if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
|
| 75 | - $args['sanitize_callback'] = function( $value ) { |
|
| 76 | - if ( isset( $this->args['choices']['save_as'] ) && 'array' === $this->args['choices']['save_as'] ) { |
|
| 74 | + if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) { |
|
| 75 | + $args['sanitize_callback'] = function($value) { |
|
| 76 | + if (isset($this->args['choices']['save_as']) && 'array' === $this->args['choices']['save_as']) { |
|
| 77 | 77 | return [ |
| 78 | - 'id' => ( isset( $value['id'] ) && '' !== $value['id'] ) ? (int) $value['id'] : '', |
|
| 79 | - 'url' => ( isset( $value['url'] ) && '' !== $value['url'] ) ? esc_url_raw( $value['url'] ) : '', |
|
| 80 | - 'width' => ( isset( $value['width'] ) && '' !== $value['width'] ) ? (int) $value['width'] : '', |
|
| 81 | - 'height' => ( isset( $value['height'] ) && '' !== $value['height'] ) ? (int) $value['height'] : '', |
|
| 78 | + 'id' => (isset($value['id']) && '' !== $value['id']) ? (int) $value['id'] : '', |
|
| 79 | + 'url' => (isset($value['url']) && '' !== $value['url']) ? esc_url_raw($value['url']) : '', |
|
| 80 | + 'width' => (isset($value['width']) && '' !== $value['width']) ? (int) $value['width'] : '', |
|
| 81 | + 'height' => (isset($value['height']) && '' !== $value['height']) ? (int) $value['height'] : '', |
|
| 82 | 82 | ]; |
| 83 | 83 | } |
| 84 | - if ( isset( $this->args['choices']['save_as'] ) && 'id' === $this->args['choices']['save_as'] ) { |
|
| 85 | - return absint( $value ); |
|
| 84 | + if (isset($this->args['choices']['save_as']) && 'id' === $this->args['choices']['save_as']) { |
|
| 85 | + return absint($value); |
|
| 86 | 86 | } |
| 87 | - return ( is_string( $value ) ) ? esc_url_raw( $value ) : $value; |
|
| 87 | + return (is_string($value)) ? esc_url_raw($value) : $value; |
|
| 88 | 88 | }; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -100,28 +100,28 @@ discard block |
||
| 100 | 100 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
| 101 | 101 | * @return array |
| 102 | 102 | */ |
| 103 | - public function filter_control_args( $args, $wp_customize ) { |
|
| 104 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
| 105 | - $args = parent::filter_control_args( $args, $wp_customize ); |
|
| 103 | + public function filter_control_args($args, $wp_customize) { |
|
| 104 | + if ($args['settings'] === $this->args['settings']) { |
|
| 105 | + $args = parent::filter_control_args($args, $wp_customize); |
|
| 106 | 106 | |
| 107 | - $args['button_labels'] = isset( $args['button_labels'] ) ? $args['button_labels'] : []; |
|
| 107 | + $args['button_labels'] = isset($args['button_labels']) ? $args['button_labels'] : []; |
|
| 108 | 108 | $args['button_labels'] = wp_parse_args( |
| 109 | 109 | $args['button_labels'], |
| 110 | 110 | [ |
| 111 | - 'select' => esc_html__( 'Select image', 'kirki' ), |
|
| 112 | - 'change' => esc_html__( 'Change image', 'kirki' ), |
|
| 113 | - 'default' => esc_html__( 'Default', 'kirki' ), |
|
| 114 | - 'remove' => esc_html__( 'Remove', 'kirki' ), |
|
| 115 | - 'placeholder' => esc_html__( 'No image selected', 'kirki' ), |
|
| 116 | - 'frame_title' => esc_html__( 'Select image', 'kirki' ), |
|
| 117 | - 'frame_button' => esc_html__( 'Choose image', 'kirki' ), |
|
| 111 | + 'select' => esc_html__('Select image', 'kirki'), |
|
| 112 | + 'change' => esc_html__('Change image', 'kirki'), |
|
| 113 | + 'default' => esc_html__('Default', 'kirki'), |
|
| 114 | + 'remove' => esc_html__('Remove', 'kirki'), |
|
| 115 | + 'placeholder' => esc_html__('No image selected', 'kirki'), |
|
| 116 | + 'frame_title' => esc_html__('Select image', 'kirki'), |
|
| 117 | + 'frame_button' => esc_html__('Choose image', 'kirki'), |
|
| 118 | 118 | ] |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $args['choices'] = isset( $args['choices'] ) ? (array) $args['choices'] : []; |
|
| 122 | - $args['choices']['save_as'] = isset( $args['choices']['save_as'] ) ? $args['choices']['save_as'] : 'url'; |
|
| 123 | - $args['choices']['labels'] = isset( $args['choices']['labels'] ) ? $args['choices']['labels'] : []; |
|
| 124 | - $args['choices']['labels'] = wp_parse_args( $args['choices']['labels'], $args['button_labels'] ); |
|
| 121 | + $args['choices'] = isset($args['choices']) ? (array) $args['choices'] : []; |
|
| 122 | + $args['choices']['save_as'] = isset($args['choices']['save_as']) ? $args['choices']['save_as'] : 'url'; |
|
| 123 | + $args['choices']['labels'] = isset($args['choices']['labels']) ? $args['choices']['labels'] : []; |
|
| 124 | + $args['choices']['labels'] = wp_parse_args($args['choices']['labels'], $args['button_labels']); |
|
| 125 | 125 | |
| 126 | 126 | // Set the control-type. |
| 127 | 127 | $args['type'] = 'kirki-image'; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | * @param array $field The field arguments. |
| 141 | 141 | * @return array |
| 142 | 142 | */ |
| 143 | - public function output_item_args( $output, $value, $all_outputs, $field ) { |
|
| 144 | - if ( $field['settings'] === $this->args['settings'] ) { |
|
| 145 | - if ( isset( $output['property'] ) && in_array( [ 'background', 'background-image' ], $output['property'], true ) ) { |
|
| 146 | - if ( ! isset( $output['value_pattern'] ) || empty( $output['value_pattern'] ) || '$' === $output['value_pattern'] ) { |
|
| 143 | + public function output_item_args($output, $value, $all_outputs, $field) { |
|
| 144 | + if ($field['settings'] === $this->args['settings']) { |
|
| 145 | + if (isset($output['property']) && in_array(['background', 'background-image'], $output['property'], true)) { |
|
| 146 | + if (!isset($output['value_pattern']) || empty($output['value_pattern']) || '$' === $output['value_pattern']) { |
|
| 147 | 147 | $output['value_pattern'] = 'url("$")'; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param array $classnames The array of classnames. |
| 160 | 160 | * @return array |
| 161 | 161 | */ |
| 162 | - public function output_control_classnames( $classnames ) { |
|
| 162 | + public function output_control_classnames($classnames) { |
|
| 163 | 163 | $classnames['kirki-image'] = '\Kirki\Field\CSS\Image'; |
| 164 | 164 | return $classnames; |
| 165 | 165 | } |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | parent::enqueue(); |
| 49 | 49 | |
| 50 | 50 | // Enqueue the script. |
| 51 | - wp_enqueue_script( 'kirki-control-image', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base', 'wp-mediaelement', 'media-upload', 'wp-i18n' ], self::$control_ver, false ); |
|
| 52 | - wp_set_script_translations( 'kirki-control-image', 'kirki' ); |
|
| 51 | + wp_enqueue_script('kirki-control-image', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base', 'wp-mediaelement', 'media-upload', 'wp-i18n'], self::$control_ver, false); |
|
| 52 | + wp_set_script_translations('kirki-control-image', 'kirki'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | <img src="{{ url }}"/> |
| 80 | 80 | </div> |
| 81 | 81 | <# } else { #> |
| 82 | - <div class="placeholder"><?php esc_html_e( 'No image selected', 'kirki' ); ?></div> |
|
| 82 | + <div class="placeholder"><?php esc_html_e('No image selected', 'kirki'); ?></div> |
|
| 83 | 83 | <# } #> |
| 84 | 84 | <div class="actions"> |
| 85 | - <button class="button image-upload-remove-button<# if ( '' === url ) { #> hidden <# } #>"><?php esc_html_e( 'Remove', 'kirki' ); ?></button> |
|
| 85 | + <button class="button image-upload-remove-button<# if ( '' === url ) { #> hidden <# } #>"><?php esc_html_e('Remove', 'kirki'); ?></button> |
|
| 86 | 86 | <# if ( data.default && '' !== data.default ) { #> |
| 87 | - <button type="button" class="button image-default-button"<# if ( data.default === data.value || ( ! _.isUndefined( data.value.url ) && data.default === data.value.url ) ) { #> style="display:none;"<# } #>><?php esc_html_e( 'Default', 'kirki' ); ?></button> |
|
| 87 | + <button type="button" class="button image-default-button"<# if ( data.default === data.value || ( ! _.isUndefined( data.value.url ) && data.default === data.value.url ) ) { #> style="display:none;"<# } #>><?php esc_html_e('Default', 'kirki'); ?></button> |
|
| 88 | 88 | <# } #> |
| 89 | - <button type="button" class="button image-upload-button"><?php esc_html_e( 'Select image', 'kirki' ); ?></button> |
|
| 89 | + <button type="button" class="button image-upload-button"><?php esc_html_e('Select image', 'kirki'); ?></button> |
|
| 90 | 90 | </div> |
| 91 | 91 | </div> |
| 92 | 92 | <?php |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
| 27 | 27 | * @return array |
| 28 | 28 | */ |
| 29 | - public function filter_control_args( $args, $wp_customize ) { |
|
| 30 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
| 31 | - $args = parent::filter_control_args( $args, $wp_customize ); |
|
| 29 | + public function filter_control_args($args, $wp_customize) { |
|
| 30 | + if ($args['settings'] === $this->args['settings']) { |
|
| 31 | + $args = parent::filter_control_args($args, $wp_customize); |
|
| 32 | 32 | |
| 33 | 33 | $args['multiple'] = 1; |
| 34 | 34 | $args['preset'] = $args['choices']; |
| 35 | - foreach ( $args['choices'] as $key => $args ) { |
|
| 36 | - $args['choices'][ $key ] = $args['label']; |
|
| 35 | + foreach ($args['choices'] as $key => $args) { |
|
| 36 | + $args['choices'][$key] = $args['label']; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | return $args; |