@@ -35,12 +35,12 @@ |
||
35 | 35 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - public function filter_setting_args( $args, $wp_customize ) { |
|
39 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
40 | - $args = parent::filter_setting_args( $args, $wp_customize ); |
|
38 | + public function filter_setting_args($args, $wp_customize) { |
|
39 | + if ($args['settings'] === $this->args['settings']) { |
|
40 | + $args = parent::filter_setting_args($args, $wp_customize); |
|
41 | 41 | |
42 | 42 | // Set the sanitize-callback if none is defined. |
43 | - if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
|
43 | + if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) { |
|
44 | 44 | $args['sanitize_callback'] = 'esc_url_raw'; |
45 | 45 | } |
46 | 46 | } |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - public function filter_setting_args( $args, $wp_customize ) { |
|
39 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
40 | - $args = parent::filter_setting_args( $args, $wp_customize ); |
|
38 | + public function filter_setting_args($args, $wp_customize) { |
|
39 | + if ($args['settings'] === $this->args['settings']) { |
|
40 | + $args = parent::filter_setting_args($args, $wp_customize); |
|
41 | 41 | |
42 | 42 | // Set the sanitize-callback if none is defined. |
43 | - if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
|
43 | + if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) { |
|
44 | 44 | $args['sanitize_callback'] = 'sanitize_textarea_field'; // ? Bagus: should we use `sanitize_text_field` instead ? |
45 | 45 | } |
46 | 46 | } |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
57 | 57 | * @return array |
58 | 58 | */ |
59 | - public function filter_control_args( $args, $wp_customize ) { |
|
60 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
61 | - $args = parent::filter_control_args( $args, $wp_customize ); |
|
59 | + public function filter_control_args($args, $wp_customize) { |
|
60 | + if ($args['settings'] === $this->args['settings']) { |
|
61 | + $args = parent::filter_control_args($args, $wp_customize); |
|
62 | 62 | |
63 | 63 | // Set the control-type. |
64 | 64 | $args['type'] = 'kirki-generic'; |
65 | 65 | |
66 | 66 | // Choices. |
67 | - $args['choices'] = isset( $args['choices'] ) ? $args['choices'] : []; |
|
67 | + $args['choices'] = isset($args['choices']) ? $args['choices'] : []; |
|
68 | 68 | $args['choices']['element'] = 'input'; |
69 | 69 | $args['choices']['type'] = 'text'; |
70 | 70 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | parent::enqueue(); |
52 | 52 | |
53 | 53 | // Enqueue the script. |
54 | - wp_enqueue_script( 'kirki-control-generic', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false ); |
|
54 | + wp_enqueue_script('kirki-control-generic', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base'], self::$control_ver, false); |
|
55 | 55 | |
56 | 56 | } |
57 | 57 |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | * @param string $textdomain The textdomain we want to use. Defaults to "kirki". |
55 | 55 | * @param string $languages_path The path to languages files. |
56 | 56 | */ |
57 | - public function __construct( $textdomain = 'kirki', $languages_path = '' ) { |
|
57 | + public function __construct($textdomain = 'kirki', $languages_path = '') { |
|
58 | 58 | |
59 | 59 | $this->textdomain = $textdomain; |
60 | 60 | $this->languages_path = $languages_path; |
61 | 61 | // This will only work if we're inside a plugin. |
62 | - add_action( 'plugins_loaded', [ $this, 'load_textdomain' ] ); |
|
62 | + add_action('plugins_loaded', [$this, 'load_textdomain']); |
|
63 | 63 | |
64 | 64 | // If we got this far, then Kirki is embedded in a plugin. |
65 | 65 | // We want the theme's textdomain to handle translations. |
66 | - add_filter( 'override_load_textdomain', [ $this, 'override_load_textdomain' ], 5, 3 ); |
|
66 | + add_filter('override_load_textdomain', [$this, 'override_load_textdomain'], 5, 3); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * @since 1.0 |
74 | 74 | */ |
75 | 75 | public function load_textdomain() { |
76 | - if ( null !== $this->get_path() ) { |
|
77 | - load_textdomain( $this->textdomain, $this->get_path() ); |
|
76 | + if (null !== $this->get_path()) { |
|
77 | + load_textdomain($this->textdomain, $this->get_path()); |
|
78 | 78 | } |
79 | - load_plugin_textdomain( $this->textdomain, false, $this->languages_path ); |
|
79 | + load_plugin_textdomain($this->textdomain, false, $this->languages_path); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | protected function get_path() { |
90 | 90 | $path_found = false; |
91 | 91 | $found_path = null; |
92 | - foreach ( $this->get_paths() as $path ) { |
|
93 | - if ( $path_found ) { |
|
92 | + foreach ($this->get_paths() as $path) { |
|
93 | + if ($path_found) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | - $path = wp_normalize_path( $path ); |
|
97 | - if ( file_exists( $path ) ) { |
|
96 | + $path = wp_normalize_path($path); |
|
97 | + if (file_exists($path)) { |
|
98 | 98 | $path_found = true; |
99 | 99 | $found_path = $path; |
100 | 100 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | protected function get_paths() { |
113 | 113 | return [ |
114 | 114 | WP_LANG_DIR . '/' . $this->textdomain . '-' . get_locale() . '.mo', |
115 | - trailingslashit( $this->languages_path ) . $this->textdomain . '-' . get_locale() . '.mo', |
|
115 | + trailingslashit($this->languages_path) . $this->textdomain . '-' . get_locale() . '.mo', |
|
116 | 116 | ]; |
117 | 117 | } |
118 | 118 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * @param string $mofile Path to the MO file. |
127 | 127 | * @return bool |
128 | 128 | */ |
129 | - public function override_load_textdomain( $override, $domain, $mofile ) { |
|
129 | + public function override_load_textdomain($override, $domain, $mofile) { |
|
130 | 130 | global $l10n; |
131 | - if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
|
132 | - $l10n[ $this->textdomain ] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride |
|
131 | + if (isset($l10n[$this->get_theme_textdomain()])) { |
|
132 | + $l10n[$this->textdomain] = $l10n[$this->get_theme_textdomain()]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Check if the domain is the one we have defined. |
136 | - if ( $this->textdomain === $domain ) { |
|
136 | + if ($this->textdomain === $domain) { |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | return $override; |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | * @return string |
148 | 148 | */ |
149 | 149 | private function get_theme_textdomain() { |
150 | - if ( '' === $this->theme_textdomain ) { |
|
150 | + if ('' === $this->theme_textdomain) { |
|
151 | 151 | |
152 | 152 | // Get the textdomain. |
153 | 153 | $theme = wp_get_theme(); |
154 | - $this->theme_textdomain = $theme->get( 'TextDomain' ); |
|
154 | + $this->theme_textdomain = $theme->get('TextDomain'); |
|
155 | 155 | |
156 | 156 | // If no texdomain was found, use the template folder name. |
157 | - if ( ! $this->theme_textdomain ) { |
|
157 | + if (!$this->theme_textdomain) { |
|
158 | 158 | $this->theme_textdomain = get_template(); |
159 | 159 | } |
160 | 160 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
45 | 45 | * @return array |
46 | 46 | */ |
47 | - public function filter_setting_args( $args, $wp_customize ) { |
|
48 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
49 | - $args = parent::filter_setting_args( $args, $wp_customize ); |
|
47 | + public function filter_setting_args($args, $wp_customize) { |
|
48 | + if ($args['settings'] === $this->args['settings']) { |
|
49 | + $args = parent::filter_setting_args($args, $wp_customize); |
|
50 | 50 | |
51 | 51 | // Set the sanitize-callback if none is defined. |
52 | - if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
|
53 | - $args['sanitize_callback'] = function( $value ) { |
|
52 | + if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) { |
|
53 | + $args['sanitize_callback'] = function($value) { |
|
54 | 54 | /** |
55 | 55 | * Code fields should not be filtered by default. |
56 | 56 | * Their values usually contain CSS/JS and it it the responsibility |
@@ -73,21 +73,21 @@ discard block |
||
73 | 73 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
74 | 74 | * @return array |
75 | 75 | */ |
76 | - public function filter_control_args( $args, $wp_customize ) { |
|
77 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
78 | - $args = parent::filter_control_args( $args, $wp_customize ); |
|
76 | + public function filter_control_args($args, $wp_customize) { |
|
77 | + if ($args['settings'] === $this->args['settings']) { |
|
78 | + $args = parent::filter_control_args($args, $wp_customize); |
|
79 | 79 | |
80 | 80 | $args['type'] = 'code_editor'; |
81 | 81 | |
82 | 82 | $args['input_attrs'] = [ |
83 | 83 | 'aria-describedby' => 'kirki-code editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', |
84 | 84 | ]; |
85 | - if ( ! isset( $args['choices']['language'] ) ) { |
|
85 | + if (!isset($args['choices']['language'])) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | 89 | $language = $args['choices']['language']; |
90 | - switch ( $language ) { |
|
90 | + switch ($language) { |
|
91 | 91 | case 'json': |
92 | 92 | case 'xml': |
93 | 93 | $language = 'application/' . $language; |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $language = 'text/' . $language; |
109 | 109 | break; |
110 | 110 | default: |
111 | - $language = ( 'js' === $language ) ? 'javascript' : $language; |
|
112 | - $language = ( 'htm' === $language ) ? 'html' : $language; |
|
113 | - $language = ( 'yml' === $language ) ? 'yaml' : $language; |
|
111 | + $language = ('js' === $language) ? 'javascript' : $language; |
|
112 | + $language = ('htm' === $language) ? 'html' : $language; |
|
113 | + $language = ('yml' === $language) ? 'yaml' : $language; |
|
114 | 114 | $language = 'text/x-' . $language; |
115 | 115 | break; |
116 | 116 | } |
117 | - if ( ! isset( $args['editor_settings'] ) ) { |
|
117 | + if (!isset($args['editor_settings'])) { |
|
118 | 118 | $args['editor_settings'] = []; |
119 | 119 | } |
120 | - if ( ! isset( $args['editor_settings']['codemirror'] ) ) { |
|
120 | + if (!isset($args['editor_settings']['codemirror'])) { |
|
121 | 121 | $args['editor_settings']['codemirror'] = []; |
122 | 122 | } |
123 | - if ( ! isset( $args['editor_settings']['codemirror']['mode'] ) ) { |
|
123 | + if (!isset($args['editor_settings']['codemirror']['mode'])) { |
|
124 | 124 | $args['editor_settings']['codemirror']['mode'] = $language; |
125 | 125 | } |
126 | 126 | |
127 | - if ( 'text/x-scss' === $args['editor_settings']['codemirror']['mode'] ) { |
|
127 | + if ('text/x-scss' === $args['editor_settings']['codemirror']['mode']) { |
|
128 | 128 | $args['editor_settings']['codemirror'] = array_merge( |
129 | 129 | $args['editor_settings']['codemirror'], |
130 | 130 | [ |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
54 | 54 | * @return array |
55 | 55 | */ |
56 | - public function filter_setting_args( $args, $wp_customize ) { |
|
57 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
58 | - $args = parent::filter_setting_args( $args, $wp_customize ); |
|
56 | + public function filter_setting_args($args, $wp_customize) { |
|
57 | + if ($args['settings'] === $this->args['settings']) { |
|
58 | + $args = parent::filter_setting_args($args, $wp_customize); |
|
59 | 59 | |
60 | 60 | // Set the sanitize-callback if none is defined. |
61 | - if ( ! isset( $args['sanitize_callback'] ) || ! $args['sanitize_callback'] ) { |
|
61 | + if (!isset($args['sanitize_callback']) || !$args['sanitize_callback']) { |
|
62 | 62 | $args['sanitize_callback'] = 'sanitize_text_field'; |
63 | 63 | } |
64 | 64 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
75 | 75 | * @return array |
76 | 76 | */ |
77 | - public function filter_control_args( $args, $wp_customize ) { |
|
78 | - if ( $args['settings'] === $this->args['settings'] ) { |
|
79 | - $args = parent::filter_control_args( $args, $wp_customize ); |
|
77 | + public function filter_control_args($args, $wp_customize) { |
|
78 | + if ($args['settings'] === $this->args['settings']) { |
|
79 | + $args = parent::filter_control_args($args, $wp_customize); |
|
80 | 80 | $args['type'] = 'kirki-dashicons'; |
81 | 81 | } |
82 | 82 | return $args; |
@@ -27,21 +27,21 @@ |
||
27 | 27 | */ |
28 | 28 | public static function get_icons() { |
29 | 29 | return [ |
30 | - 'admin-menu' => [ 'menu', 'menu-alt', 'menu-alt2', 'menu-alt3', 'admin-site', 'admin-site-alt', 'admin-site-alt2', 'admin-site-alt3', 'dashboard', 'admin-post', 'admin-media', 'admin-links', 'admin-page', 'admin-comments', 'admin-appearance', 'admin-plugins', 'plugins-checked', 'admin-users', 'admin-tools', 'admin-settings', 'admin-network', 'admin-home', 'admin-generic', 'admin-collapse', 'filter', 'admin-customizer', 'admin-multisite' ], |
|
31 | - 'welcome-screen' => [ 'welcome-write-blog', 'welcome-add-page', 'welcome-view-site', 'welcome-widgets-menus', 'welcome-comments', 'welcome-learn-more' ], |
|
32 | - 'post-formats' => [ 'format-aside', 'format-image', 'format-gallery', 'format-video', 'format-status', 'format-quote', 'format-chat', 'format-audio', 'camera', 'camera-alt', 'images-alt', 'images-alt2', 'video-alt', 'video-alt2', 'video-alt3' ], |
|
33 | - 'media' => [ 'media-archive', 'media-audio', 'media-code', 'media-default', 'media-document', 'media-interactive', 'media-spreadsheet', 'media-text', 'media-video', 'playlist-audio', 'playlist-video', 'controls-play', 'controls-pause', 'controls-forward', 'controls-skipforward', 'controls-back', 'controls-skipback', 'controls-repeat', 'controls-volumeon', 'controls-volumeoff' ], |
|
34 | - 'image-editing' => [ 'image-crop', 'image-rotate', 'image-rotate-left', 'image-rotate-right', 'image-flip-vertical', 'image-flip-horizontal', 'image-filter', 'undo', 'redo' ], |
|
35 | - 'tinymce' => [ 'editor-bold', 'editor-italic', 'editor-ul', 'editor-ol', 'editor-ol-rtl', 'editor-quote', 'editor-alignleft', 'editor-aligncenter', 'editor-alignright', 'editor-insertmore', 'editor-spellcheck', 'editor-expand', 'editor-contract', 'editor-kitchensink', 'editor-underline', 'editor-justify', 'editor-textcolor', 'editor-paste-word', 'editor-paste-text', 'editor-removeformatting', 'editor-video', 'editor-customchar', 'editor-outdent', 'editor-indent', 'editor-help', 'editor-strikethrough', 'editor-unlink', 'editor-rtl', 'editor-ltr', 'editor-break', 'editor-code', 'editor-paragraph', 'editor-table' ], |
|
36 | - 'posts' => [ 'align-left', 'align-right', 'align-center', 'align-none', 'lock', 'unlock', 'calendar', 'calendar-alt', 'visibility', 'hidden', 'post-status', 'edit', 'trash', 'sticky' ], |
|
37 | - 'sorting' => [ 'external', 'arrow-up', 'arrow-down', 'arrow-right', 'arrow-left', 'arrow-up-alt', 'arrow-down-alt', 'arrow-right-alt', 'arrow-left-alt', 'arrow-up-alt2', 'arrow-down-alt2', 'arrow-right-alt2', 'arrow-left-alt2', 'sort', 'leftright', 'randomize', 'list-view', 'exerpt-view', 'grid-view', 'move' ], |
|
38 | - 'social' => [ 'share', 'share-alt', 'share-alt2', 'twitter', 'rss', 'email', 'email-alt', 'email-alt2', 'facebook', 'facebook-alt', 'googleplus', 'networking', 'instagram' ], |
|
39 | - 'wordpress_org' => [ 'hammer', 'art', 'migrate', 'performance', 'universal-access', 'universal-access-alt', 'tickets', 'nametag', 'clipboard', 'heart', 'megaphone', 'schedule', 'tide', 'rest-api', 'code-standards' ], |
|
40 | - 'products' => [ 'wordpress', 'wordpress-alt', 'pressthis', 'update', 'update-alt', 'screenoptions', 'info', 'cart', 'feedback', 'cloud', 'translation' ], |
|
41 | - 'taxonomies' => [ 'tag', 'category' ], |
|
42 | - 'widgets' => [ 'archive', 'tagcloud', 'text' ], |
|
43 | - 'notifications' => [ 'yes', 'yes-alt', 'no', 'no-alt', 'plus', 'plus-alt', 'minus', 'dismiss', 'marker', 'star-filled', 'star-half', 'star-empty', 'flag', 'warning' ], |
|
44 | - 'misc' => [ 'location', 'location-alt', 'vault', 'shield', 'shield-alt', 'sos', 'search', 'slides', 'text-page', 'analytics', 'chart-pie', 'chart-bar', 'chart-line', 'chart-area', 'groups', 'businessman', 'businesswoman', 'businessperson', 'id', 'id-alt', 'products', 'awards', 'forms', 'testimonial', 'portfolio', 'book', 'book-alt', 'download', 'upload', 'backup', 'clock', 'lightbulb', 'microphone', 'desktop', 'tablet', 'smartphone', 'phone', 'index-card', 'carrot', 'building', 'store', 'album', 'palmtree', 'tickets-alt', 'money', 'smiley', 'thumbs-up', 'thumbs-down', 'layout', 'paperclip' ], |
|
30 | + 'admin-menu' => ['menu', 'menu-alt', 'menu-alt2', 'menu-alt3', 'admin-site', 'admin-site-alt', 'admin-site-alt2', 'admin-site-alt3', 'dashboard', 'admin-post', 'admin-media', 'admin-links', 'admin-page', 'admin-comments', 'admin-appearance', 'admin-plugins', 'plugins-checked', 'admin-users', 'admin-tools', 'admin-settings', 'admin-network', 'admin-home', 'admin-generic', 'admin-collapse', 'filter', 'admin-customizer', 'admin-multisite'], |
|
31 | + 'welcome-screen' => ['welcome-write-blog', 'welcome-add-page', 'welcome-view-site', 'welcome-widgets-menus', 'welcome-comments', 'welcome-learn-more'], |
|
32 | + 'post-formats' => ['format-aside', 'format-image', 'format-gallery', 'format-video', 'format-status', 'format-quote', 'format-chat', 'format-audio', 'camera', 'camera-alt', 'images-alt', 'images-alt2', 'video-alt', 'video-alt2', 'video-alt3'], |
|
33 | + 'media' => ['media-archive', 'media-audio', 'media-code', 'media-default', 'media-document', 'media-interactive', 'media-spreadsheet', 'media-text', 'media-video', 'playlist-audio', 'playlist-video', 'controls-play', 'controls-pause', 'controls-forward', 'controls-skipforward', 'controls-back', 'controls-skipback', 'controls-repeat', 'controls-volumeon', 'controls-volumeoff'], |
|
34 | + 'image-editing' => ['image-crop', 'image-rotate', 'image-rotate-left', 'image-rotate-right', 'image-flip-vertical', 'image-flip-horizontal', 'image-filter', 'undo', 'redo'], |
|
35 | + 'tinymce' => ['editor-bold', 'editor-italic', 'editor-ul', 'editor-ol', 'editor-ol-rtl', 'editor-quote', 'editor-alignleft', 'editor-aligncenter', 'editor-alignright', 'editor-insertmore', 'editor-spellcheck', 'editor-expand', 'editor-contract', 'editor-kitchensink', 'editor-underline', 'editor-justify', 'editor-textcolor', 'editor-paste-word', 'editor-paste-text', 'editor-removeformatting', 'editor-video', 'editor-customchar', 'editor-outdent', 'editor-indent', 'editor-help', 'editor-strikethrough', 'editor-unlink', 'editor-rtl', 'editor-ltr', 'editor-break', 'editor-code', 'editor-paragraph', 'editor-table'], |
|
36 | + 'posts' => ['align-left', 'align-right', 'align-center', 'align-none', 'lock', 'unlock', 'calendar', 'calendar-alt', 'visibility', 'hidden', 'post-status', 'edit', 'trash', 'sticky'], |
|
37 | + 'sorting' => ['external', 'arrow-up', 'arrow-down', 'arrow-right', 'arrow-left', 'arrow-up-alt', 'arrow-down-alt', 'arrow-right-alt', 'arrow-left-alt', 'arrow-up-alt2', 'arrow-down-alt2', 'arrow-right-alt2', 'arrow-left-alt2', 'sort', 'leftright', 'randomize', 'list-view', 'exerpt-view', 'grid-view', 'move'], |
|
38 | + 'social' => ['share', 'share-alt', 'share-alt2', 'twitter', 'rss', 'email', 'email-alt', 'email-alt2', 'facebook', 'facebook-alt', 'googleplus', 'networking', 'instagram'], |
|
39 | + 'wordpress_org' => ['hammer', 'art', 'migrate', 'performance', 'universal-access', 'universal-access-alt', 'tickets', 'nametag', 'clipboard', 'heart', 'megaphone', 'schedule', 'tide', 'rest-api', 'code-standards'], |
|
40 | + 'products' => ['wordpress', 'wordpress-alt', 'pressthis', 'update', 'update-alt', 'screenoptions', 'info', 'cart', 'feedback', 'cloud', 'translation'], |
|
41 | + 'taxonomies' => ['tag', 'category'], |
|
42 | + 'widgets' => ['archive', 'tagcloud', 'text'], |
|
43 | + 'notifications' => ['yes', 'yes-alt', 'no', 'no-alt', 'plus', 'plus-alt', 'minus', 'dismiss', 'marker', 'star-filled', 'star-half', 'star-empty', 'flag', 'warning'], |
|
44 | + 'misc' => ['location', 'location-alt', 'vault', 'shield', 'shield-alt', 'sos', 'search', 'slides', 'text-page', 'analytics', 'chart-pie', 'chart-bar', 'chart-line', 'chart-area', 'groups', 'businessman', 'businesswoman', 'businessperson', 'id', 'id-alt', 'products', 'awards', 'forms', 'testimonial', 'portfolio', 'book', 'book-alt', 'download', 'upload', 'backup', 'clock', 'lightbulb', 'microphone', 'desktop', 'tablet', 'smartphone', 'phone', 'index-card', 'carrot', 'building', 'store', 'album', 'palmtree', 'tickets-alt', 'money', 'smiley', 'thumbs-up', 'thumbs-down', 'layout', 'paperclip'], |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | use Kirki\Control\Base; |
15 | 15 | |
16 | 16 | // Exit if accessed directly. |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if (!defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | parent::enqueue(); |
56 | 56 | |
57 | 57 | // Enqueue the script. |
58 | - wp_enqueue_script( 'kirki-control-dashicons', URL::get_from_path( dirname(dirname( __DIR__ )) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false ); |
|
58 | + wp_enqueue_script('kirki-control-dashicons', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.js'), ['jquery', 'customize-base', 'kirki-control-base'], self::$control_ver, false); |
|
59 | 59 | |
60 | 60 | // Enqueue the style. |
61 | - wp_enqueue_style( 'kirki-control-dashicons-style', URL::get_from_path( dirname(dirname( __DIR__ )) . '/dist/control.css' ), [ 'dashicons' ], self::$control_ver ); |
|
61 | + wp_enqueue_style('kirki-control-dashicons-style', URL::get_from_path(dirname(dirname(__DIR__)) . '/dist/control.css'), ['dashicons'], self::$control_ver); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -99,21 +99,21 @@ discard block |
||
99 | 99 | <# } else { #> |
100 | 100 | <# |
101 | 101 | var dashiconSections = { |
102 | - 'admin-menu': '<?php esc_html_e( 'Admin Menu', 'kirki' ); ?>', |
|
103 | - 'welcome-screen': '<?php esc_html_e( 'Welcome Screen', 'kirki' ); ?>', |
|
104 | - 'post-formats': '<?php esc_html_e( 'Post Formats', 'kirki' ); ?>', |
|
105 | - 'media': '<?php esc_html_e( 'Media', 'kirki' ); ?>', |
|
106 | - 'image-editing': '<?php esc_html_e( 'Image Editing', 'kirki' ); ?>', |
|
102 | + 'admin-menu': '<?php esc_html_e('Admin Menu', 'kirki'); ?>', |
|
103 | + 'welcome-screen': '<?php esc_html_e('Welcome Screen', 'kirki'); ?>', |
|
104 | + 'post-formats': '<?php esc_html_e('Post Formats', 'kirki'); ?>', |
|
105 | + 'media': '<?php esc_html_e('Media', 'kirki'); ?>', |
|
106 | + 'image-editing': '<?php esc_html_e('Image Editing', 'kirki'); ?>', |
|
107 | 107 | 'tinymce': 'TinyMCE', |
108 | - 'posts': '<?php esc_html_e( 'Posts', 'kirki' ); ?>', |
|
109 | - 'sorting': '<?php esc_html_e( 'Sorting', 'kirki' ); ?>', |
|
110 | - 'social': '<?php esc_html_e( 'Social', 'kirki' ); ?>', |
|
108 | + 'posts': '<?php esc_html_e('Posts', 'kirki'); ?>', |
|
109 | + 'sorting': '<?php esc_html_e('Sorting', 'kirki'); ?>', |
|
110 | + 'social': '<?php esc_html_e('Social', 'kirki'); ?>', |
|
111 | 111 | 'wordpress_org': 'WordPress', |
112 | - 'products': '<?php esc_html_e( 'Products', 'kirki' ); ?>', |
|
113 | - 'taxonomies': '<?php esc_html_e( 'Taxonomies', 'kirki' ); ?>', |
|
114 | - 'widgets': '<?php esc_html_e( 'Widgets', 'kirki' ); ?>', |
|
115 | - 'notifications': '<?php esc_html_e( 'Notifications', 'kirki' ); ?>', |
|
116 | - 'misc': '<?php esc_html_e( 'Miscelaneous', 'kirki' ); ?>' |
|
112 | + 'products': '<?php esc_html_e('Products', 'kirki'); ?>', |
|
113 | + 'taxonomies': '<?php esc_html_e('Taxonomies', 'kirki'); ?>', |
|
114 | + 'widgets': '<?php esc_html_e('Widgets', 'kirki'); ?>', |
|
115 | + 'notifications': '<?php esc_html_e('Notifications', 'kirki'); ?>', |
|
116 | + 'misc': '<?php esc_html_e('Miscelaneous', 'kirki'); ?>' |
|
117 | 117 | }; |
118 | 118 | #> |
119 | 119 | <# _.each( dashiconSections, function( sectionLabel, sectionKey ) { #> |
@@ -68,53 +68,53 @@ discard block |
||
68 | 68 | * @since 0.1 |
69 | 69 | * @param array $args The field arguments. |
70 | 70 | */ |
71 | - public function __construct( $args ) { |
|
71 | + public function __construct($args) { |
|
72 | 72 | |
73 | - $control_class = property_exists( $this, 'control_class' ) && ! empty( $this->control_class ) ? $this->control_class : ''; |
|
73 | + $control_class = property_exists($this, 'control_class') && !empty($this->control_class) ? $this->control_class : ''; |
|
74 | 74 | |
75 | 75 | // Allow 3rd parties to do their custom "init" work. |
76 | - do_action( 'kirki_field_custom_init', $this, $args, $control_class ); |
|
76 | + do_action('kirki_field_custom_init', $this, $args, $control_class); |
|
77 | 77 | |
78 | 78 | // Allow 3rd parties to early stop the field from being registered. |
79 | - if ( apply_filters( 'kirki_field_exclude_init', false, $this, $args ) ) { |
|
79 | + if (apply_filters('kirki_field_exclude_init', false, $this, $args)) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Set the arguments in this object. |
84 | 84 | $this->args = $args; |
85 | 85 | |
86 | - if ( ! isset( $this->args['settings'] ) ) { |
|
87 | - $this->args['settings'] = md5( wp_json_encode( $this->args ) ); |
|
86 | + if (!isset($this->args['settings'])) { |
|
87 | + $this->args['settings'] = md5(wp_json_encode($this->args)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | add_action( |
91 | 91 | 'wp_loaded', |
92 | 92 | function() { |
93 | - do_action( 'kirki_field_init', $this->args, $this ); |
|
93 | + do_action('kirki_field_init', $this->args, $this); |
|
94 | 94 | } |
95 | 95 | ); |
96 | 96 | |
97 | 97 | add_action( |
98 | 98 | 'wp', |
99 | 99 | function() { |
100 | - do_action( 'kirki_field_wp', $this->args, $this ); |
|
100 | + do_action('kirki_field_wp', $this->args, $this); |
|
101 | 101 | } |
102 | 102 | ); |
103 | 103 | |
104 | - $this->init( $this->args ); |
|
104 | + $this->init($this->args); |
|
105 | 105 | |
106 | 106 | // Register control-type for JS-templating in the customizer. |
107 | - add_action( 'customize_register', [ $this, 'register_control_type' ] ); |
|
107 | + add_action('customize_register', [$this, 'register_control_type']); |
|
108 | 108 | |
109 | 109 | // Add customizer setting. |
110 | - add_action( 'customize_register', [ $this, 'add_setting' ] ); |
|
110 | + add_action('customize_register', [$this, 'add_setting']); |
|
111 | 111 | |
112 | 112 | // Add customizer control. |
113 | - add_action( 'customize_register', [ $this, 'add_control' ] ); |
|
113 | + add_action('customize_register', [$this, 'add_control']); |
|
114 | 114 | |
115 | 115 | // Add default filters. Can be overriden in child classes. |
116 | - add_filter( 'kirki_field_add_setting_args', [ $this, 'filter_setting_args' ], 10, 2 ); |
|
117 | - add_filter( 'kirki_field_add_control_args', [ $this, 'filter_control_args' ], 10, 2 ); |
|
116 | + add_filter('kirki_field_add_setting_args', [$this, 'filter_setting_args'], 10, 2); |
|
117 | + add_filter('kirki_field_add_control_args', [$this, 'filter_control_args'], 10, 2); |
|
118 | 118 | |
119 | 119 | // Copy $this->args to a variable to be added to Kirki::$all_fields global. |
120 | 120 | $field_args = $this->args; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * ! This patch is used by Kirki::get_option which calls Values::get_value method. |
127 | 127 | * Even though this is a patch, this is fine and still a good solution to handle backwards compatibility. |
128 | 128 | */ |
129 | - \Kirki\Compatibility\Kirki::$all_fields[ $field_args['settings'] ] = $field_args; |
|
129 | + \Kirki\Compatibility\Kirki::$all_fields[$field_args['settings']] = $field_args; |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param array $args The field arguments. |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - protected function init( $args ) {} |
|
141 | + protected function init($args) {} |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Register the control-type. |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public function register_control_type( $wp_customize ) { |
|
151 | + public function register_control_type($wp_customize) { |
|
152 | 152 | |
153 | - if ( $this->control_class ) { |
|
154 | - $wp_customize->register_control_type( $this->control_class ); |
|
153 | + if ($this->control_class) { |
|
154 | + $wp_customize->register_control_type($this->control_class); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
166 | 166 | * @return array |
167 | 167 | */ |
168 | - public function filter_setting_args( $args, $wp_customize ) { |
|
168 | + public function filter_setting_args($args, $wp_customize) { |
|
169 | 169 | |
170 | 170 | return $args; |
171 | 171 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
181 | 181 | * @return array |
182 | 182 | */ |
183 | - public function filter_control_args( $args, $wp_customize ) { |
|
183 | + public function filter_control_args($args, $wp_customize) { |
|
184 | 184 | |
185 | 185 | return $args; |
186 | 186 | |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | * @param WP_Customize_Manager $customizer The customizer instance. |
195 | 195 | * @return void |
196 | 196 | */ |
197 | - public function add_setting( $customizer ) { |
|
197 | + public function add_setting($customizer) { |
|
198 | 198 | |
199 | 199 | $args = $this->args; |
200 | 200 | |
201 | 201 | // This is for postMessage purpose. |
202 | 202 | // @see wp-content/plugins/kirki/packages/kirki-framework/module-postmessage/src/Postmessage.php inside 'field_add_setting_args' method. |
203 | - $args['type'] = isset( $this->type ) ? $this->type : ''; |
|
203 | + $args['type'] = isset($this->type) ? $this->type : ''; |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Allow filtering the arguments. |
@@ -210,30 +210,30 @@ discard block |
||
210 | 210 | * @param WP_Customize_Manager $customizer The customizer instance. |
211 | 211 | * @return array Return the arguments. |
212 | 212 | */ |
213 | - $args = apply_filters( 'kirki_field_add_setting_args', $args, $customizer ); |
|
213 | + $args = apply_filters('kirki_field_add_setting_args', $args, $customizer); |
|
214 | 214 | |
215 | - if ( ! isset( $args['settings'] ) || empty( $args['settings'] ) ) { |
|
215 | + if (!isset($args['settings']) || empty($args['settings'])) { |
|
216 | 216 | return; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $setting_id = $args['settings']; |
220 | 220 | |
221 | 221 | $args = [ |
222 | - 'type' => isset( $args['option_type'] ) ? $args['option_type'] : 'theme_mod', // 'type' here doesn't use the $args['type'] but instead checking the $args['option_type']. |
|
223 | - 'capability' => isset( $args['capability'] ) ? $args['capability'] : 'edit_theme_options', |
|
224 | - 'theme_supports' => isset( $args['theme_supports'] ) ? $args['theme_supports'] : '', |
|
225 | - 'default' => isset( $args['default'] ) ? $args['default'] : '', |
|
226 | - 'transport' => isset( $args['transport'] ) ? $args['transport'] : 'refresh', |
|
227 | - 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : '', |
|
228 | - 'sanitize_js_callback' => isset( $args['sanitize_js_callback'] ) ? $args['sanitize_js_callback'] : '', |
|
222 | + 'type' => isset($args['option_type']) ? $args['option_type'] : 'theme_mod', // 'type' here doesn't use the $args['type'] but instead checking the $args['option_type']. |
|
223 | + 'capability' => isset($args['capability']) ? $args['capability'] : 'edit_theme_options', |
|
224 | + 'theme_supports' => isset($args['theme_supports']) ? $args['theme_supports'] : '', |
|
225 | + 'default' => isset($args['default']) ? $args['default'] : '', |
|
226 | + 'transport' => isset($args['transport']) ? $args['transport'] : 'refresh', |
|
227 | + 'sanitize_callback' => isset($args['sanitize_callback']) ? $args['sanitize_callback'] : '', |
|
228 | + 'sanitize_js_callback' => isset($args['sanitize_js_callback']) ? $args['sanitize_js_callback'] : '', |
|
229 | 229 | ]; |
230 | 230 | |
231 | 231 | $settings_class = $this->settings_class ? $this->settings_class : null; |
232 | 232 | |
233 | - if ( $settings_class ) { |
|
234 | - $customizer->add_setting( new $settings_class( $customizer, $setting_id, $args ) ); |
|
233 | + if ($settings_class) { |
|
234 | + $customizer->add_setting(new $settings_class($customizer, $setting_id, $args)); |
|
235 | 235 | } else { |
236 | - $customizer->add_setting( $setting_id, $args ); |
|
236 | + $customizer->add_setting($setting_id, $args); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | } |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
247 | 247 | * @return void |
248 | 248 | */ |
249 | - public function add_control( $wp_customize ) { |
|
249 | + public function add_control($wp_customize) { |
|
250 | 250 | |
251 | 251 | $control_class = $this->control_class; |
252 | 252 | |
253 | 253 | // If no class-name is defined, early exit. |
254 | - if ( ! $control_class ) { |
|
254 | + if (!$control_class) { |
|
255 | 255 | return; |
256 | 256 | } |
257 | 257 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | * @param WP_Customize_Manager $wp_customize The customizer instance. |
264 | 264 | * @return array Return the arguments. |
265 | 265 | */ |
266 | - $args = apply_filters( 'kirki_field_add_control_args', $this->args, $wp_customize ); |
|
266 | + $args = apply_filters('kirki_field_add_control_args', $this->args, $wp_customize); |
|
267 | 267 | |
268 | - $wp_customize->add_control( new $control_class( $wp_customize, $this->args['settings'], $args ) ); |
|
268 | + $wp_customize->add_control(new $control_class($wp_customize, $this->args['settings'], $args)); |
|
269 | 269 | |
270 | 270 | } |
271 | 271 |