@@ -24,7 +24,7 @@ |
||
| 24 | 24 | if ( ! is_array( $this->choices ) ) { |
| 25 | 25 | $this->choices = array(); |
| 26 | 26 | } |
| 27 | - $this->choices['alpha'] = true; |
|
| 27 | + $this->choices[ 'alpha' ] = true; |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | ) |
| 53 | 53 | ); |
| 54 | 54 | // Make sure min, max & step are all numeric. |
| 55 | - $this->choices['min'] = filter_var( $this->choices['min'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 56 | - $this->choices['max'] = filter_var( $this->choices['max'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 57 | - $this->choices['step'] = filter_var( $this->choices['step'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 55 | + $this->choices[ 'min' ] = filter_var( $this->choices[ 'min' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 56 | + $this->choices[ 'max' ] = filter_var( $this->choices[ 'max' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 57 | + $this->choices[ 'step' ] = filter_var( $this->choices[ 'step' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | $value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
| 72 | 72 | |
| 73 | 73 | // Minimum & maximum value limits. |
| 74 | - if ( $value < $this->choices['min'] || $value > $this->choices['max'] ) { |
|
| 75 | - return max( min( $value, $this->choices['max'] ), $this->choices['min'] ); |
|
| 74 | + if ( $value < $this->choices[ 'min' ] || $value > $this->choices[ 'max' ] ) { |
|
| 75 | + return max( min( $value, $this->choices[ 'max' ] ), $this->choices[ 'min' ] ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Only multiple of steps. |
| 79 | - $steps = ( $value - $this->choices['min'] ) / $this->choices['step']; |
|
| 79 | + $steps = ( $value - $this->choices[ 'min' ] ) / $this->choices[ 'step' ]; |
|
| 80 | 80 | if ( ! is_int( $steps ) ) { |
| 81 | - $value = $this->choices['min'] + ( round( $steps ) * $this->choices['step'] ); |
|
| 81 | + $value = $this->choices[ 'min' ] + ( round( $steps ) * $this->choices[ 'step' ] ); |
|
| 82 | 82 | } |
| 83 | 83 | return $value; |
| 84 | 84 | } |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | protected function set_default() { |
| 50 | 50 | |
| 51 | 51 | // Accomodate the use of font-weight and convert to variant. |
| 52 | - if ( isset( $this->default['font-weight'] ) ) { |
|
| 53 | - $this->default['variant'] = ( 'regular' === $this->default['font-weight'] ) ? 400 : (string) intval( $this->default['font-weight'] ); |
|
| 52 | + if ( isset( $this->default[ 'font-weight' ] ) ) { |
|
| 53 | + $this->default[ 'variant' ] = ( 'regular' === $this->default[ 'font-weight' ] ) ? 400 : (string) intval( $this->default[ 'font-weight' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Make sure letter-spacing has units. |
| 57 | - if ( isset( $this->default['letter-spacing'] ) && is_numeric( $this->default['letter-spacing'] ) && $this->default['letter-spacing'] ) { |
|
| 58 | - $this->default['letter-spacing'] .= 'px'; |
|
| 57 | + if ( isset( $this->default[ 'letter-spacing' ] ) && is_numeric( $this->default[ 'letter-spacing' ] ) && $this->default[ 'letter-spacing' ] ) { |
|
| 58 | + $this->default[ 'letter-spacing' ] .= 'px'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Make sure we use "subsets" instead of "subset". |
| 62 | - if ( isset( $this->default['subset'] ) && ! empty( $this->default['subset'] ) && ( ! isset( $this->default['subsets'] ) || empty( $this->default['subsets'] ) ) ) { |
|
| 63 | - $this->default['subsets'] = $this->default['subset']; |
|
| 62 | + if ( isset( $this->default[ 'subset' ] ) && ! empty( $this->default[ 'subset' ] ) && ( ! isset( $this->default[ 'subsets' ] ) || empty( $this->default[ 'subsets' ] ) ) ) { |
|
| 63 | + $this->default[ 'subsets' ] = $this->default[ 'subset' ]; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | foreach ( $this->output as $output ) { |
| 112 | 112 | |
| 113 | 113 | // If 'element' or 'property' are not defined, skip this. |
| 114 | - if ( ! isset( $output['element'] ) ) { |
|
| 114 | + if ( ! isset( $output[ 'element' ] ) ) { |
|
| 115 | 115 | continue; |
| 116 | 116 | } |
| 117 | - if ( is_array( $output['element'] ) ) { |
|
| 118 | - $output['element'] = implode( ',', $output['element'] ); |
|
| 117 | + if ( is_array( $output[ 'element' ] ) ) { |
|
| 118 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // If we got this far, it's safe to add this. |
| 122 | - $js_vars[] = $output; |
|
| 122 | + $js_vars[ ] = $output; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Did we manage to get all the items from 'output'? |
@@ -151,45 +151,45 @@ discard block |
||
| 151 | 151 | foreach ( $value as $key => $val ) { |
| 152 | 152 | switch ( $key ) { |
| 153 | 153 | case 'font-family': |
| 154 | - $value['font-family'] = esc_attr( $val ); |
|
| 154 | + $value[ 'font-family' ] = esc_attr( $val ); |
|
| 155 | 155 | break; |
| 156 | 156 | case 'font-weight': |
| 157 | - if ( isset( $value['variant'] ) ) { |
|
| 157 | + if ( isset( $value[ 'variant' ] ) ) { |
|
| 158 | 158 | break; |
| 159 | 159 | } |
| 160 | - $value['variant'] = $val; |
|
| 161 | - if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) { |
|
| 162 | - $value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic'; |
|
| 160 | + $value[ 'variant' ] = $val; |
|
| 161 | + if ( isset( $value[ 'font-style' ] ) && 'italic' === $value[ 'font-style' ] ) { |
|
| 162 | + $value[ 'variant' ] = ( '400' !== $val || 400 !== $val ) ? $value[ 'variant' ] . 'italic' : 'italic'; |
|
| 163 | 163 | } |
| 164 | 164 | break; |
| 165 | 165 | case 'variant': |
| 166 | 166 | // Use 'regular' instead of 400 for font-variant. |
| 167 | - $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; |
|
| 167 | + $value[ 'variant' ] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; |
|
| 168 | 168 | // Get font-weight from variant. |
| 169 | - $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 170 | - $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] ); |
|
| 169 | + $value[ 'font-weight' ] = filter_var( $value[ 'variant' ], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); |
|
| 170 | + $value[ 'font-weight' ] = ( 'regular' === $value[ 'variant' ] || 'italic' === $value[ 'variant' ] ) ? 400 : absint( $value[ 'font-weight' ] ); |
|
| 171 | 171 | // Get font-style from variant. |
| 172 | - if ( ! isset( $value['font-style'] ) ) { |
|
| 173 | - $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; |
|
| 172 | + if ( ! isset( $value[ 'font-style' ] ) ) { |
|
| 173 | + $value[ 'font-style' ] = ( false === strpos( $value[ 'variant' ], 'italic' ) ) ? 'normal' : 'italic'; |
|
| 174 | 174 | } |
| 175 | 175 | break; |
| 176 | 176 | case 'subset': |
| 177 | 177 | // Make sure the saved value is "subsets" (plural) and not "subset". |
| 178 | 178 | // This is for compatibility with older versions. |
| 179 | - if ( ! empty( $value['subset'] ) && ! isset( $value['subsets'] ) || empty( $value['subset'] ) ) { |
|
| 180 | - $value['subsets'] = $value['subset']; |
|
| 179 | + if ( ! empty( $value[ 'subset' ] ) && ! isset( $value[ 'subsets' ] ) || empty( $value[ 'subset' ] ) ) { |
|
| 180 | + $value[ 'subsets' ] = $value[ 'subset' ]; |
|
| 181 | 181 | } |
| 182 | - unset( $value['subset'] ); |
|
| 182 | + unset( $value[ 'subset' ] ); |
|
| 183 | 183 | // Make sure we're using a valid subset. |
| 184 | 184 | $valid_subsets = Kirki_Fonts::get_google_font_subsets(); |
| 185 | 185 | $subsets_ok = array(); |
| 186 | - $value['subsets'] = (array) $value['subsets']; |
|
| 187 | - foreach ( $value['subsets'] as $subset ) { |
|
| 186 | + $value[ 'subsets' ] = (array) $value[ 'subsets' ]; |
|
| 187 | + foreach ( $value[ 'subsets' ] as $subset ) { |
|
| 188 | 188 | if ( array_key_exists( $subset, $valid_subsets ) ) { |
| 189 | - $subsets_ok[] = $subset; |
|
| 189 | + $subsets_ok[ ] = $subset; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - $value['subsets'] = $subsets_ok; |
|
| 192 | + $value[ 'subsets' ] = $subsets_ok; |
|
| 193 | 193 | break; |
| 194 | 194 | case 'font-size': |
| 195 | 195 | case 'letter-spacing': |
@@ -199,21 +199,21 @@ discard block |
||
| 199 | 199 | break; |
| 200 | 200 | case 'text-align': |
| 201 | 201 | if ( ! in_array( $val, array( 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) { |
| 202 | - $value['text-align'] = 'inherit'; |
|
| 202 | + $value[ 'text-align' ] = 'inherit'; |
|
| 203 | 203 | } |
| 204 | 204 | break; |
| 205 | 205 | case 'text-transform': |
| 206 | 206 | if ( ! in_array( $val, array( 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) { |
| 207 | - $value['text-transform'] = 'none'; |
|
| 207 | + $value[ 'text-transform' ] = 'none'; |
|
| 208 | 208 | } |
| 209 | 209 | break; |
| 210 | 210 | case 'text-decoration': |
| 211 | 211 | if ( ! in_array( $val, array( 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) { |
| 212 | - $value['text-transform'] = 'none'; |
|
| 212 | + $value[ 'text-transform' ] = 'none'; |
|
| 213 | 213 | } |
| 214 | 214 | break; |
| 215 | 215 | case 'color': |
| 216 | - $value['color'] = ariColor::newColor( $val )->toCSS( 'hex' ); |
|
| 216 | + $value[ 'color' ] = ariColor::newColor( $val )->toCSS( 'hex' ); |
|
| 217 | 217 | break; |
| 218 | 218 | } // End switch(). |
| 219 | 219 | } // End foreach(). |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | if ( ! is_array( $this->choices ) ) { |
| 32 | 32 | $this->choices = array(); |
| 33 | 33 | } |
| 34 | - $this->choices['element'] = 'textarea'; |
|
| 35 | - $this->choices['rows'] = '5'; |
|
| 34 | + $this->choices[ 'element' ] = 'textarea'; |
|
| 35 | + $this->choices[ 'rows' ] = '5'; |
|
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | unset( $value[ $row_id ][ $subfield_id ] ); |
| 98 | 98 | } |
| 99 | 99 | // Get the subfield-type. |
| 100 | - if ( ! isset( $this->fields[ $subfield_id ]['type'] ) ) { |
|
| 100 | + if ( ! isset( $this->fields[ $subfield_id ][ 'type' ] ) ) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | - $subfield_type = $this->fields[ $subfield_id ]['type']; |
|
| 103 | + $subfield_type = $this->fields[ $subfield_id ][ 'type' ]; |
|
| 104 | 104 | |
| 105 | 105 | // Allow using a sanitize-callback on a per-field basis. |
| 106 | - if ( isset( $this->fields[ $subfield_id ]['sanitize_callback'] ) ) { |
|
| 106 | + if ( isset( $this->fields[ $subfield_id ][ 'sanitize_callback' ] ) ) { |
|
| 107 | 107 | |
| 108 | - $subfield_value = call_user_func( $this->fields[ $subfield_id ]['sanitize_callback'], $subfield_value ); |
|
| 108 | + $subfield_value = call_user_func( $this->fields[ $subfield_id ][ 'sanitize_callback' ], $subfield_value ); |
|
| 109 | 109 | |
| 110 | 110 | } else { |
| 111 | 111 | |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | $subfield_value = (string) intval( $subfield_value ); |
| 143 | 143 | break; |
| 144 | 144 | case 'select': |
| 145 | - if ( isset( $this->fields[ $subfield_id ]['multiple'] ) ) { |
|
| 146 | - if ( true === $this->fields[ $subfield_id ]['multiple'] ) { |
|
| 145 | + if ( isset( $this->fields[ $subfield_id ][ 'multiple' ] ) ) { |
|
| 146 | + if ( true === $this->fields[ $subfield_id ][ 'multiple' ] ) { |
|
| 147 | 147 | $multiple = 2; |
| 148 | 148 | } |
| 149 | - $multiple = (int) $this->fields[ $subfield_id ]['multiple']; |
|
| 149 | + $multiple = (int) $this->fields[ $subfield_id ][ 'multiple' ]; |
|
| 150 | 150 | if ( 1 < $multiple ) { |
| 151 | 151 | $subfield_value = (array) $subfield_value; |
| 152 | 152 | foreach ( $subfield_value as $sub_subfield_key => $sub_subfield_value ) { |
@@ -66,10 +66,10 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | protected function set_choices() { |
| 68 | 68 | |
| 69 | - $this->choices['controls'] = array(); |
|
| 69 | + $this->choices[ 'controls' ] = array(); |
|
| 70 | 70 | if ( is_array( $this->default ) ) { |
| 71 | 71 | foreach ( $this->default as $key => $value ) { |
| 72 | - $this->choices['controls'][ $key ] = true; |
|
| 72 | + $this->choices[ 'controls' ][ $key ] = true; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @return mixed |
| 34 | 34 | */ |
| 35 | 35 | protected function get_root_value( $default = null ) { |
| 36 | - $id_base = $this->id_data['base']; |
|
| 36 | + $id_base = $this->id_data[ 'base' ]; |
|
| 37 | 37 | |
| 38 | 38 | // Get all user-meta. |
| 39 | 39 | // We'll use this to check if the value is set or not, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return bool Whether the multidimensional root was updated successfully. |
| 61 | 61 | */ |
| 62 | 62 | protected function set_root_value( $value ) { |
| 63 | - $id_base = $this->id_data['base']; |
|
| 63 | + $id_base = $this->id_data[ 'base' ]; |
|
| 64 | 64 | |
| 65 | 65 | // First delete the current user-meta. |
| 66 | 66 | // We're doing this to avoid duplicate entries. |
@@ -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 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | // Set a default class name. |
| 67 | 67 | $class_name = 'WP_Customize_Control'; |
| 68 | 68 | // Get the classname from the array of control classnames. |
| 69 | - if ( array_key_exists( $args['type'], self::$control_types ) ) { |
|
| 70 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 69 | + if ( array_key_exists( $args[ 'type' ], self::$control_types ) ) { |
|
| 70 | + $class_name = self::$control_types[ $args[ 'type' ] ]; |
|
| 71 | 71 | } |
| 72 | 72 | return $class_name; |
| 73 | 73 | |
@@ -84,17 +84,17 @@ discard block |
||
| 84 | 84 | // Get the name of the class we're going to use. |
| 85 | 85 | $class_name = $this->get_control_class_name( $args ); |
| 86 | 86 | // Fixes https://github.com/aristath/kirki/issues/1622. |
| 87 | - if ( 'kirki-code' === $args['type'] && class_exists( 'WP_Customize_Code_Editor_Control' ) ) { |
|
| 87 | + if ( 'kirki-code' === $args[ 'type' ] && class_exists( 'WP_Customize_Code_Editor_Control' ) ) { |
|
| 88 | 88 | $this->wp_customize->add_control( |
| 89 | 89 | new WP_Customize_Code_Editor_Control( |
| 90 | 90 | $this->wp_customize, |
| 91 | - $args['settings'], |
|
| 91 | + $args[ 'settings' ], |
|
| 92 | 92 | array( |
| 93 | - 'label' => isset( $args['label'] ) ? $args['label'] : '', |
|
| 94 | - 'section' => $args['section'], |
|
| 95 | - 'settings' => $args['settings'], |
|
| 96 | - 'code_type' => isset( $args['choices'] ) ? $args['choices']['language'] : 'text/css', |
|
| 97 | - 'priority' => isset( $args['priority'] ) ? $args['priority'] : 10, |
|
| 93 | + 'label' => isset( $args[ 'label' ] ) ? $args[ 'label' ] : '', |
|
| 94 | + 'section' => $args[ 'section' ], |
|
| 95 | + 'settings' => $args[ 'settings' ], |
|
| 96 | + 'code_type' => isset( $args[ 'choices' ] ) ? $args[ 'choices' ][ 'language' ] : 'text/css', |
|
| 97 | + 'priority' => isset( $args[ 'priority' ] ) ? $args[ 'priority' ] : 10, |
|
| 98 | 98 | 'input_attrs' => array( |
| 99 | 99 | 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', |
| 100 | 100 | ), |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Add the control. |
| 108 | - $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) ); |
|
| 108 | + $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args[ 'settings' ], $args ) ); |
|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |