@@ -200,10 +200,13 @@ |
||
| 200 | 200 | </div> |
| 201 | 201 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
| 202 | 202 | <input class="background-hidden-value" type="hidden" {{{ data.link }}}> |
| 203 | - <?php else : ?> |
|
| 203 | + <?php else { |
|
| 204 | + : ?> |
|
| 204 | 205 | <# valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); #> |
| 205 | 206 | <input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
| 206 | - <?php endif; ?> |
|
| 207 | + <?php endif; |
|
| 208 | +} |
|
| 209 | +?> |
|
| 207 | 210 | <?php |
| 208 | 211 | } |
| 209 | 212 | } |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | if ( ! is_array( $this->choices ) ) { |
| 25 | 25 | $this->choices = array(); |
| 26 | 26 | } |
| 27 | - $this->choices['element'] = 'input'; |
|
| 28 | - $this->choices['type'] = 'text'; |
|
| 27 | + $this->choices[ 'element' ] = 'input'; |
|
| 28 | + $this->choices[ 'type' ] = 'text'; |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | if ( ! is_array( $this->choices ) ) { |
| 37 | 37 | $this->choices = (array) $this->choices; |
| 38 | 38 | } |
| 39 | - if ( ! isset( $this->choices['save_as'] ) ) { |
|
| 40 | - $this->choices['save_as'] = 'url'; |
|
| 39 | + if ( ! isset( $this->choices[ 'save_as' ] ) ) { |
|
| 40 | + $this->choices[ 'save_as' ] = 'url'; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function sanitize( $value ) { |
| 66 | 66 | |
| 67 | - if ( isset( $this->choices['save_as'] ) && 'array' === $this->choices['save_as'] ) { |
|
| 67 | + if ( isset( $this->choices[ 'save_as' ] ) && 'array' === $this->choices[ 'save_as' ] ) { |
|
| 68 | 68 | return array( |
| 69 | - 'id' => ( isset( $value['id'] ) && '' !== $value['id'] ) ? (int) $value['id'] : '', |
|
| 70 | - 'url' => ( isset( $value['url'] ) && '' !== $value['url'] ) ? esc_url_raw( $value['url'] ) : '', |
|
| 71 | - 'width' => ( isset( $value['width'] ) && '' !== $value['width'] ) ? (int) $value['width'] : '', |
|
| 72 | - 'height' => ( isset( $value['height'] ) && '' !== $value['height'] ) ? (int) $value['height'] : '', |
|
| 69 | + 'id' => ( isset( $value[ 'id' ] ) && '' !== $value[ 'id' ] ) ? (int) $value[ 'id' ] : '', |
|
| 70 | + 'url' => ( isset( $value[ 'url' ] ) && '' !== $value[ 'url' ] ) ? esc_url_raw( $value[ 'url' ] ) : '', |
|
| 71 | + 'width' => ( isset( $value[ 'width' ] ) && '' !== $value[ 'width' ] ) ? (int) $value[ 'width' ] : '', |
|
| 72 | + 'height' => ( isset( $value[ 'height' ] ) && '' !== $value[ 'height' ] ) ? (int) $value[ 'height' ] : '', |
|
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | - if ( isset( $this->choices['save_as'] ) && 'id' === $this->choices['save_as'] ) { |
|
| 75 | + if ( isset( $this->choices[ 'save_as' ] ) && 'id' === $this->choices[ 'save_as' ] ) { |
|
| 76 | 76 | return absint( $value ); |
| 77 | 77 | } |
| 78 | 78 | if ( is_string( $value ) ) { |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | |
| 76 | 76 | if ( is_array( $value ) ) { |
| 77 | 77 | foreach ( $value as $key => $subvalue ) { |
| 78 | - if ( '' !== $subvalue || isset( $this->choices[''] ) ) { |
|
| 78 | + if ( '' !== $subvalue || isset( $this->choices[ '' ] ) ) { |
|
| 79 | 79 | $key = sanitize_key( $key ); |
| 80 | 80 | $value[ $key ] = esc_attr( $subvalue ); |
| 81 | 81 | } |
@@ -68,10 +68,10 @@ |
||
| 68 | 68 | |
| 69 | 69 | $default_args = array( |
| 70 | 70 | 'controls' => array( |
| 71 | - 'top' => ( isset( $this->default['top'] ) ), |
|
| 72 | - 'bottom' => ( isset( $this->default['top'] ) ), |
|
| 73 | - 'left' => ( isset( $this->default['top'] ) ), |
|
| 74 | - 'right' => ( isset( $this->default['top'] ) ), |
|
| 71 | + 'top' => ( isset( $this->default[ 'top' ] ) ), |
|
| 72 | + 'bottom' => ( isset( $this->default[ 'top' ] ) ), |
|
| 73 | + 'left' => ( isset( $this->default[ 'top' ] ) ), |
|
| 74 | + 'right' => ( isset( $this->default[ 'top' ] ) ), |
|
| 75 | 75 | ), |
| 76 | 76 | 'labels' => array( |
| 77 | 77 | 'top' => esc_attr__( 'Top', 'kirki' ), |
@@ -53,17 +53,17 @@ |
||
| 53 | 53 | } |
| 54 | 54 | if ( true === $this->alpha ) { |
| 55 | 55 | _doing_it_wrong( 'Kirki::add_field', esc_attr__( 'Do not use "alpha" as an argument in color controls. Use "choices[alpha]" instead.', 'kirki' ), '3.0.10' ); |
| 56 | - $this->choices['alpha'] = true; |
|
| 56 | + $this->choices[ 'alpha' ] = true; |
|
| 57 | 57 | } |
| 58 | - if ( ! isset( $this->choices['alpha'] ) || true !== $this->choices['alpha'] ) { |
|
| 59 | - $this->choices['alpha'] = true; |
|
| 58 | + if ( ! isset( $this->choices[ 'alpha' ] ) || true !== $this->choices[ 'alpha' ] ) { |
|
| 59 | + $this->choices[ 'alpha' ] = true; |
|
| 60 | 60 | if ( property_exists( $this, 'default' ) && ! empty( $this->default ) && false === strpos( 'rgba', $this->default ) ) { |
| 61 | - $this->choices['alpha'] = false; |
|
| 61 | + $this->choices[ 'alpha' ] = false; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ( ( ! isset( $this->choices['mode'] ) ) || ( 'hex' !== $this->choices['mode'] || 'hue' !== $this->choices['mode'] ) ) { |
|
| 66 | - $this->choices['mode'] = 'hex'; |
|
| 65 | + if ( ( ! isset( $this->choices[ 'mode' ] ) ) || ( 'hex' !== $this->choices[ 'mode' ] || 'hue' !== $this->choices[ 'mode' ] ) ) { |
|
| 66 | + $this->choices[ 'mode' ] = 'hex'; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $sanitized_value = array(); |
| 54 | 54 | foreach ( $value as $sub_value ) { |
| 55 | 55 | if ( isset( $this->choices[ $sub_value ] ) ) { |
| 56 | - $sanitized_value[] = esc_attr( $sub_value ); |
|
| 56 | + $sanitized_value[ ] = esc_attr( $sub_value ); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | return $sanitized_value; |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | return array(); |
| 55 | 55 | } |
| 56 | 56 | return array( |
| 57 | - 'background-color' => ( isset( $value['background-color'] ) ) ? esc_attr( $value['background-color'] ) : '', |
|
| 58 | - 'background-image' => ( isset( $value['background-image'] ) ) ? esc_url_raw( $value['background-image'] ) : '', |
|
| 59 | - 'background-repeat' => ( isset( $value['background-repeat'] ) ) ? esc_attr( $value['background-repeat'] ) : '', |
|
| 60 | - 'background-position' => ( isset( $value['background-position'] ) ) ? esc_attr( $value['background-position'] ) : '', |
|
| 61 | - 'background-size' => ( isset( $value['background-size'] ) ) ? esc_attr( $value['background-size'] ) : '', |
|
| 62 | - 'background-attachment' => ( isset( $value['background-attachment'] ) ) ? esc_attr( $value['background-attachment'] ) : '', |
|
| 57 | + 'background-color' => ( isset( $value[ 'background-color' ] ) ) ? esc_attr( $value[ 'background-color' ] ) : '', |
|
| 58 | + 'background-image' => ( isset( $value[ 'background-image' ] ) ) ? esc_url_raw( $value[ 'background-image' ] ) : '', |
|
| 59 | + 'background-repeat' => ( isset( $value[ 'background-repeat' ] ) ) ? esc_attr( $value[ 'background-repeat' ] ) : '', |
|
| 60 | + 'background-position' => ( isset( $value[ 'background-position' ] ) ) ? esc_attr( $value[ 'background-position' ] ) : '', |
|
| 61 | + 'background-size' => ( isset( $value[ 'background-size' ] ) ) ? esc_attr( $value[ 'background-size' ] ) : '', |
|
| 62 | + 'background-attachment' => ( isset( $value[ 'background-attachment' ] ) ) ? esc_attr( $value[ 'background-attachment' ] ) : '', |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | foreach ( $this->output as $output ) { |
| 94 | 94 | |
| 95 | 95 | // If 'element' is not defined, skip this. |
| 96 | - if ( ! isset( $output['element'] ) ) { |
|
| 96 | + if ( ! isset( $output[ 'element' ] ) ) { |
|
| 97 | 97 | continue; |
| 98 | 98 | } |
| 99 | - if ( is_array( $output['element'] ) ) { |
|
| 100 | - $output['element'] = implode( ',', $output['element'] ); |
|
| 99 | + if ( is_array( $output[ 'element' ] ) ) { |
|
| 100 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // If there's a sanitize_callback defined, skip this. |
| 104 | - if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) ) { |
|
| 104 | + if ( isset( $output[ 'sanitize_callback' ] ) && ! empty( $output[ 'sanitize_callback' ] ) ) { |
|
| 105 | 105 | continue; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // If we got this far, it's safe to add this. |
| 109 | - $js_vars[] = $output; |
|
| 109 | + $js_vars[ ] = $output; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // Did we manage to get all the items from 'output'? |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | if ( ! is_array( $this->choices ) ) { |
| 37 | 37 | $this->choices = array(); |
| 38 | 38 | } |
| 39 | - if ( ! isset( $this->choices['element'] ) ) { |
|
| 40 | - $this->choices['element'] = 'input'; |
|
| 39 | + if ( ! isset( $this->choices[ 'element' ] ) ) { |
|
| 40 | + $this->choices[ 'element' ] = 'input'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | } |