@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $plugins = get_plugins(); |
| 46 | 46 | $_plugin = ''; |
| 47 | 47 | foreach ( $plugins as $plugin => $args ) { |
| 48 | - if ( ! $is_plugin && isset( $args['Name'] ) && ( 'Kirki' === $args['Name'] || 'Kirki Toolkit' === $args['Name'] ) ) { |
|
| 48 | + if ( ! $is_plugin && isset( $args[ 'Name' ] ) && ( 'Kirki' === $args[ 'Name' ] || 'Kirki Toolkit' === $args[ 'Name' ] ) ) { |
|
| 49 | 49 | $is_plugin = true; |
| 50 | 50 | $_plugin = $plugin; |
| 51 | 51 | } |
@@ -82,26 +82,26 @@ discard block |
||
| 82 | 82 | foreach ( Kirki::$fields as $field ) { |
| 83 | 83 | |
| 84 | 84 | // Check if we have variables for this field. |
| 85 | - if ( isset( $field['variables'] ) && $field['variables'] && ! empty( $field['variables'] ) ) { |
|
| 85 | + if ( isset( $field[ 'variables' ] ) && $field[ 'variables' ] && ! empty( $field[ 'variables' ] ) ) { |
|
| 86 | 86 | |
| 87 | 87 | // Loop through the array of variables. |
| 88 | - foreach ( $field['variables'] as $field_variable ) { |
|
| 88 | + foreach ( $field[ 'variables' ] as $field_variable ) { |
|
| 89 | 89 | |
| 90 | 90 | // Is the variable ['name'] defined? If yes, then we can proceed. |
| 91 | - if ( isset( $field_variable['name'] ) ) { |
|
| 91 | + if ( isset( $field_variable[ 'name' ] ) ) { |
|
| 92 | 92 | |
| 93 | 93 | // Sanitize the variable name. |
| 94 | - $variable_name = esc_attr( $field_variable['name'] ); |
|
| 94 | + $variable_name = esc_attr( $field_variable[ 'name' ] ); |
|
| 95 | 95 | |
| 96 | 96 | // Do we have a callback function defined? If not then set $variable_callback to false. |
| 97 | - $variable_callback = ( isset( $field_variable['callback'] ) && is_callable( $field_variable['callback'] ) ) ? $field_variable['callback'] : false; |
|
| 97 | + $variable_callback = ( isset( $field_variable[ 'callback' ] ) && is_callable( $field_variable[ 'callback' ] ) ) ? $field_variable[ 'callback' ] : false; |
|
| 98 | 98 | |
| 99 | 99 | // If we have a variable_callback defined then get the value of the option |
| 100 | 100 | // and run it through the callback function. |
| 101 | 101 | // If no callback is defined (false) then just get the value. |
| 102 | - $variables[ $variable_name ] = Kirki_Values::get_value( $field['settings'] ); |
|
| 102 | + $variables[ $variable_name ] = Kirki_Values::get_value( $field[ 'settings' ] ); |
|
| 103 | 103 | if ( $variable_callback ) { |
| 104 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
| 104 | + $variables[ $variable_name ] = call_user_func( $field_variable[ 'callback' ], Kirki_Values::get_value( $field[ 'settings' ] ) ); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -128,31 +128,31 @@ discard block |
||
| 128 | 128 | if ( |
| 129 | 129 | self::is_plugin() || |
| 130 | 130 | false === strpos( $url, 'wordpress.org' ) || ( |
| 131 | - ! isset( $request['body'] ) || |
|
| 132 | - ! isset( $request['body']['plugins'] ) || |
|
| 133 | - ! isset( $request['body']['translations'] ) || |
|
| 134 | - ! isset( $request['body']['locale'] ) || |
|
| 135 | - ! isset( $request['body']['all'] ) |
|
| 131 | + ! isset( $request[ 'body' ] ) || |
|
| 132 | + ! isset( $request[ 'body' ][ 'plugins' ] ) || |
|
| 133 | + ! isset( $request[ 'body' ][ 'translations' ] ) || |
|
| 134 | + ! isset( $request[ 'body' ][ 'locale' ] ) || |
|
| 135 | + ! isset( $request[ 'body' ][ 'all' ] ) |
|
| 136 | 136 | ) |
| 137 | 137 | ) { |
| 138 | 138 | return $request; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $plugins = json_decode( $request['body']['plugins'], true ); |
|
| 142 | - if ( ! isset( $plugins['plugins'] ) ) { |
|
| 141 | + $plugins = json_decode( $request[ 'body' ][ 'plugins' ], true ); |
|
| 142 | + if ( ! isset( $plugins[ 'plugins' ] ) ) { |
|
| 143 | 143 | return $request; |
| 144 | 144 | } |
| 145 | 145 | $exists = false; |
| 146 | - foreach ( $plugins['plugins'] as $plugin ) { |
|
| 147 | - if ( isset( $plugin['Name'] ) && 'Kirki Toolkit' === $plugin['Name'] ) { |
|
| 146 | + foreach ( $plugins[ 'plugins' ] as $plugin ) { |
|
| 147 | + if ( isset( $plugin[ 'Name' ] ) && 'Kirki Toolkit' === $plugin[ 'Name' ] ) { |
|
| 148 | 148 | $exists = true; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | // Inject data. |
| 152 | 152 | if ( ! $exists && defined( 'KIRKI_PLUGIN_FILE' ) ) { |
| 153 | - $plugins['plugins']['kirki/kirki.php'] = get_plugin_data( KIRKI_PLUGIN_FILE ); |
|
| 153 | + $plugins[ 'plugins' ][ 'kirki/kirki.php' ] = get_plugin_data( KIRKI_PLUGIN_FILE ); |
|
| 154 | 154 | } |
| 155 | - $request['body']['plugins'] = wp_json_encode( $plugins ); |
|
| 155 | + $request[ 'body' ][ 'plugins' ] = wp_json_encode( $plugins ); |
|
| 156 | 156 | return $request; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | // We only need the major version. |
| 175 | 175 | if ( 'major' === $context ) { |
| 176 | 176 | $version_parts = explode( '.', $wp_version ); |
| 177 | - return ( $only_numeric ) ? absint( $version_parts[0] ) : $version_parts[0]; |
|
| 177 | + return ( $only_numeric ) ? absint( $version_parts[ 0 ] ) : $version_parts[ 0 ]; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // If we got this far, we want the full monty. |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | if ( false !== strpos( $wp_version, '-' ) ) { |
| 184 | 184 | // We're on a dev version. |
| 185 | 185 | $version_parts = explode( '-', $wp_version ); |
| 186 | - return floatval( $version_parts[0] ); |
|
| 186 | + return floatval( $version_parts[ 0 ] ); |
|
| 187 | 187 | } |
| 188 | 188 | return floatval( $wp_version ); |
| 189 | 189 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @return mixed |
| 34 | 34 | */ |
| 35 | 35 | protected function get_root_value( $default = null ) { |
| 36 | - return get_site_option( $this->id_data['base'], $default ); |
|
| 36 | + return get_site_option( $this->id_data[ 'base' ], $default ); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return bool Whether the multidimensional root was updated successfully. |
| 46 | 46 | */ |
| 47 | 47 | protected function set_root_value( $value ) { |
| 48 | - return update_site_option( $this->id_data['base'], $value ); |
|
| 48 | + return update_site_option( $this->id_data[ 'base' ], $value ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | global $l10n; |
| 120 | 120 | if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
| 121 | 121 | // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited |
| 122 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; |
|
| 122 | + $l10n[ 'kirki' ] = $l10n[ $this->get_theme_textdomain() ]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Check if the domain is "kirki". |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | public static function add_module( $module ) { |
| 105 | 105 | |
| 106 | 106 | if ( ! in_array( $module, self::$modules, true ) ) { |
| 107 | - self::$modules[] = $module; |
|
| 107 | + self::$modules[ ] = $module; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | } |
@@ -46,12 +46,12 @@ |
||
| 46 | 46 | public function add_panel( $args ) { |
| 47 | 47 | global $wp_customize; |
| 48 | 48 | |
| 49 | - if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->panel_types ) ) { |
|
| 50 | - $args['type'] = 'default'; |
|
| 49 | + if ( ! isset( $args[ 'type' ] ) || ! array_key_exists( $args[ 'type' ], $this->panel_types ) ) { |
|
| 50 | + $args[ 'type' ] = 'default'; |
|
| 51 | 51 | } |
| 52 | - $panel_classname = $this->panel_types[ $args['type'] ]; |
|
| 52 | + $panel_classname = $this->panel_types[ $args[ 'type' ] ]; |
|
| 53 | 53 | |
| 54 | - $wp_customize->add_panel( new $panel_classname( $wp_customize, sanitize_key( $args['id'] ), $args ) ); |
|
| 54 | + $wp_customize->add_panel( new $panel_classname( $wp_customize, sanitize_key( $args[ 'id' ] ), $args ) ); |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | // Echo the styles. |
| 21 | 21 | $configs = Kirki::$config; |
| 22 | 22 | foreach ( $configs as $config_id => $args ) { |
| 23 | - if ( true === $args['disable_output'] ) { |
|
| 23 | + if ( true === $args[ 'disable_output' ] ) { |
|
| 24 | 24 | continue; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | $css = ''; |
| 37 | 37 | if ( ! empty( Kirki::$sections ) ) { |
| 38 | 38 | foreach ( Kirki::$sections as $section_args ) { |
| 39 | - if ( isset( $section_args['id'] ) && isset( $section_args['type'] ) && 'outer' === $section_args['type'] || 'kirki-outer' === $section_args['type'] ) { |
|
| 40 | - $css .= '#customize-theme-controls li#accordion-section-' . $section_args['id'] . '{display:list-item!important;}'; |
|
| 39 | + if ( isset( $section_args[ 'id' ] ) && isset( $section_args[ 'type' ] ) && 'outer' === $section_args[ 'type' ] || 'kirki-outer' === $section_args[ 'type' ] ) { |
|
| 40 | + $css .= '#customize-theme-controls li#accordion-section-' . $section_args[ 'id' ] . '{display:list-item!important;}'; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -49,10 +49,10 @@ |
||
| 49 | 49 | 'panel', |
| 50 | 50 | ) ); |
| 51 | 51 | |
| 52 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 53 | - $array['content'] = $this->get_content(); |
|
| 54 | - $array['active'] = $this->active(); |
|
| 55 | - $array['instanceNumber'] = $this->instance_number; |
|
| 52 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 53 | + $array[ 'content' ] = $this->get_content(); |
|
| 54 | + $array[ 'active' ] = $this->active(); |
|
| 55 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 56 | 56 | |
| 57 | 57 | return $array; |
| 58 | 58 | } |
@@ -51,15 +51,15 @@ |
||
| 51 | 51 | 'section', |
| 52 | 52 | ) ); |
| 53 | 53 | |
| 54 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 55 | - $array['content'] = $this->get_content(); |
|
| 56 | - $array['active'] = $this->active(); |
|
| 57 | - $array['instanceNumber'] = $this->instance_number; |
|
| 54 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 55 | + $array[ 'content' ] = $this->get_content(); |
|
| 56 | + $array[ 'active' ] = $this->active(); |
|
| 57 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 58 | 58 | |
| 59 | - $array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 59 | + $array[ 'customizeAction' ] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 60 | 60 | if ( $this->panel ) { |
| 61 | 61 | /* translators: The title. */ |
| 62 | - $array['customizeAction'] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 62 | + $array[ 'customizeAction' ] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 63 | 63 | } |
| 64 | 64 | return $array; |
| 65 | 65 | } |