@@ -53,15 +53,15 @@ |
||
| 53 | 53 | ) |
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 57 | - $array['content'] = $this->get_content(); |
|
| 58 | - $array['active'] = $this->active(); |
|
| 59 | - $array['instanceNumber'] = $this->instance_number; |
|
| 56 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 57 | + $array[ 'content' ] = $this->get_content(); |
|
| 58 | + $array[ 'active' ] = $this->active(); |
|
| 59 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 60 | 60 | |
| 61 | - $array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 61 | + $array[ 'customizeAction' ] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 62 | 62 | if ( $this->panel ) { |
| 63 | 63 | /* translators: The title. */ |
| 64 | - $array['customizeAction'] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 64 | + $array[ 'customizeAction' ] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 65 | 65 | } |
| 66 | 66 | return $array; |
| 67 | 67 | } |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function typography_field_tweaks( $value, $field_id ) { |
| 42 | 42 | |
| 43 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) { |
|
| 44 | - if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) { |
|
| 43 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) { |
|
| 44 | + if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) { |
|
| 45 | 45 | |
| 46 | 46 | // Sanitize the value. |
| 47 | 47 | // This also adds font-weight if it doesn't already exist. |
| 48 | 48 | $value = Kirki_Field_Typography::sanitize( $value ); |
| 49 | 49 | |
| 50 | 50 | // Combine font-family and font-backup. |
| 51 | - if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) { |
|
| 52 | - $value['font-family'] .= ', ' . $value['font-backup']; |
|
| 53 | - unset( $value['font-backup'] ); |
|
| 51 | + if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) { |
|
| 52 | + $value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ]; |
|
| 53 | + unset( $value[ 'font-backup' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -87,39 +87,39 @@ discard block |
||
| 87 | 87 | $config_id = 'global'; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 90 | + if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
| 91 | 91 | |
| 92 | 92 | // We're using theme_mods so just get the value using get_theme_mod. |
| 93 | 93 | $default_value = null; |
| 94 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
| 95 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
| 94 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) { |
|
| 95 | + $default_value = Kirki::$fields[ $field_id ][ 'default' ]; |
|
| 96 | 96 | } |
| 97 | 97 | $value = get_theme_mod( $field_id, $default_value ); |
| 98 | 98 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 101 | + if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
| 102 | 102 | |
| 103 | 103 | // We're using options. |
| 104 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
| 104 | + if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) { |
|
| 105 | 105 | |
| 106 | 106 | // Options are serialized as a single option in the db. |
| 107 | 107 | // We'll have to get the option and then get the item from the array. |
| 108 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
| 108 | + $options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] ); |
|
| 109 | 109 | |
| 110 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
| 111 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
| 110 | + if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) { |
|
| 111 | + $field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']'; |
|
| 112 | 112 | } |
| 113 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
| 113 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) ); |
|
| 114 | 114 | |
| 115 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
| 115 | + $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : ''; |
|
| 116 | 116 | $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
| 117 | 117 | $value = maybe_unserialize( $value ); |
| 118 | 118 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Each option separately saved in the db. |
| 122 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
| 122 | + $value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] ); |
|
| 123 | 123 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 124 | 124 | |
| 125 | 125 | } |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | * @return string|array |
| 136 | 136 | */ |
| 137 | 137 | public static function get_sanitized_field_value( $field ) { |
| 138 | - $value = $field['default']; |
|
| 139 | - if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) { |
|
| 140 | - $value = get_theme_mod( $field['settings'], $field['default'] ); |
|
| 141 | - } elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) { |
|
| 142 | - if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
|
| 143 | - $all_values = get_option( $field['option_name'], array() ); |
|
| 144 | - $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
|
| 138 | + $value = $field[ 'default' ]; |
|
| 139 | + if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) { |
|
| 140 | + $value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] ); |
|
| 141 | + } elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) { |
|
| 142 | + if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) { |
|
| 143 | + $all_values = get_option( $field[ 'option_name' ], array() ); |
|
| 144 | + $sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] ); |
|
| 145 | 145 | if ( isset( $all_values[ $sub_setting_id ] ) ) { |
| 146 | 146 | $value = $all_values[ $sub_setting_id ]; |
| 147 | 147 | } |
| 148 | 148 | } else { |
| 149 | - $value = get_option( $field['settings'], $field['default'] ); |
|
| 149 | + $value = get_option( $field[ 'settings' ], $field[ 'default' ] ); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | |
| 119 | 119 | global $l10n; |
| 120 | 120 | if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
| 121 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
|
| 121 | + $l10n[ 'kirki' ] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Check if the domain is "kirki". |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // Handle the arguments, merge one by one. |
| 38 | 38 | $args = func_get_args(); |
| 39 | - $array = $args[0]; |
|
| 39 | + $array = $args[ 0 ]; |
|
| 40 | 40 | if ( ! is_array( $array ) ) { |
| 41 | 41 | return $array; |
| 42 | 42 | } |
@@ -92,27 +92,27 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | if ( 'ftpext' === $method ) { |
| 94 | 94 | // If defined, set it to that, Else, set to NULL. |
| 95 | - $credentials['hostname'] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null; |
|
| 96 | - $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : null; |
|
| 97 | - $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : null; |
|
| 95 | + $credentials[ 'hostname' ] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null; |
|
| 96 | + $credentials[ 'username' ] = defined( 'FTP_USER' ) ? FTP_USER : null; |
|
| 97 | + $credentials[ 'password' ] = defined( 'FTP_PASS' ) ? FTP_PASS : null; |
|
| 98 | 98 | |
| 99 | 99 | // Set FTP port. |
| 100 | - if ( strpos( $credentials['hostname'], ':' ) && null !== $credentials['hostname'] ) { |
|
| 101 | - list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 ); |
|
| 102 | - if ( ! is_numeric( $credentials['port'] ) ) { |
|
| 103 | - unset( $credentials['port'] ); |
|
| 100 | + if ( strpos( $credentials[ 'hostname' ], ':' ) && null !== $credentials[ 'hostname' ] ) { |
|
| 101 | + list( $credentials[ 'hostname' ], $credentials[ 'port' ] ) = explode( ':', $credentials[ 'hostname' ], 2 ); |
|
| 102 | + if ( ! is_numeric( $credentials[ 'port' ] ) ) { |
|
| 103 | + unset( $credentials[ 'port' ] ); |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | - unset( $credentials['port'] ); |
|
| 106 | + unset( $credentials[ 'port' ] ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Set connection type. |
| 110 | 110 | if ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $method ) { |
| 111 | - $credentials['connection_type'] = 'ftps'; |
|
| 111 | + $credentials[ 'connection_type' ] = 'ftps'; |
|
| 112 | 112 | } elseif ( ! array_filter( $credentials ) ) { |
| 113 | - $credentials['connection_type'] = null; |
|
| 113 | + $credentials[ 'connection_type' ] = null; |
|
| 114 | 114 | } else { |
| 115 | - $credentials['connection_type'] = 'ftp'; |
|
| 115 | + $credentials[ 'connection_type' ] = 'ftp'; |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if ( ! empty( $attachment ) ) { |
| 152 | - return $attachment[0]; |
|
| 152 | + return $attachment[ 0 ]; |
|
| 153 | 153 | } |
| 154 | 154 | return 0; |
| 155 | 155 | } |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | $image = wp_get_attachment_image_src( $image_id, 'full' ); |
| 167 | 167 | |
| 168 | 168 | return array( |
| 169 | - 'url' => $image[0], |
|
| 170 | - 'width' => $image[1], |
|
| 171 | - 'height' => $image[2], |
|
| 172 | - 'thumbnail' => $image[3], |
|
| 169 | + 'url' => $image[ 0 ], |
|
| 170 | + 'width' => $image[ 1 ], |
|
| 171 | + 'height' => $image[ 2 ], |
|
| 172 | + 'thumbnail' => $image[ 3 ], |
|
| 173 | 173 | ); |
| 174 | 174 | |
| 175 | 175 | } |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | 'suppress_filters' => false, |
| 191 | 191 | ) |
| 192 | 192 | ); |
| 193 | - } elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) { |
|
| 194 | - $args['suppress_filters'] = false; |
|
| 193 | + } elseif ( is_array( $args ) && ! isset( $args[ 'suppress_filters' ] ) ) { |
|
| 194 | + $args[ 'suppress_filters' ] = false; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Get the posts. |
@@ -341,41 +341,41 @@ discard block |
||
| 341 | 341 | $key = absint( $context ) / 100; |
| 342 | 342 | if ( 'A100' === $context ) { |
| 343 | 343 | $key = 10; |
| 344 | - unset( $colors['grey'] ); |
|
| 344 | + unset( $colors[ 'grey' ] ); |
|
| 345 | 345 | } elseif ( 'A200' === $context ) { |
| 346 | 346 | $key = 11; |
| 347 | - unset( $colors['grey'] ); |
|
| 347 | + unset( $colors[ 'grey' ] ); |
|
| 348 | 348 | } elseif ( 'A400' === $context ) { |
| 349 | 349 | $key = 12; |
| 350 | - unset( $colors['grey'] ); |
|
| 350 | + unset( $colors[ 'grey' ] ); |
|
| 351 | 351 | } elseif ( 'A700' === $context ) { |
| 352 | 352 | $key = 13; |
| 353 | - unset( $colors['grey'] ); |
|
| 353 | + unset( $colors[ 'grey' ] ); |
|
| 354 | 354 | } |
| 355 | - unset( $colors['primary'] ); |
|
| 355 | + unset( $colors[ 'primary' ] ); |
|
| 356 | 356 | $position_colors = array(); |
| 357 | 357 | foreach ( $colors as $color_family ) { |
| 358 | 358 | if ( isset( $color_family[ $key ] ) ) { |
| 359 | - $position_colors[] = $color_family[ $key ]; |
|
| 359 | + $position_colors[ ] = $color_family[ $key ]; |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | return $position_colors; |
| 363 | 363 | case 'all': |
| 364 | - unset( $colors['primary'] ); |
|
| 364 | + unset( $colors[ 'primary' ] ); |
|
| 365 | 365 | $all_colors = array(); |
| 366 | 366 | foreach ( $colors as $color_family ) { |
| 367 | 367 | foreach ( $color_family as $color ) { |
| 368 | - $all_colors[] = $color; |
|
| 368 | + $all_colors[ ] = $color; |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | return $all_colors; |
| 372 | 372 | case 'primary': |
| 373 | - return $colors['primary']; |
|
| 373 | + return $colors[ 'primary' ]; |
|
| 374 | 374 | default: |
| 375 | 375 | if ( isset( $colors[ $context ] ) ) { |
| 376 | 376 | return $colors[ $context ]; |
| 377 | 377 | } |
| 378 | - return $colors['primary']; |
|
| 378 | + return $colors[ 'primary' ]; |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -441,7 +441,8 @@ |
||
| 441 | 441 | if ( 'contains' === $operator || 'in' === $operator ) { |
| 442 | 442 | if ( is_array( $value1 ) && is_array( $value2 ) ) { |
| 443 | 443 | foreach ( $value2 as $val ) { |
| 444 | - if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 444 | + if ( in_array( $val, $value1 ) ) { |
|
| 445 | +// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
|
| 445 | 446 | return true; |
| 446 | 447 | } |
| 447 | 448 | } |
@@ -84,28 +84,28 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | if ( empty( $this->button_label ) ) { |
| 86 | 86 | /* translators: %s represents the label of the row. */ |
| 87 | - $this->button_label = sprintf( esc_attr__( 'Add new %s', 'kirki' ), $this->row_label['value'] ); |
|
| 87 | + $this->button_label = sprintf( esc_attr__( 'Add new %s', 'kirki' ), $this->row_label[ 'value' ] ); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
| 91 | - $args['fields'] = array(); |
|
| 90 | + if ( empty( $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
| 91 | + $args[ 'fields' ] = array(); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // An array to store keys of fields that need to be filtered. |
| 95 | 95 | $media_fields_to_filter = array(); |
| 96 | 96 | |
| 97 | - foreach ( $args['fields'] as $key => $value ) { |
|
| 98 | - if ( ! isset( $value['default'] ) ) { |
|
| 99 | - $args['fields'][ $key ]['default'] = ''; |
|
| 97 | + foreach ( $args[ 'fields' ] as $key => $value ) { |
|
| 98 | + if ( ! isset( $value[ 'default' ] ) ) { |
|
| 99 | + $args[ 'fields' ][ $key ][ 'default' ] = ''; |
|
| 100 | 100 | } |
| 101 | - if ( ! isset( $value['label'] ) ) { |
|
| 102 | - $args['fields'][ $key ]['label'] = ''; |
|
| 101 | + if ( ! isset( $value[ 'label' ] ) ) { |
|
| 102 | + $args[ 'fields' ][ $key ][ 'label' ] = ''; |
|
| 103 | 103 | } |
| 104 | - $args['fields'][ $key ]['id'] = $key; |
|
| 104 | + $args[ 'fields' ][ $key ][ 'id' ] = $key; |
|
| 105 | 105 | |
| 106 | 106 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
| 107 | - if ( isset( $value['type'] ) ) { |
|
| 108 | - switch ( $value['type'] ) { |
|
| 107 | + if ( isset( $value[ 'type' ] ) ) { |
|
| 108 | + switch ( $value[ 'type' ] ) { |
|
| 109 | 109 | case 'image': |
| 110 | 110 | case 'cropped_image': |
| 111 | 111 | case 'upload': |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | // Hackily add in the data link parameter. |
| 128 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
| 129 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
| 128 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args[ 'fields' ][ $key ][ 'id' ] ) . '"' . $this->get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning |
|
| 129 | + $args[ 'fields' ][ $key ][ 'dropdown' ] = $dropdown; |
|
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $this->fields = $args['fields']; |
|
| 135 | + $this->fields = $args[ 'fields' ]; |
|
| 136 | 136 | |
| 137 | 137 | // Now we are going to filter the fields. |
| 138 | 138 | // First we create a copy of the value that would be used otherwise. |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | $fields = $this->fields; |
| 194 | 194 | |
| 195 | - $this->json['fields'] = $fields; |
|
| 196 | - $this->json['row_label'] = $this->row_label; |
|
| 195 | + $this->json[ 'fields' ] = $fields; |
|
| 196 | + $this->json[ 'row_label' ] = $this->row_label; |
|
| 197 | 197 | |
| 198 | 198 | // If filtered_value has been set and is not empty we use it instead of the actual value. |
| 199 | 199 | if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) { |
| 200 | - $this->json['value'] = $this->filtered_value; |
|
| 200 | + $this->json[ 'value' ] = $this->filtered_value; |
|
| 201 | 201 | } |
| 202 | - $this->json['value'] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json['value'] ); |
|
| 202 | + $this->json[ 'value' ] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json[ 'value' ] ); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | <ul class="repeater-fields"></ul> |
| 224 | 224 | |
| 225 | - <?php if ( isset( $this->choices['limit'] ) ) : ?> |
|
| 225 | + <?php if ( isset( $this->choices[ 'limit' ] ) ) : ?> |
|
| 226 | 226 | <?php /* translators: %s represents the number of rows we're limiting the repeater to allow. */ ?> |
| 227 | - <p class="limit"><?php printf( esc_attr__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices['limit'] ) ); ?></p> |
|
| 227 | + <p class="limit"><?php printf( esc_attr__( 'Limit: %s rows', 'kirki' ), esc_html( $this->choices[ 'limit' ] ) ); ?></p> |
|
| 228 | 228 | <?php endif; ?> |
| 229 | 229 | <button class="button-secondary repeater-add"><?php echo esc_html( $this->button_label ); ?></button> |
| 230 | 230 | |
@@ -457,24 +457,24 @@ discard block |
||
| 457 | 457 | protected function row_label( $args ) { |
| 458 | 458 | |
| 459 | 459 | // Validating args for row labels. |
| 460 | - if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) { |
|
| 460 | + if ( isset( $args[ 'row_label' ] ) && is_array( $args[ 'row_label' ] ) && ! empty( $args[ 'row_label' ] ) ) { |
|
| 461 | 461 | |
| 462 | 462 | // Validating row label type. |
| 463 | - if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) { |
|
| 464 | - $this->row_label['type'] = $args['row_label']['type']; |
|
| 463 | + if ( isset( $args[ 'row_label' ][ 'type' ] ) && ( 'text' === $args[ 'row_label' ][ 'type' ] || 'field' === $args[ 'row_label' ][ 'type' ] ) ) { |
|
| 464 | + $this->row_label[ 'type' ] = $args[ 'row_label' ][ 'type' ]; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | // Validating row label type. |
| 468 | - if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) { |
|
| 469 | - $this->row_label['value'] = esc_attr( $args['row_label']['value'] ); |
|
| 468 | + if ( isset( $args[ 'row_label' ][ 'value' ] ) && ! empty( $args[ 'row_label' ][ 'value' ] ) ) { |
|
| 469 | + $this->row_label[ 'value' ] = esc_attr( $args[ 'row_label' ][ 'value' ] ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Validating row label field. |
| 473 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) { |
|
| 474 | - $this->row_label['field'] = esc_attr( $args['row_label']['field'] ); |
|
| 473 | + if ( isset( $args[ 'row_label' ][ 'field' ] ) && ! empty( $args[ 'row_label' ][ 'field' ] ) && isset( $args[ 'fields' ][ esc_attr( $args[ 'row_label' ][ 'field' ] ) ] ) ) { |
|
| 474 | + $this->row_label[ 'field' ] = esc_attr( $args[ 'row_label' ][ 'field' ] ); |
|
| 475 | 475 | } else { |
| 476 | 476 | // If from field is not set correctly, making sure standard is set as the type. |
| 477 | - $this->row_label['type'] = 'text'; |
|
| 477 | + $this->row_label[ 'type' ] = 'text'; |
|
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | } |
@@ -37,8 +37,8 @@ |
||
| 37 | 37 | public function to_json() { |
| 38 | 38 | parent::to_json(); |
| 39 | 39 | |
| 40 | - $this->json['choices'] = wp_parse_args( |
|
| 41 | - $this->json['choices'], array( |
|
| 40 | + $this->json[ 'choices' ] = wp_parse_args( |
|
| 41 | + $this->json[ 'choices' ], array( |
|
| 42 | 42 | 'min' => '0', |
| 43 | 43 | 'max' => '100', |
| 44 | 44 | 'step' => '1', |
@@ -159,41 +159,41 @@ |
||
| 159 | 159 | // Get the basics from the parent class. |
| 160 | 160 | parent::to_json(); |
| 161 | 161 | // Default value. |
| 162 | - $this->json['default'] = $this->setting->default; |
|
| 162 | + $this->json[ 'default' ] = $this->setting->default; |
|
| 163 | 163 | if ( isset( $this->default ) ) { |
| 164 | - $this->json['default'] = $this->default; |
|
| 164 | + $this->json[ 'default' ] = $this->default; |
|
| 165 | 165 | } |
| 166 | 166 | // Required. |
| 167 | - $this->json['required'] = $this->required; |
|
| 167 | + $this->json[ 'required' ] = $this->required; |
|
| 168 | 168 | // Output. |
| 169 | - $this->json['output'] = $this->output; |
|
| 169 | + $this->json[ 'output' ] = $this->output; |
|
| 170 | 170 | // Value. |
| 171 | - $this->json['value'] = $this->value(); |
|
| 171 | + $this->json[ 'value' ] = $this->value(); |
|
| 172 | 172 | // Choices. |
| 173 | - $this->json['choices'] = $this->choices; |
|
| 173 | + $this->json[ 'choices' ] = $this->choices; |
|
| 174 | 174 | // The link. |
| 175 | - $this->json['link'] = $this->get_link(); |
|
| 175 | + $this->json[ 'link' ] = $this->get_link(); |
|
| 176 | 176 | // The ID. |
| 177 | - $this->json['id'] = $this->id; |
|
| 177 | + $this->json[ 'id' ] = $this->id; |
|
| 178 | 178 | // Translation strings. |
| 179 | - $this->json['l10n'] = $this->l10n(); |
|
| 179 | + $this->json[ 'l10n' ] = $this->l10n(); |
|
| 180 | 180 | // The ajaxurl in case we need it. |
| 181 | - $this->json['ajaxurl'] = admin_url( 'admin-ajax.php' ); |
|
| 181 | + $this->json[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' ); |
|
| 182 | 182 | // Input attributes. |
| 183 | - $this->json['inputAttrs'] = ''; |
|
| 183 | + $this->json[ 'inputAttrs' ] = ''; |
|
| 184 | 184 | foreach ( $this->input_attrs as $attr => $value ) { |
| 185 | - $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
| 185 | + $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; |
|
| 186 | 186 | } |
| 187 | 187 | // The kirki-config. |
| 188 | - $this->json['kirkiConfig'] = $this->kirki_config; |
|
| 188 | + $this->json[ 'kirkiConfig' ] = $this->kirki_config; |
|
| 189 | 189 | // The option-type. |
| 190 | - $this->json['kirkiOptionType'] = $this->option_type; |
|
| 190 | + $this->json[ 'kirkiOptionType' ] = $this->option_type; |
|
| 191 | 191 | // The option-name. |
| 192 | - $this->json['kirkiOptionName'] = $this->option_name; |
|
| 192 | + $this->json[ 'kirkiOptionName' ] = $this->option_name; |
|
| 193 | 193 | // The preset. |
| 194 | - $this->json['preset'] = $this->preset; |
|
| 194 | + $this->json[ 'preset' ] = $this->preset; |
|
| 195 | 195 | // The CSS-Variables. |
| 196 | - $this->json['css-var'] = $this->css_vars; |
|
| 196 | + $this->json[ 'css-var' ] = $this->css_vars; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |