@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | foreach ( $redux_plugin_data as $redux_key => $redux_data ) { |
| 67 | 67 | $redux_key_slug = explode( '/', $redux_key ); |
| 68 | 68 | $redux_key_slug = $redux_key_slug[0]; |
| 69 | - $redux_plugin_index[ $redux_key_slug ] = $redux_key; |
|
| 69 | + $redux_plugin_index[$redux_key_slug] = $redux_key; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | foreach ( $redux_sys_info as $redux_project_type => $redux_products ) { |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | } else { |
| 117 | 117 | foreach ( $redux_products as $redux_product => $redux_data ) { |
| 118 | - if ( ! isset( $redux_plugin_index[ $redux_product ] ) ) { |
|
| 118 | + if ( ! isset( $redux_plugin_index[$redux_product] ) ) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $redux_plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $redux_plugin_index[ $redux_product ] ); |
|
| 122 | + $redux_plugin_path = Redux_Functions_Ex::wp_normalize_path( WP_PLUGIN_DIR . '/' . $redux_plugin_index[$redux_product] ); |
|
| 123 | 123 | $redux_plugin_data = get_plugin_data( $redux_plugin_path ); |
| 124 | 124 | |
| 125 | 125 | ?> |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @var array|null |
| 57 | 57 | */ |
| 58 | - private static ?array $post_values = array(); |
|
| 58 | + private static ? array $post_values = array(); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Options array. |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | foreach ( $the_data as $key => $value ) { |
| 317 | 317 | if ( strpos( wp_json_encode( $value ), 'data' ) > 0 ) { |
| 318 | 318 | foreach ( $value as $k => $v ) { |
| 319 | - $decode = (array) json_decode( rawurldecode( $v['data'] ) ); |
|
| 319 | + $decode = ( array ) json_decode( rawurldecode( $v['data'] ) ); |
|
| 320 | 320 | $v = $decode; |
| 321 | - $dumb_array[ $k ] = $v; |
|
| 322 | - $the_data[ $key ] = $dumb_array; |
|
| 321 | + $dumb_array[$k] = $v; |
|
| 322 | + $the_data[$key] = $dumb_array; |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | foreach ( self::$post_values as $key => $value ) { |
| 344 | 344 | if ( strpos( $key, $this->parent->args['opt_name'] ) !== false ) { |
| 345 | 345 | $key = str_replace( $this->parent->args['opt_name'] . '[', '', rtrim( $key, ']' ) ); |
| 346 | - $data[ $key ] = $value; |
|
| 346 | + $data[$key] = $value; |
|
| 347 | 347 | |
| 348 | 348 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals |
| 349 | - $GLOBALS[ $this->parent->args['global_variable'] ][ $key ] = $value; |
|
| 350 | - $this->parent->options[ $key ] = $value; |
|
| 349 | + $GLOBALS[$this->parent->args['global_variable']][$key] = $value; |
|
| 350 | + $this->parent->options[$key] = $value; |
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | public function render( object $control ) { |
| 365 | 365 | $field_id = str_replace( $this->parent->args['opt_name'] . '-', '', $control->redux_id ); |
| 366 | - $field = $this->options[ $field_id ]; |
|
| 366 | + $field = $this->options[$field_id]; |
|
| 367 | 367 | |
| 368 | 368 | if ( ! empty( $field['compiler'] ) ) { |
| 369 | 369 | echo '<tr class="compiler">'; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | echo '<tr>'; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - echo '<th scope="row">' . wp_kses_post( $this->parent->field_head[ $field['id'] ] ) . '</th>'; |
|
| 374 | + echo '<th scope="row">' . wp_kses_post( $this->parent->field_head[$field['id']] ) . '</th>'; |
|
| 375 | 375 | echo '<td>'; |
| 376 | 376 | |
| 377 | 377 | $field['name'] = $field['id']; |
@@ -415,8 +415,8 @@ discard block |
||
| 415 | 415 | do_action( 'redux/extension/customizer/control/includes' ); |
| 416 | 416 | |
| 417 | 417 | $order = array( |
| 418 | - 'heading' => - 500, |
|
| 419 | - 'option' => - 500, |
|
| 418 | + 'heading' => -500, |
|
| 419 | + 'option' => -500, |
|
| 420 | 420 | ); |
| 421 | 421 | |
| 422 | 422 | $panel = ''; |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $parent_section_id = null; |
| 456 | 456 | $new_parent = true; |
| 457 | 457 | } |
| 458 | - if ( isset( $parent_section_id ) && ( isset( $this->parent->sections[ $parent_section_id ]['customizer'] ) && false === $this->parent->sections[ $parent_section_id ]['customizer'] ) ) { |
|
| 458 | + if ( isset( $parent_section_id ) && ( isset( $this->parent->sections[$parent_section_id]['customizer'] ) && false === $this->parent->sections[$parent_section_id]['customizer'] ) ) { |
|
| 459 | 459 | continue; |
| 460 | 460 | } |
| 461 | 461 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | $section['id'] = $this->parent->args['opt_name'] . '-' . $section['id']; |
| 490 | 490 | |
| 491 | - if ( method_exists( $wp_customize, 'add_panel' ) && ( ! isset( $section['subsection'] ) || ( true !== $section['subsection'] ) ) && isset( $this->parent->sections[ ( $key + 1 ) ]['subsection'] ) && $this->parent->sections[ ( $key + 1 ) ]['subsection'] ) { |
|
| 491 | + if ( method_exists( $wp_customize, 'add_panel' ) && ( ! isset( $section['subsection'] ) || ( true !== $section['subsection'] ) ) && isset( $this->parent->sections[( $key + 1 )]['subsection'] ) && $this->parent->sections[( $key + 1 )]['subsection'] ) { |
|
| 492 | 492 | $this->add_panel( |
| 493 | 493 | $this->parent->args['opt_name'] . '-' . $section['id'], |
| 494 | 494 | array( |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | continue; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - $this->options[ $option['id'] ] = $option; |
|
| 554 | + $this->options[$option['id']] = $option; |
|
| 555 | 555 | add_action( 'redux/customizer/control/render/' . $this->parent->args['opt_name'] . '-' . $option['id'], array( $this, 'render' ) ); |
| 556 | 556 | |
| 557 | 557 | $option['permissions'] = $option['permissions'] ?? 'edit_theme_options'; |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | ++$order['option']; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if ( ! empty( $this->options_defaults[ $option['id'] ] ) ) { |
|
| 565 | + if ( ! empty( $this->options_defaults[$option['id']] ) ) { |
|
| 566 | 566 | $option['default'] = $this->options_defaults['option']['id']; |
| 567 | 567 | } |
| 568 | 568 | |
@@ -635,12 +635,12 @@ discard block |
||
| 635 | 635 | ) |
| 636 | 636 | ); |
| 637 | 637 | |
| 638 | - $section['fields'][ $skey ]['name'] = $option['id']; |
|
| 639 | - if ( ! isset( $section['fields'][ $skey ]['class'] ) ) { // No errors please. |
|
| 640 | - $section['fields'][ $skey ]['class'] = ''; |
|
| 638 | + $section['fields'][$skey]['name'] = $option['id']; |
|
| 639 | + if ( ! isset( $section['fields'][$skey]['class'] ) ) { // No errors please. |
|
| 640 | + $section['fields'][$skey]['class'] = ''; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $this->controls[ $section['fields'][ $skey ]['id'] ] = $section['fields'][ $skey ]; |
|
| 643 | + $this->controls[$section['fields'][$skey]['id']] = $section['fields'][$skey]; |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | } |
@@ -707,11 +707,11 @@ discard block |
||
| 707 | 707 | if ( strpos( $key, $this->parent->args['opt_name'] ) !== false ) { |
| 708 | 708 | $key = str_replace( $this->parent->args['opt_name'] . '[', '', rtrim( $key, ']' ) ); |
| 709 | 709 | |
| 710 | - if ( ! isset( $this->orig_options[ $key ] ) || $value !== $this->orig_options[ $key ] || ( isset( $this->orig_options[ $key ] ) && ! empty( $this->orig_options[ $key ] ) && empty( $value ) ) ) { |
|
| 711 | - $this->parent->options[ $key ] = $value; |
|
| 710 | + if ( ! isset( $this->orig_options[$key] ) || $value !== $this->orig_options[$key] || ( isset( $this->orig_options[$key] ) && ! empty( $this->orig_options[$key] ) && empty( $value ) ) ) { |
|
| 711 | + $this->parent->options[$key] = $value; |
|
| 712 | 712 | $changed = true; |
| 713 | 713 | |
| 714 | - if ( isset( $this->parent->compiler_fields[ $key ] ) ) { |
|
| 714 | + if ( isset( $this->parent->compiler_fields[$key] ) ) { |
|
| 715 | 715 | $compiler = true; |
| 716 | 716 | } |
| 717 | 717 | } |
@@ -814,8 +814,8 @@ discard block |
||
| 814 | 814 | if ( strpos( wp_json_encode( $value ), 'data' ) > 0 ) { |
| 815 | 815 | $replace = $value; |
| 816 | 816 | foreach ( $replace as $sub_array ) { |
| 817 | - $cs_array = (array) json_decode( rawurldecode( $sub_array['data'] ) ); |
|
| 818 | - $value[ $cs_array['id'] ] = $cs_array; |
|
| 817 | + $cs_array = ( array ) json_decode( rawurldecode( $sub_array['data'] ) ); |
|
| 818 | + $value[$cs_array['id']] = $cs_array; |
|
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | 821 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $box['page_template'] = array( $box['page_template'] ); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $this->wp_links[ $box_id ]['page_template'] = isset( $this->wp_links[ $box_id ]['page_template'] ) ? wp_parse_args( $this->wp_links[ $box_id ]['page_template'], $box['page_template'] ) : $box['page_template']; |
|
| 296 | + $this->wp_links[$box_id]['page_template'] = isset( $this->wp_links[$box_id]['page_template'] ) ? wp_parse_args( $this->wp_links[$box_id]['page_template'], $box['page_template'] ) : $box['page_template']; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if ( isset( $box['post_format'] ) && ( in_array( $this->post_type, $this->post_types, true ) || '' === $this->post_type || false === $this->post_type ) ) { |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | $box['post_format'] = array( $box['post_format'] ); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - $this->wp_links[ $box_id ]['post_format'] = isset( $this->wp_links[ $box_id ]['post_format'] ) ? wp_parse_args( $this->wp_links[ $box_id ]['post_format'], $box['post_format'] ) : $box['post_format']; |
|
| 304 | + $this->wp_links[$box_id]['post_format'] = isset( $this->wp_links[$box_id]['post_format'] ) ? wp_parse_args( $this->wp_links[$box_id]['post_format'], $box['post_format'] ) : $box['post_format']; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - $this->meta[ $this->post_id ] = $this->get_meta( $this->post_id ); |
|
| 307 | + $this->meta[$this->post_id] = $this->get_meta( $this->post_id ); |
|
| 308 | 308 | |
| 309 | 309 | foreach ( $box['sections'] as $sk => $section ) { |
| 310 | 310 | if ( ! empty( $section['fields'] ) ) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | if ( ! isset( $field['class'] ) ) { |
| 313 | 313 | $field['class'] = ''; |
| 314 | 314 | |
| 315 | - $this->boxes[ $bk ]['sections'][ $sk ]['fields'][ $fk ] = $field; |
|
| 315 | + $this->boxes[$bk]['sections'][$sk]['fields'][$fk] = $field; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if ( $add_field || ( ( is_admin() && ( 'post-new.php' === $pagenow || 'post.php' === $pagenow ) ) || ( ! is_admin() ) ) ) { |
@@ -321,43 +321,43 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | if ( isset( $field['default'] ) ) { |
| 324 | - $this->options_defaults[ $field['id'] ] = $field['default']; |
|
| 324 | + $this->options_defaults[$field['id']] = $field['default']; |
|
| 325 | 325 | } else { |
| 326 | - $this->options_defaults[ $field['id'] ] = $this->field_default( $field ); |
|
| 326 | + $this->options_defaults[$field['id']] = $this->field_default( $field ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | foreach ( $box['post_types'] as $type ) { |
| 330 | - $this->post_type_fields[ $type ][ $field['id'] ] = 1; |
|
| 330 | + $this->post_type_fields[$type][$field['id']] = 1; |
|
| 331 | 331 | |
| 332 | 332 | if ( 'repeater' === $field['type'] ) { |
| 333 | 333 | foreach ( $field['fields'] as $val ) { |
| 334 | - $this->post_type_fields[ $type ][ $val['id'] ] = 1; |
|
| 334 | + $this->post_type_fields[$type][$val['id']] = 1; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | if ( ! empty( $field['output'] ) ) { |
| 340 | - $this->output[ $field['id'] ] = isset( $this->output[ $field['id'] ] ) ? array_merge( $field['output'], $this->output[ $field['id'] ] ) : $field['output']; |
|
| 340 | + $this->output[$field['id']] = isset( $this->output[$field['id']] ) ? array_merge( $field['output'], $this->output[$field['id']] ) : $field['output']; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | // Detect what field types are being used. |
| 344 | - if ( ! isset( $this->parent->fields[ $field['type'] ][ $field['id'] ] ) ) { |
|
| 345 | - $this->parent->fields[ $field['type'] ][ $field['id'] ] = 1; |
|
| 344 | + if ( ! isset( $this->parent->fields[$field['type']][$field['id']] ) ) { |
|
| 345 | + $this->parent->fields[$field['type']][$field['id']] = 1; |
|
| 346 | 346 | } else { |
| 347 | - $this->parent->fields[ $field['type'] ] = array( $field['id'] => 1 ); |
|
| 347 | + $this->parent->fields[$field['type']] = array( $field['id'] => 1 ); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if ( isset( $this->options_defaults[ $field['id'] ] ) ) { |
|
| 351 | - $this->to_replace[ $field['id'] ] = $field; |
|
| 350 | + if ( isset( $this->options_defaults[$field['id']] ) ) { |
|
| 351 | + $this->to_replace[$field['id']] = $field; |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - if ( ! isset( $this->parent->options[ $field['id'] ] ) ) { |
|
| 356 | - $this->parent->sections[ ( count( $this->parent->sections ) - 1 ) ]['fields'][] = $field; |
|
| 355 | + if ( ! isset( $this->parent->options[$field['id']] ) ) { |
|
| 356 | + $this->parent->sections[( count( $this->parent->sections ) - 1 )]['fields'][] = $field; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if ( ! isset( $this->meta[ $this->post_id ][ $field['id'] ] ) ) { |
|
| 360 | - $this->meta[ $this->post_id ][ $field['id'] ] = $this->options_defaults[ $field['id'] ]; |
|
| 359 | + if ( ! isset( $this->meta[$this->post_id][$field['id']] ) ) { |
|
| 360 | + $this->meta[$this->post_id][$field['id']] = $this->options_defaults[$field['id']]; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // Only override if it exists, and it's not the default. |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | * @return mixed |
| 398 | 398 | */ |
| 399 | 399 | public function replace_field( array $field ) { |
| 400 | - if ( isset( $this->to_replace[ $field['id'] ] ) ) { |
|
| 401 | - $field = $this->to_replace[ $field['id'] ]; |
|
| 400 | + if ( isset( $this->to_replace[$field['id']] ) ) { |
|
| 401 | + $field = $this->to_replace[$field['id']]; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | return $field; |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @return array |
| 413 | 413 | */ |
| 414 | 414 | public function override_can_output_css( array $field ): array { |
| 415 | - if ( isset( $this->output[ $field['id'] ] ) ) { |
|
| 415 | + if ( isset( $this->output[$field['id']] ) ) { |
|
| 416 | 416 | $field['force_output'] = true; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | * @return array |
| 428 | 428 | */ |
| 429 | 429 | public function output_css( array $field ): array { |
| 430 | - if ( isset( $this->output[ $field['id'] ] ) ) { |
|
| 431 | - $field['output'] = $this->output[ $field['id'] ]; |
|
| 430 | + if ( isset( $this->output[$field['id']] ) ) { |
|
| 431 | + $field['output'] = $this->output[$field['id']]; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | return $field; |
@@ -449,13 +449,13 @@ discard block |
||
| 449 | 449 | $data = wp_parse_args( $meta, $this->options_defaults ); |
| 450 | 450 | |
| 451 | 451 | foreach ( $data as $key => $value ) { |
| 452 | - if ( isset( $meta[ $key ] ) && '' !== $meta[ $key ] ) { |
|
| 453 | - $data[ $key ] = $meta[ $key ]; |
|
| 452 | + if ( isset( $meta[$key] ) && '' !== $meta[$key] ) { |
|
| 453 | + $data[$key] = $meta[$key]; |
|
| 454 | 454 | continue; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if ( isset( $options[ $key ] ) ) { |
|
| 458 | - $data[ $key ] = $options[ $key ]; |
|
| 457 | + if ( isset( $options[$key] ) ) { |
|
| 458 | + $data[$key] = $options[$key]; |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | $the_post = $post; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( isset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ) ) { |
|
| 486 | - $GLOBALS[ $this->parent->args['global_variable'] ] = $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ]; |
|
| 487 | - unset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ); |
|
| 485 | + if ( isset( $GLOBALS[$this->parent->args['global_variable'] . '-loop'] ) ) { |
|
| 486 | + $GLOBALS[$this->parent->args['global_variable']] = $GLOBALS[$this->parent->args['global_variable'] . '-loop']; |
|
| 487 | + unset( $GLOBALS[$this->parent->args['global_variable'] . '-loop'] ); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Override these values if they differ from the admin panel defaults. ;) . |
@@ -495,8 +495,8 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | // Backup the args. |
| 498 | - $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] = $GLOBALS[ $this->parent->args['global_variable'] ]; |
|
| 499 | - $GLOBALS[ $this->parent->args['global_variable'] ] = wp_parse_args( $meta, $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ); |
|
| 498 | + $GLOBALS[$this->parent->args['global_variable'] . '-loop'] = $GLOBALS[$this->parent->args['global_variable']]; |
|
| 499 | + $GLOBALS[$this->parent->args['global_variable']] = wp_parse_args( $meta, $GLOBALS[$this->parent->args['global_variable'] . '-loop'] ); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals -- Cannot rename 'this.' |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | * Loop end. |
| 507 | 507 | */ |
| 508 | 508 | public function loop_end() { |
| 509 | - if ( isset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ) ) { |
|
| 509 | + if ( isset( $GLOBALS[$this->parent->args['global_variable'] . '-loop'] ) ) { |
|
| 510 | 510 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Cannot rename 'this.' C'mon WP guys. Dumbest fucking misflag ever! |
| 511 | - $GLOBALS[ $this->parent->args['global_variable'] ] = $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ]; |
|
| 511 | + $GLOBALS[$this->parent->args['global_variable']] = $GLOBALS[$this->parent->args['global_variable'] . '-loop']; |
|
| 512 | 512 | |
| 513 | - unset( $GLOBALS[ $this->parent->args['global_variable'] . '-loop' ] ); |
|
| 513 | + unset( $GLOBALS[$this->parent->args['global_variable'] . '-loop'] ); |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if ( ! empty( $box['post_types'] ) ) { |
| 536 | 536 | if ( ! is_array( $box['post_types'] ) ) { |
| 537 | 537 | $box['post_types'] = array( $box['post_types'] ); |
| 538 | - $this->boxes[ $key ]['post_types'] = $box['post_types']; |
|
| 538 | + $this->boxes[$key]['post_types'] = $box['post_types']; |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | if ( isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
| 628 | - $post = (int) sanitize_text_field( wp_unslash( $_GET['post'] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 628 | + $post = ( int ) sanitize_text_field( wp_unslash( $_GET['post'] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 629 | 629 | |
| 630 | 630 | if ( ! empty( $post ) ) { |
| 631 | 631 | return $post; |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | |
| 647 | 647 | $post_id = url_to_postid( $url ); |
| 648 | 648 | |
| 649 | - if ( isset( $post_id ) && '' !== (string) $post_id && 0 !== $post_id ) { |
|
| 649 | + if ( isset( $post_id ) && '' !== ( string ) $post_id && 0 !== $post_id ) { |
|
| 650 | 650 | return $post_id; |
| 651 | 651 | } |
| 652 | 652 | |
@@ -702,9 +702,9 @@ discard block |
||
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | foreach ( $GLOBALS['wp_post_types'] as $key => $value ) { |
| 705 | - if ( ! empty( $_GET[ $key ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 705 | + if ( ! empty( $_GET[$key] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 706 | 706 | $args = array( |
| 707 | - 'name' => sanitize_text_field( wp_unslash( $_GET[ $key ] ) ), // phpcs:ignore WordPress.Security.NonceVerification |
|
| 707 | + 'name' => sanitize_text_field( wp_unslash( $_GET[$key] ) ), // phpcs:ignore WordPress.Security.NonceVerification |
|
| 708 | 708 | 'post_type' => $key, |
| 709 | 709 | 'showposts' => 1, |
| 710 | 710 | ); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | foreach ( $query_vars as $key => $value ) { |
| 792 | 792 | if ( in_array( $key, $wp->public_query_vars, true ) ) { |
| 793 | - $query[ $key ] = $value; |
|
| 793 | + $query[$key] = $value; |
|
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | |
@@ -824,35 +824,35 @@ discard block |
||
| 824 | 824 | // Taken from class-wp.php. |
| 825 | 825 | foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) { |
| 826 | 826 | if ( isset( $t->query_var ) ) { |
| 827 | - $post_type_query_vars[ $t->query_var ] = $post_type; |
|
| 827 | + $post_type_query_vars[$t->query_var] = $post_type; |
|
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | foreach ( $wp->public_query_vars as $wpvar ) { |
| 832 | - if ( isset( $wp->extra_query_vars[ $wpvar ] ) ) { |
|
| 833 | - $query[ $wpvar ] = $wp->extra_query_vars[ $wpvar ]; |
|
| 834 | - } elseif ( isset( $_POST[ $wpvar ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 835 | - $query[ $wpvar ] = sanitize_text_field( wp_unslash( $_POST[ $wpvar ] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 836 | - } elseif ( isset( $_GET[ $wpvar ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 837 | - $query[ $wpvar ] = sanitize_text_field( wp_unslash( $_GET[ $wpvar ] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 838 | - } elseif ( isset( $query_vars[ $wpvar ] ) ) { |
|
| 839 | - $query[ $wpvar ] = $query_vars[ $wpvar ]; |
|
| 832 | + if ( isset( $wp->extra_query_vars[$wpvar] ) ) { |
|
| 833 | + $query[$wpvar] = $wp->extra_query_vars[$wpvar]; |
|
| 834 | + } elseif ( isset( $_POST[$wpvar] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 835 | + $query[$wpvar] = sanitize_text_field( wp_unslash( $_POST[$wpvar] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 836 | + } elseif ( isset( $_GET[$wpvar] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
|
| 837 | + $query[$wpvar] = sanitize_text_field( wp_unslash( $_GET[$wpvar] ) ); // phpcs:ignore WordPress.Security.NonceVerification |
|
| 838 | + } elseif ( isset( $query_vars[$wpvar] ) ) { |
|
| 839 | + $query[$wpvar] = $query_vars[$wpvar]; |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | - if ( ! empty( $query[ $wpvar ] ) ) { |
|
| 843 | - if ( ! is_array( $query[ $wpvar ] ) ) { |
|
| 844 | - $query[ $wpvar ] = (string) $query[ $wpvar ]; |
|
| 842 | + if ( ! empty( $query[$wpvar] ) ) { |
|
| 843 | + if ( ! is_array( $query[$wpvar] ) ) { |
|
| 844 | + $query[$wpvar] = ( string ) $query[$wpvar]; |
|
| 845 | 845 | } else { |
| 846 | - foreach ( $query[ $wpvar ] as $vkey => $v ) { |
|
| 846 | + foreach ( $query[$wpvar] as $vkey => $v ) { |
|
| 847 | 847 | if ( ! is_object( $v ) ) { |
| 848 | - $query[ $wpvar ][ $vkey ] = (string) $v; |
|
| 848 | + $query[$wpvar][$vkey] = ( string ) $v; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | - if ( isset( $post_type_query_vars[ $wpvar ] ) ) { |
|
| 854 | - $query['post_type'] = $post_type_query_vars[ $wpvar ]; |
|
| 855 | - $query['name'] = $query[ $wpvar ]; |
|
| 853 | + if ( isset( $post_type_query_vars[$wpvar] ) ) { |
|
| 854 | + $query['post_type'] = $post_type_query_vars[$wpvar]; |
|
| 855 | + $query['name'] = $query[$wpvar]; |
|
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | 858 | } |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | } else { |
| 910 | 910 | $section['id'] = sanitize_text_field( $section['title'] ); |
| 911 | 911 | } |
| 912 | - $this->boxes[ $key ]['sections'][ $sk ] = $section; |
|
| 912 | + $this->boxes[$key]['sections'][$sk] = $section; |
|
| 913 | 913 | } |
| 914 | 914 | if ( isset( $section['fields'] ) ) { |
| 915 | 915 | foreach ( $section['fields'] as $k => $field ) { |
@@ -919,15 +919,15 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | if ( 'ace_editor' === $field['type'] && isset( $field['options'] ) ) { |
| 922 | - $this->boxes[ $key ]['sections'][ $sk ]['fields'][ $k ]['args'] = $field['options']; |
|
| 923 | - unset( $this->boxes[ $key ]['sections'][ $sk ]['fields'][ $k ]['options'] ); |
|
| 922 | + $this->boxes[$key]['sections'][$sk]['fields'][$k]['args'] = $field['options']; |
|
| 923 | + unset( $this->boxes[$key]['sections'][$sk]['fields'][$k]['options'] ); |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | if ( 'section' === $field['type'] && isset( $field['indent'] ) && ( true === $field['indent'] || 'true' === $field['indent'] ) ) { |
| 927 | 927 | $field['class'] = $field['class'] ?? ''; |
| 928 | 928 | $field['class'] .= 'redux-section-indent-start'; |
| 929 | 929 | |
| 930 | - $this->boxes[ $key ]['sections'][ $sk ]['fields'][ $k ] = $field; |
|
| 930 | + $this->boxes[$key]['sections'][$sk]['fields'][$k] = $field; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | if ( ! isset( $this->parent->options_defaults_class ) ) { |
@@ -949,8 +949,8 @@ discard block |
||
| 949 | 949 | } |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | - if ( empty( $this->meta[ $this->post_id ] ) ) { |
|
| 953 | - $this->meta[ $this->post_id ] = $this->get_meta( $this->post_id ); |
|
| 952 | + if ( empty( $this->meta[$this->post_id] ) ) { |
|
| 953 | + $this->meta[$this->post_id] = $this->get_meta( $this->post_id ); |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | $this->options = $this->parent->options; |
| 1066 | 1066 | |
| 1067 | - if ( isset( $this->parent->options[ $field_id['id'] ] ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) && $this->parent->options[ $field_id['id'] ] !== $this->parent->options_defaults[ $field_id['id'] ] ) { |
|
| 1068 | - return $this->parent->options[ $field_id['id'] ]; |
|
| 1067 | + if ( isset( $this->parent->options[$field_id['id']] ) && isset( $this->parent->options_defaults[$field_id['id']] ) && $this->parent->options[$field_id['id']] !== $this->parent->options_defaults[$field_id['id']] ) { |
|
| 1068 | + return $this->parent->options[$field_id['id']]; |
|
| 1069 | 1069 | } else { |
| 1070 | 1070 | if ( empty( $this->options_defaults ) ) { |
| 1071 | 1071 | $this->default_values(); // fill cache. |
@@ -1073,11 +1073,11 @@ discard block |
||
| 1073 | 1073 | |
| 1074 | 1074 | $data = ''; |
| 1075 | 1075 | if ( ! empty( $this->options_defaults ) ) { |
| 1076 | - $data = $this->options_defaults[ $field_id['id'] ] ?? ''; |
|
| 1076 | + $data = $this->options_defaults[$field_id['id']] ?? ''; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | - if ( empty( $data ) && isset( $this->parent->options_defaults[ $field_id['id'] ] ) ) { |
|
| 1080 | - $data = $this->parent->options_defaults[ $field_id['id'] ] ?? ''; |
|
| 1079 | + if ( empty( $data ) && isset( $this->parent->options_defaults[$field_id['id']] ) ) { |
|
| 1080 | + $data = $this->parent->options_defaults[$field_id['id']] ?? ''; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | return $data; |
@@ -1092,8 +1092,8 @@ discard block |
||
| 1092 | 1092 | * @return array |
| 1093 | 1093 | */ |
| 1094 | 1094 | private function get_meta( $id ): array { |
| 1095 | - if ( ! isset( $this->meta[ $id ] ) ) { |
|
| 1096 | - $this->meta[ $id ] = array(); |
|
| 1095 | + if ( ! isset( $this->meta[$id] ) ) { |
|
| 1096 | + $this->meta[$id] = array(); |
|
| 1097 | 1097 | $o_data = get_post_meta( $id ); |
| 1098 | 1098 | |
| 1099 | 1099 | // phpcs:ignore WordPress.NamingConventions.ValidHookName |
@@ -1102,30 +1102,30 @@ discard block |
||
| 1102 | 1102 | if ( ! empty( $o_data ) ) { |
| 1103 | 1103 | foreach ( $o_data as $key => $value ) { |
| 1104 | 1104 | if ( 1 === count( $value ) ) { |
| 1105 | - $this->meta[ $id ][ $key ] = maybe_unserialize( $value[0] ); |
|
| 1105 | + $this->meta[$id][$key] = maybe_unserialize( $value[0] ); |
|
| 1106 | 1106 | } else { |
| 1107 | 1107 | $new_value = array_map( 'maybe_unserialize', $value ); |
| 1108 | 1108 | |
| 1109 | - $this->meta[ $id ][ $key ] = $new_value[0]; |
|
| 1109 | + $this->meta[$id][$key] = $new_value[0]; |
|
| 1110 | 1110 | } |
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | - if ( isset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ) ) { |
|
| 1115 | - $data = maybe_unserialize( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ); |
|
| 1114 | + if ( isset( $this->meta[$id][$this->parent->args['opt_name']] ) ) { |
|
| 1115 | + $data = maybe_unserialize( $this->meta[$id][$this->parent->args['opt_name']] ); |
|
| 1116 | 1116 | |
| 1117 | 1117 | foreach ( $data as $key => $value ) { |
| 1118 | - $this->meta[ $id ][ $key ] = $value; |
|
| 1118 | + $this->meta[$id][$key] = $value; |
|
| 1119 | 1119 | update_post_meta( $id, $key, $value ); |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - unset( $this->meta[ $id ][ $this->parent->args['opt_name'] ] ); |
|
| 1122 | + unset( $this->meta[$id][$this->parent->args['opt_name']] ); |
|
| 1123 | 1123 | |
| 1124 | 1124 | delete_post_meta( $id, $this->parent->args['opt_name'] ); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | - return $this->meta[ $id ]; |
|
| 1128 | + return $this->meta[$id]; |
|
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | /** |
@@ -1141,29 +1141,29 @@ discard block |
||
| 1141 | 1141 | |
| 1142 | 1142 | // Override these values if they differ from the admin panel defaults. ;) . |
| 1143 | 1143 | if ( isset( $the_post->post_type ) && in_array( $the_post->post_type, $this->post_types, true ) ) { |
| 1144 | - if ( isset( $this->post_type_values[ $the_post->post_type ] ) ) { |
|
| 1145 | - $meta = $this->post_type_fields[ $the_post->post_type ]; |
|
| 1144 | + if ( isset( $this->post_type_values[$the_post->post_type] ) ) { |
|
| 1145 | + $meta = $this->post_type_fields[$the_post->post_type]; |
|
| 1146 | 1146 | } else { |
| 1147 | 1147 | $defaults = array(); |
| 1148 | - if ( ! empty( $this->post_type_fields[ $the_post->post_type ] ) ) { |
|
| 1149 | - foreach ( $this->post_type_fields[ $the_post->post_type ] as $key => $null ) { |
|
| 1150 | - if ( isset( $this->options_defaults[ $key ] ) ) { |
|
| 1151 | - $defaults[ $key ] = $this->options_defaults[ $key ]; |
|
| 1148 | + if ( ! empty( $this->post_type_fields[$the_post->post_type] ) ) { |
|
| 1149 | + foreach ( $this->post_type_fields[$the_post->post_type] as $key => $null ) { |
|
| 1150 | + if ( isset( $this->options_defaults[$key] ) ) { |
|
| 1151 | + $defaults[$key] = $this->options_defaults[$key]; |
|
| 1152 | 1152 | } |
| 1153 | 1153 | } |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | $meta = wp_parse_args( $this->get_meta( $the_post->ID ), $defaults ); |
| 1157 | 1157 | |
| 1158 | - $this->post_type_fields[ $the_post->post_type ] = $meta; |
|
| 1158 | + $this->post_type_fields[$the_post->post_type] = $meta; |
|
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | if ( ! empty( $meta_key ) ) { |
| 1162 | - if ( ! isset( $meta[ $meta_key ] ) ) { |
|
| 1163 | - $meta[ $meta_key ] = $def_val; |
|
| 1162 | + if ( ! isset( $meta[$meta_key] ) ) { |
|
| 1163 | + $meta[$meta_key] = $def_val; |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | - return $meta[ $meta_key ]; |
|
| 1166 | + return $meta[$meta_key]; |
|
| 1167 | 1167 | } else { |
| 1168 | 1168 | return $meta; |
| 1169 | 1169 | } |
@@ -1314,11 +1314,11 @@ discard block |
||
| 1314 | 1314 | $field['class'] .= 'redux-section-indent-start'; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | - if ( ! isset( $this->meta[ $this->post_id ][ $field['id'] ] ) ) { |
|
| 1318 | - $this->meta[ $this->post_id ][ $field['id'] ] = ''; |
|
| 1317 | + if ( ! isset( $this->meta[$this->post_id][$field['id']] ) ) { |
|
| 1318 | + $this->meta[$this->post_id][$field['id']] = ''; |
|
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | - $this->parent->render_class->field_input( $field, $this->meta[ $this->post_id ][ $field['id'] ], true ); |
|
| 1321 | + $this->parent->render_class->field_input( $field, $this->meta[$this->post_id][$field['id']], true ); |
|
| 1322 | 1322 | echo '</td></tr>'; |
| 1323 | 1323 | } |
| 1324 | 1324 | echo '</tbody></table>'; |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | // Check if our nonce is set. |
| 1356 | - if ( ! isset( $_POST['redux_metaboxes_meta_nonce'] ) || ! isset( $_POST[ $this->parent->args['opt_name'] ] ) ) { |
|
| 1356 | + if ( ! isset( $_POST['redux_metaboxes_meta_nonce'] ) || ! isset( $_POST[$this->parent->args['opt_name']] ) ) { |
|
| 1357 | 1357 | return $post_id; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
@@ -1375,17 +1375,17 @@ discard block |
||
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | 1377 | // Import. |
| 1378 | - if ( isset( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ) && ! empty( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ) ) { |
|
| 1379 | - $import = json_decode( sanitize_text_field( wp_unslash( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ) ), true ); |
|
| 1380 | - unset( $_POST[ $this->parent->args['opt_name'] ]['import_code'] ); |
|
| 1378 | + if ( isset( $_POST[$this->parent->args['opt_name']]['import_code'] ) && ! empty( $_POST[$this->parent->args['opt_name']]['import_code'] ) ) { |
|
| 1379 | + $import = json_decode( sanitize_text_field( wp_unslash( $_POST[$this->parent->args['opt_name']]['import_code'] ) ), true ); |
|
| 1380 | + unset( $_POST[$this->parent->args['opt_name']]['import_code'] ); |
|
| 1381 | 1381 | |
| 1382 | - foreach ( Redux_Helpers::sanitize_array( wp_unslash( $_POST[ $this->parent->args['opt_name'] ] ) ) as $key => $value ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput |
|
| 1383 | - if ( ! isset( $import[ $key ] ) ) { |
|
| 1384 | - $import[ $key ] = $value; |
|
| 1382 | + foreach ( Redux_Helpers::sanitize_array( wp_unslash( $_POST[$this->parent->args['opt_name']] ) ) as $key => $value ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput |
|
| 1383 | + if ( ! isset( $import[$key] ) ) { |
|
| 1384 | + $import[$key] = $value; |
|
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | - $_POST[ $this->parent->args['opt_name'] ] = $import; |
|
| 1388 | + $_POST[$this->parent->args['opt_name']] = $import; |
|
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | $to_save = array(); |
@@ -1397,13 +1397,13 @@ discard block |
||
| 1397 | 1397 | $dont_save = false; |
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | - foreach ( Redux_Helpers::sanitize_array( wp_unslash( $_POST[ $this->parent->args['opt_name'] ] ) ) as $key => $value ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput |
|
| 1400 | + foreach ( Redux_Helpers::sanitize_array( wp_unslash( $_POST[$this->parent->args['opt_name']] ) ) as $key => $value ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput |
|
| 1401 | 1401 | |
| 1402 | 1402 | // Have to remove the escaping for array comparison. |
| 1403 | 1403 | if ( is_array( $value ) ) { |
| 1404 | 1404 | foreach ( $value as $k => $v ) { |
| 1405 | 1405 | if ( ! is_array( $v ) ) { |
| 1406 | - $value[ $k ] = wp_unslash( $v ); |
|
| 1406 | + $value[$k] = wp_unslash( $v ); |
|
| 1407 | 1407 | } |
| 1408 | 1408 | } |
| 1409 | 1409 | } |
@@ -1411,19 +1411,19 @@ discard block |
||
| 1411 | 1411 | $save = true; |
| 1412 | 1412 | |
| 1413 | 1413 | // parent_options. |
| 1414 | - if ( ! $dont_save && isset( $this->options_defaults[ $key ] ) && $value === $this->options_defaults[ $key ] ) { |
|
| 1414 | + if ( ! $dont_save && isset( $this->options_defaults[$key] ) && $value === $this->options_defaults[$key] ) { |
|
| 1415 | 1415 | $save = false; |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if ( $save && isset( $this->parent_options[ $key ] ) && $this->parent_options[ $key ] !== $value ) { |
|
| 1418 | + if ( $save && isset( $this->parent_options[$key] ) && $this->parent_options[$key] !== $value ) { |
|
| 1419 | 1419 | $save = false; |
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | 1422 | if ( $save ) { |
| 1423 | - $to_save[ $key ] = $value; |
|
| 1424 | - $to_compare[ $key ] = $this->parent->options[ $key ] ?? ''; |
|
| 1423 | + $to_save[$key] = $value; |
|
| 1424 | + $to_compare[$key] = $this->parent->options[$key] ?? ''; |
|
| 1425 | 1425 | } else { |
| 1426 | - $to_delete[ $key ] = $value; |
|
| 1426 | + $to_delete[$key] = $value; |
|
| 1427 | 1427 | } |
| 1428 | 1428 | } |
| 1429 | 1429 | |
@@ -1434,11 +1434,11 @@ discard block |
||
| 1434 | 1434 | |
| 1435 | 1435 | // Validate fields (if needed). |
| 1436 | 1436 | foreach ( $to_save as $key => $value ) { |
| 1437 | - if ( isset( $validate[ $key ] ) && $value !== $validate[ $key ] ) { |
|
| 1438 | - if ( isset( $this->parent->options[ $key ] ) && $validate[ $key ] === $this->parent->options[ $key ] ) { |
|
| 1439 | - unset( $to_save[ $key ] ); |
|
| 1437 | + if ( isset( $validate[$key] ) && $value !== $validate[$key] ) { |
|
| 1438 | + if ( isset( $this->parent->options[$key] ) && $validate[$key] === $this->parent->options[$key] ) { |
|
| 1439 | + unset( $to_save[$key] ); |
|
| 1440 | 1440 | } else { |
| 1441 | - $to_save[ $key ] = $validate[ $key ]; |
|
| 1441 | + $to_save[$key] = $validate[$key]; |
|
| 1442 | 1442 | } |
| 1443 | 1443 | } |
| 1444 | 1444 | } |
@@ -1463,28 +1463,28 @@ discard block |
||
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | if ( isset( $_POST['post_type'] ) ) { |
| 1466 | - $check = $this->post_type_fields[ sanitize_text_field( wp_unslash( $_POST['post_type'] ) ) ]; |
|
| 1466 | + $check = $this->post_type_fields[sanitize_text_field( wp_unslash( $_POST['post_type'] ) )]; |
|
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | // phpcs:ignore WordPress.NamingConventions.ValidHookName |
| 1470 | 1470 | $to_save = apply_filters( 'redux/metaboxes/save', $to_save, $to_compare, $this->sections ); |
| 1471 | 1471 | |
| 1472 | 1472 | foreach ( $to_save as $key => $value ) { |
| 1473 | - $prev_value = $this->meta[ $post_id ][ $key ] ?? ''; |
|
| 1473 | + $prev_value = $this->meta[$post_id][$key] ?? ''; |
|
| 1474 | 1474 | |
| 1475 | - if ( isset( $check[ $key ] ) ) { |
|
| 1476 | - unset( $check[ $key ] ); |
|
| 1475 | + if ( isset( $check[$key] ) ) { |
|
| 1476 | + unset( $check[$key] ); |
|
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | 1479 | update_post_meta( $post_id, $key, $value, $prev_value ); |
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | foreach ( $to_delete as $key => $value ) { |
| 1483 | - if ( isset( $check[ $key ] ) ) { |
|
| 1484 | - unset( $check[ $key ] ); |
|
| 1483 | + if ( isset( $check[$key] ) ) { |
|
| 1484 | + unset( $check[$key] ); |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | - $prev_value = $this->meta[ $post_id ][ $key ] ?? ''; |
|
| 1487 | + $prev_value = $this->meta[$post_id][$key] ?? ''; |
|
| 1488 | 1488 | delete_post_meta( $post_id, $key, $prev_value ); |
| 1489 | 1489 | } |
| 1490 | 1490 | |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | foreach ( $sections as $key => $section ) { |
| 77 | 77 | if ( 'fields' === $key ) { |
| 78 | 78 | foreach ( $section as $field ) { |
| 79 | - if ( ! empty( $field['id'] ) && ! empty( $field['data'] ) && ! empty( $options_values[ $field['id'] ] ) && Redux_Helpers::is_integer( $options_values[ $field['id'] ] ) ) { |
|
| 79 | + if ( ! empty( $field['id'] ) && ! empty( $field['data'] ) && ! empty( $options_values[$field['id']] ) && Redux_Helpers::is_integer( $options_values[$field['id']] ) ) { |
|
| 80 | 80 | //phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Third party hook. Cannot change. |
| 81 | - $options_values[ $field['id'] ] = apply_filters( 'wpml_object_id', $options_values[ $field['id'] ], $field['data'], true ); |
|
| 81 | + $options_values[$field['id']] = apply_filters( 'wpml_object_id', $options_values[$field['id']], $field['data'], true ); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } elseif ( is_array( $section ) && ! empty( $section ) ) { |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | // Store the changed values in the transient. |
| 194 | 194 | if ( $value !== $core->options ) { |
| 195 | 195 | foreach ( $value as $k => $v ) { |
| 196 | - if ( ! isset( $core->options[ $k ] ) ) { |
|
| 197 | - $core->options[ $k ] = ''; |
|
| 198 | - } elseif ( $v === $core->options[ $k ] ) { |
|
| 199 | - unset( $core->options[ $k ] ); |
|
| 196 | + if ( ! isset( $core->options[$k] ) ) { |
|
| 197 | + $core->options[$k] = ''; |
|
| 198 | + } elseif ( $v === $core->options[$k] ) { |
|
| 199 | + unset( $core->options[$k] ); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | |
| 234 | 234 | // phpcs:ignore WordPress.NamingConventions.ValidHookName, WordPress.NamingConventions.PrefixAllGlobals -- Misflag, variable begins with plugin name. |
| 235 | - $GLOBALS[ $redux_options_global ] = apply_filters( "redux/options/{$core->args['opt_name']}/global_variable", $core->options ); |
|
| 235 | + $GLOBALS[$redux_options_global] = apply_filters( "redux/options/{$core->args['opt_name']}/global_variable", $core->options ); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if ( empty( $section ) ) { |
| 299 | - unset( $core->sections[ $k ] ); |
|
| 299 | + unset( $core->sections[$k] ); |
|
| 300 | 300 | continue; |
| 301 | 301 | } |
| 302 | 302 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | if ( isset( $section['customizer_only'] ) && true === $section['customizer_only'] ) { |
| 308 | 308 | $section['panel'] = false; |
| 309 | - $core->sections[ $k ] = $section; |
|
| 309 | + $core->sections[$k] = $section; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $heading = $section['heading'] ?? $section['title']; |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | if ( ! in_array( $field_type, array( 'section', 'divide', 'info', 'raw' ), true ) ) { |
| 322 | 322 | $field_id = $field_data['id']; |
| 323 | - $default = $core->options_defaults[ $field_id ] ?? ''; |
|
| 324 | - $data = $core->options[ $field_id ] ?? $default; |
|
| 323 | + $default = $core->options_defaults[$field_id] ?? ''; |
|
| 324 | + $data = $core->options[$field_id] ?? $default; |
|
| 325 | 325 | |
| 326 | - $this->hidden_perm_fields[ $field_id ] = $data; |
|
| 326 | + $this->hidden_perm_fields[$field_id] = $data; |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if ( ! $display || ! function_exists( 'add_settings_section' ) ) { |
| 335 | - $this->no_panel_section[ $k ] = $section; |
|
| 335 | + $this->no_panel_section[$k] = $section; |
|
| 336 | 336 | } else { |
| 337 | 337 | add_settings_section( |
| 338 | 338 | $core->args['opt_name'] . $k . '_section', |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | $field['type'] = 'raw'; |
| 357 | 357 | $field['content'] = $field['desc']; |
| 358 | 358 | $field['desc'] = ''; |
| 359 | - $core->sections[ $k ]['fields'][ $fieldk ] = $field; |
|
| 359 | + $core->sections[$k]['fields'][$fieldk] = $field; |
|
| 360 | 360 | } elseif ( 'info' === $field['type'] ) { |
| 361 | 361 | if ( ! isset( $field['full_width'] ) ) { |
| 362 | 362 | $field['full_width'] = true; |
| 363 | - $core->sections[ $k ]['fields'][ $fieldk ] = $field; |
|
| 363 | + $core->sections[$k]['fields'][$fieldk] = $field; |
|
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | } elseif ( ! isset( $field['full_width'] ) ) { |
| 372 | 372 | $field['full_width'] = true; |
| 373 | 373 | } |
| 374 | - $core->sections[ $k ]['fields'][ $fieldk ] = $field; |
|
| 374 | + $core->sections[$k]['fields'][$fieldk] = $field; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | // phpcs:ignore WordPress.NamingConventions.ValidHookName |
| 384 | 384 | $field = apply_filters( "redux/options/{$core->args['opt_name']}/field/{$field['id']}/register", $field ); |
| 385 | 385 | |
| 386 | - $core->field_types[ $field['type'] ] = $core->field_types[ $field['type'] ] ?? array(); |
|
| 386 | + $core->field_types[$field['type']] = $core->field_types[$field['type']] ?? array(); |
|
| 387 | 387 | |
| 388 | - $core->field_sections[ $field['type'] ][ $field['id'] ] = $k; |
|
| 388 | + $core->field_sections[$field['type']][$field['id']] = $k; |
|
| 389 | 389 | |
| 390 | 390 | $display = true; |
| 391 | 391 | |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | if ( isset( $section['customizer'] ) ) { |
| 402 | 402 | $field['customizer'] = $section['customizer']; |
| 403 | - $core->sections[ $k ]['fields'][ $fieldk ] = $field; |
|
| 403 | + $core->sections[$k]['fields'][$fieldk] = $field; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | if ( isset( $field['permissions'] ) && false !== $field['permissions'] ) { |
| 407 | 407 | if ( ! Redux_Helpers::current_user_can( $field['permissions'] ) ) { |
| 408 | - $data = $core->options[ $field['id'] ] ?? $core->options_defaults[ $field['id'] ]; |
|
| 408 | + $data = $core->options[$field['id']] ?? $core->options_defaults[$field['id']]; |
|
| 409 | 409 | |
| 410 | - $this->hidden_perm_fields[ $field['id'] ] = $data; |
|
| 410 | + $this->hidden_perm_fields[$field['id']] = $data; |
|
| 411 | 411 | |
| 412 | 412 | continue; |
| 413 | 413 | } |
@@ -441,79 +441,79 @@ discard block |
||
| 441 | 441 | $field['name'] = $core->args['opt_name'] . '[' . $field['id'] . ']'; |
| 442 | 442 | |
| 443 | 443 | // Set the default value if present. |
| 444 | - $core->options_defaults[ $field['id'] ] = $core->options_defaults[ $field['id'] ] ?? ''; |
|
| 444 | + $core->options_defaults[$field['id']] = $core->options_defaults[$field['id']] ?? ''; |
|
| 445 | 445 | |
| 446 | 446 | // Set the defaults to the value if not present. |
| 447 | 447 | $do_update = false; |
| 448 | 448 | |
| 449 | 449 | // Check fields for values in the default parameter. |
| 450 | - if ( ! isset( $core->options[ $field['id'] ] ) && isset( $field['default'] ) ) { |
|
| 451 | - $core->options_defaults[ $field['id'] ] = $field['default']; |
|
| 452 | - $core->options[ $field['id'] ] = $field['default']; |
|
| 450 | + if ( ! isset( $core->options[$field['id']] ) && isset( $field['default'] ) ) { |
|
| 451 | + $core->options_defaults[$field['id']] = $field['default']; |
|
| 452 | + $core->options[$field['id']] = $field['default']; |
|
| 453 | 453 | $do_update = true; |
| 454 | 454 | |
| 455 | 455 | // Check fields that hae no default value, but an option value with settings to |
| 456 | 456 | // be saved by default. |
| 457 | - } elseif ( ! isset( $core->options[ $field['id'] ] ) && isset( $field['options'] ) ) { |
|
| 457 | + } elseif ( ! isset( $core->options[$field['id']] ) && isset( $field['options'] ) ) { |
|
| 458 | 458 | |
| 459 | 459 | // If a sorter field, check for options and save them as defaults. |
| 460 | 460 | if ( 'sorter' === $field['type'] || 'sortable' === $field['type'] ) { |
| 461 | - $core->options_defaults[ $field['id'] ] = $field['options']; |
|
| 462 | - $core->options[ $field['id'] ] = $field['options']; |
|
| 461 | + $core->options_defaults[$field['id']] = $field['options']; |
|
| 462 | + $core->options[$field['id']] = $field['options']; |
|
| 463 | 463 | $do_update = true; |
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | // CORRECT URLS if media URLs are wrong, but attachment IDs are present. |
| 468 | 468 | if ( 'media' === $field['type'] ) { |
| 469 | - if ( isset( $core->options[ $field['id'] ]['id'] ) && isset( $core->options[ $field['id'] ]['url'] ) && ! empty( $core->options[ $field['id'] ]['url'] ) && strpos( $core->options[ $field['id'] ]['url'], str_replace( 'https://', '', WP_CONTENT_URL ) ) === false ) { |
|
| 470 | - $data = wp_get_attachment_url( $core->options[ $field['id'] ]['id'] ); |
|
| 469 | + if ( isset( $core->options[$field['id']]['id'] ) && isset( $core->options[$field['id']]['url'] ) && ! empty( $core->options[$field['id']]['url'] ) && strpos( $core->options[$field['id']]['url'], str_replace( 'https://', '', WP_CONTENT_URL ) ) === false ) { |
|
| 470 | + $data = wp_get_attachment_url( $core->options[$field['id']]['id'] ); |
|
| 471 | 471 | |
| 472 | 472 | if ( isset( $data ) && ! empty( $data ) ) { |
| 473 | - $core->options[ $field['id'] ]['url'] = $data; |
|
| 473 | + $core->options[$field['id']]['url'] = $data; |
|
| 474 | 474 | |
| 475 | 475 | $data = wp_get_attachment_image_src( |
| 476 | - $core->options[ $field['id'] ]['id'], |
|
| 476 | + $core->options[$field['id']]['id'], |
|
| 477 | 477 | array( |
| 478 | 478 | 150, |
| 479 | 479 | 150, |
| 480 | 480 | ) |
| 481 | 481 | ); |
| 482 | 482 | |
| 483 | - $core->options[ $field['id'] ]['thumbnail'] = $data[0]; |
|
| 483 | + $core->options[$field['id']]['thumbnail'] = $data[0]; |
|
| 484 | 484 | $do_update = true; |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | if ( 'background' === $field['type'] ) { |
| 490 | - if ( isset( $core->options[ $field['id'] ]['media']['id'] ) && isset( $core->options[ $field['id'] ]['background-image'] ) && ! empty( $core->options[ $field['id'] ]['background-image'] ) && strpos( $core->options[ $field['id'] ]['background-image'], str_replace( array( 'https://', 'https://' ), '', WP_CONTENT_URL ) ) === false ) { |
|
| 491 | - $data = wp_get_attachment_url( $core->options[ $field['id'] ]['media']['id'] ); |
|
| 490 | + if ( isset( $core->options[$field['id']]['media']['id'] ) && isset( $core->options[$field['id']]['background-image'] ) && ! empty( $core->options[$field['id']]['background-image'] ) && strpos( $core->options[$field['id']]['background-image'], str_replace( array( 'https://', 'https://' ), '', WP_CONTENT_URL ) ) === false ) { |
|
| 491 | + $data = wp_get_attachment_url( $core->options[$field['id']]['media']['id'] ); |
|
| 492 | 492 | |
| 493 | 493 | if ( isset( $data ) && ! empty( $data ) ) { |
| 494 | - $core->options[ $field['id'] ]['background-image'] = $data; |
|
| 494 | + $core->options[$field['id']]['background-image'] = $data; |
|
| 495 | 495 | |
| 496 | 496 | $data = wp_get_attachment_image_src( |
| 497 | - $core->options[ $field['id'] ]['media']['id'], |
|
| 497 | + $core->options[$field['id']]['media']['id'], |
|
| 498 | 498 | array( |
| 499 | 499 | 150, |
| 500 | 500 | 150, |
| 501 | 501 | ) |
| 502 | 502 | ); |
| 503 | 503 | |
| 504 | - $core->options[ $field['id'] ]['media']['thumbnail'] = $data[0]; |
|
| 504 | + $core->options[$field['id']]['media']['thumbnail'] = $data[0]; |
|
| 505 | 505 | $do_update = true; |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | if ( 'slides' === $field['type'] ) { |
| 511 | - if ( isset( $core->options[ $field['id'] ] ) && is_array( $core->options[ $field['id'] ] ) && isset( $core->options[ $field['id'] ][0]['attachment_id'] ) && isset( $core->options[ $field['id'] ][0]['image'] ) && ! empty( $core->options[ $field['id'] ][0]['image'] ) && strpos( $core->options[ $field['id'] ][0]['image'], str_replace( array( 'https://', 'https://' ), '', WP_CONTENT_URL ) ) === false ) { |
|
| 512 | - foreach ( $core->options[ $field['id'] ] as $key => $val ) { |
|
| 511 | + if ( isset( $core->options[$field['id']] ) && is_array( $core->options[$field['id']] ) && isset( $core->options[$field['id']][0]['attachment_id'] ) && isset( $core->options[$field['id']][0]['image'] ) && ! empty( $core->options[$field['id']][0]['image'] ) && strpos( $core->options[$field['id']][0]['image'], str_replace( array( 'https://', 'https://' ), '', WP_CONTENT_URL ) ) === false ) { |
|
| 512 | + foreach ( $core->options[$field['id']] as $key => $val ) { |
|
| 513 | 513 | $data = wp_get_attachment_url( $val['attachment_id'] ); |
| 514 | 514 | |
| 515 | 515 | if ( isset( $data ) && ! empty( $data ) ) { |
| 516 | - $core->options[ $field['id'] ][ $key ]['image'] = $data; |
|
| 516 | + $core->options[$field['id']][$key]['image'] = $data; |
|
| 517 | 517 | |
| 518 | 518 | $data = wp_get_attachment_image_src( |
| 519 | 519 | $val['attachment_id'], |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | ) |
| 524 | 524 | ); |
| 525 | 525 | |
| 526 | - $core->options[ $field['id'] ][ $key ]['thumb'] = $data[0]; |
|
| 526 | + $core->options[$field['id']][$key]['thumb'] = $data[0]; |
|
| 527 | 527 | $do_update = true; |
| 528 | 528 | } |
| 529 | 529 | } |
@@ -550,21 +550,21 @@ discard block |
||
| 550 | 550 | $field = apply_filters( "redux/options/{$core->args['opt_name']}/field/{$field['id']}", $field ); |
| 551 | 551 | |
| 552 | 552 | if ( empty( $field ) ) { |
| 553 | - unset( $core->sections[ $k ]['fields'][ $fieldk ] ); |
|
| 553 | + unset( $core->sections[$k]['fields'][$fieldk] ); |
|
| 554 | 554 | continue; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - if ( ! empty( Redux_Core::$folds[ $field['id'] ]['parent'] ) ) { // This has some fold items, hide it by default. |
|
| 557 | + if ( ! empty( Redux_Core::$folds[$field['id']]['parent'] ) ) { // This has some fold items, hide it by default. |
|
| 558 | 558 | $field['class'] .= ' fold'; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if ( ! empty( Redux_Core::$folds[ $field['id'] ]['children'] ) ) { // Sets the values you shoe fold children on. |
|
| 561 | + if ( ! empty( Redux_Core::$folds[$field['id']]['children'] ) ) { // Sets the values you shoe fold children on. |
|
| 562 | 562 | $field['class'] .= ' fold-parent'; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | if ( ! empty( $field['compiler'] ) ) { |
| 566 | 566 | $field['class'] .= ' compiler'; |
| 567 | - $core->compiler_fields[ $field['id'] ] = 1; |
|
| 567 | + $core->compiler_fields[$field['id']] = 1; |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | if ( isset( $field['unit'] ) && ! isset( $field['units'] ) ) { |
@@ -572,11 +572,11 @@ discard block |
||
| 572 | 572 | unset( $field['unit'] ); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $core->sections[ $k ]['fields'][ $fieldk ] = $field; |
|
| 575 | + $core->sections[$k]['fields'][$fieldk] = $field; |
|
| 576 | 576 | |
| 577 | 577 | if ( isset( $core->args['display_source'] ) ) { |
| 578 | 578 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions |
| 579 | - $th .= '<div id="' . $field['id'] . '-settings" style="display:none;"><pre>' . var_export( $core->sections[ $k ]['fields'][ $fieldk ], true ) . '</pre></div>'; |
|
| 579 | + $th .= '<div id="' . $field['id'] . '-settings" style="display:none;"><pre>' . var_export( $core->sections[$k]['fields'][$fieldk], true ) . '</pre></div>'; |
|
| 580 | 580 | $th .= '<br /><a href="#TB_inline?width=600&height=800&inlineId=' . $field['id'] . '-settings" class="thickbox"><small>View Source</small></a>'; |
| 581 | 581 | } |
| 582 | 582 | |
@@ -588,9 +588,9 @@ discard block |
||
| 588 | 588 | do_action( "redux/options/{$core->args['opt_name']}/field/{$field['type']}/register", $field ); |
| 589 | 589 | |
| 590 | 590 | $core->required_class->check_dependencies( $field ); |
| 591 | - $core->field_head[ $field['id'] ] = $th; |
|
| 591 | + $core->field_head[$field['id']] = $th; |
|
| 592 | 592 | |
| 593 | - if ( ! $display || isset( $this->no_panel_section[ $k ] ) ) { |
|
| 593 | + if ( ! $display || isset( $this->no_panel_section[$k] ) ) { |
|
| 594 | 594 | $this->no_panel[] = $field['id']; |
| 595 | 595 | } else { |
| 596 | 596 | if ( isset( $field['disabled'] ) && $field['disabled'] ) { |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | if ( isset( $plugin_options['redux-no_panel'] ) ) { |
| 724 | 724 | $keys = explode( '|', $plugin_options['redux-no_panel'] ); |
| 725 | 725 | foreach ( $keys as $key ) { |
| 726 | - $plugin_options[ $key ] = $core->options[ $key ]; |
|
| 726 | + $plugin_options[$key] = $core->options[$key]; |
|
| 727 | 727 | } |
| 728 | 728 | if ( isset( $plugin_options['redux-no_panel'] ) ) { |
| 729 | 729 | unset( $plugin_options['redux-no_panel'] ); |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | if ( is_array( $this->hidden_perm_fields ) && ! empty( $this->hidden_perm_fields ) ) { |
| 734 | 734 | foreach ( $this->hidden_perm_fields as $id => $data ) { |
| 735 | - $plugin_options[ $id ] = $data; |
|
| 735 | + $plugin_options[$id] = $data; |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
@@ -760,9 +760,9 @@ discard block |
||
| 760 | 760 | if ( is_array( $imported_options ) && ! empty( $imported_options ) && isset( $imported_options['redux-backup'] ) && ( 1 === $imported_options['redux-backup'] || '1' === $imported_options['redux-backup'] ) ) { |
| 761 | 761 | $core->transients['changed_values'] = array(); |
| 762 | 762 | foreach ( $plugin_options as $key => $value ) { |
| 763 | - if ( isset( $imported_options[ $key ] ) && $value !== $imported_options[ $key ] ) { |
|
| 764 | - $plugin_options[ $key ] = $value; |
|
| 765 | - $core->transients['changed_values'][ $key ] = $value; |
|
| 763 | + if ( isset( $imported_options[$key] ) && $value !== $imported_options[$key] ) { |
|
| 764 | + $plugin_options[$key] = $value; |
|
| 765 | + $core->transients['changed_values'][$key] = $value; |
|
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | ); |
| 784 | 784 | |
| 785 | 785 | setcookie( 'redux_current_tab_' . $core->args['opt_name'], '', 1, '/', $time + 1000, '/' ); |
| 786 | - $_COOKIE[ 'redux_current_tab_' . $core->args['opt_name'] ] = 1; |
|
| 786 | + $_COOKIE['redux_current_tab_' . $core->args['opt_name']] = 1; |
|
| 787 | 787 | |
| 788 | 788 | unset( $plugin_options['defaults'], $plugin_options['compiler'], $plugin_options['import'], $plugin_options['import_code'] ); |
| 789 | 789 | if ( in_array( $core->args['database'], array( 'transient', 'theme_mods', 'theme_mods_expanded', 'network' ), true ) ) { |
@@ -821,8 +821,8 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | foreach ( $core->options as $key => $value ) { |
| 824 | - if ( isset( $plugin_options[ $key ] ) && $plugin_options[ $key ] !== $value ) { |
|
| 825 | - $core->transients['changed_values'][ $key ] = $value; |
|
| 824 | + if ( isset( $plugin_options[$key] ) && $plugin_options[$key] !== $value ) { |
|
| 825 | + $core->transients['changed_values'][$key] = $value; |
|
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | |
@@ -836,21 +836,21 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | // Section reset to default. |
| 838 | 838 | if ( ! empty( $plugin_options['defaults-section'] ) ) { |
| 839 | - if ( isset( $plugin_options['redux-section'] ) && isset( $core->sections[ $plugin_options['redux-section'] ]['fields'] ) ) { |
|
| 839 | + if ( isset( $plugin_options['redux-section'] ) && isset( $core->sections[$plugin_options['redux-section']]['fields'] ) ) { |
|
| 840 | 840 | if ( empty( $core->options_defaults ) ) { |
| 841 | 841 | $core->options_defaults = $core->_default_values(); |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | - foreach ( $core->sections[ $plugin_options['redux-section'] ]['fields'] as $field ) { |
|
| 844 | + foreach ( $core->sections[$plugin_options['redux-section']]['fields'] as $field ) { |
|
| 845 | 845 | if ( 'tabbed' === $field['type'] ) { |
| 846 | 846 | if ( ! empty( $field['tabs'] ) ) { |
| 847 | 847 | foreach ( $field['tabs'] as $val ) { |
| 848 | 848 | if ( ! empty( $val['fields'] ) ) { |
| 849 | 849 | foreach ( $val['fields'] as $f ) { |
| 850 | - if ( isset( $core->options_defaults[ $f['id'] ] ) ) { |
|
| 851 | - $plugin_options[ $f['id'] ] = $core->options_defaults[ $f['id'] ]; |
|
| 850 | + if ( isset( $core->options_defaults[$f['id']] ) ) { |
|
| 851 | + $plugin_options[$f['id']] = $core->options_defaults[$f['id']]; |
|
| 852 | 852 | } else { |
| 853 | - $plugin_options[ $f['id'] ] = ''; |
|
| 853 | + $plugin_options[$f['id']] = ''; |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | } |
@@ -859,18 +859,18 @@ discard block |
||
| 859 | 859 | } elseif ( 'repeater' === $field['type'] ) { |
| 860 | 860 | if ( ! empty( $field['fields'] ) ) { |
| 861 | 861 | foreach ( $field['fields'] as $f ) { |
| 862 | - if ( isset( $core->options_defaults[ $f['id'] ] ) ) { |
|
| 863 | - $plugin_options[ $f['id'] ] = $core->options_defaults[ $f['id'] ]; |
|
| 862 | + if ( isset( $core->options_defaults[$f['id']] ) ) { |
|
| 863 | + $plugin_options[$f['id']] = $core->options_defaults[$f['id']]; |
|
| 864 | 864 | } else { |
| 865 | - $plugin_options[ $f['id'] ] = ''; |
|
| 865 | + $plugin_options[$f['id']] = ''; |
|
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | } else { |
| 870 | - if ( isset( $core->options_defaults[ $field['id'] ] ) ) { |
|
| 871 | - $plugin_options[ $field['id'] ] = $core->options_defaults[ $field['id'] ]; |
|
| 870 | + if ( isset( $core->options_defaults[$field['id']] ) ) { |
|
| 871 | + $plugin_options[$field['id']] = $core->options_defaults[$field['id']]; |
|
| 872 | 872 | } else { |
| 873 | - $plugin_options[ $field['id'] ] = ''; |
|
| 873 | + $plugin_options[$field['id']] = ''; |
|
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
@@ -892,8 +892,8 @@ discard block |
||
| 892 | 892 | $core->transients['changed_values'] = array(); |
| 893 | 893 | |
| 894 | 894 | foreach ( $core->options as $key => $value ) { |
| 895 | - if ( isset( $plugin_options[ $key ] ) && $plugin_options[ $key ] !== $value ) { |
|
| 896 | - $core->transients['changed_values'][ $key ] = $value; |
|
| 895 | + if ( isset( $plugin_options[$key] ) && $plugin_options[$key] !== $value ) { |
|
| 896 | + $core->transients['changed_values'][$key] = $value; |
|
| 897 | 897 | } |
| 898 | 898 | } |
| 899 | 899 | |
@@ -967,8 +967,8 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | if ( ! empty( $core->options ) ) { |
| 969 | 969 | foreach ( $core->options as $key => $value ) { |
| 970 | - if ( isset( $plugin_options[ $key ] ) && $plugin_options[ $key ] !== $value ) { |
|
| 971 | - $core->transients['changed_values'][ $key ] = $value; |
|
| 970 | + if ( isset( $plugin_options[$key] ) && $plugin_options[$key] !== $value ) { |
|
| 971 | + $core->transients['changed_values'][$key] = $value; |
|
| 972 | 972 | } |
| 973 | 973 | } |
| 974 | 974 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | $this->default_values(); // fill cache. |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | - return array_key_exists( $opt_name, $this->options_defaults ) ? $this->options_defaults[ $opt_name ] : $defaults; |
|
| 1011 | + return array_key_exists( $opt_name, $this->options_defaults ) ? $this->options_defaults[$opt_name] : $defaults; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | return ''; |
@@ -1032,11 +1032,11 @@ discard block |
||
| 1032 | 1032 | $defaults = $this->options_defaults; |
| 1033 | 1033 | $value = ''; |
| 1034 | 1034 | |
| 1035 | - if ( isset( $defaults[ $key ] ) ) { |
|
| 1036 | - if ( false !== $array_key && isset( $defaults[ $key ][ $array_key ] ) ) { |
|
| 1037 | - $value = $defaults[ $key ][ $array_key ]; |
|
| 1035 | + if ( isset( $defaults[$key] ) ) { |
|
| 1036 | + if ( false !== $array_key && isset( $defaults[$key][$array_key] ) ) { |
|
| 1037 | + $value = $defaults[$key][$array_key]; |
|
| 1038 | 1038 | } else { |
| 1039 | - $value = $defaults[ $key ]; |
|
| 1039 | + $value = $defaults[$key]; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| 1042 | 1042 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $current_data_args_key = md5( maybe_serialize( $current_data_args ) ); |
| 94 | 94 | |
| 95 | 95 | // Check to make sure we haven't already run this call before. |
| 96 | - $current_data = $this->wp_data[ $type . $current_data_args_key ] ?? $this->get_data( $type, $current_data_args, $current_value ); |
|
| 96 | + $current_data = $this->wp_data[$type . $current_data_args_key] ?? $this->get_data( $type, $current_data_args, $current_value ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // If ajax is enabled AND $current_data is empty, set a dummy value for the init. |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | $args_key = md5( maybe_serialize( $args ) ); |
| 113 | 113 | |
| 114 | 114 | // Data caching. |
| 115 | - if ( isset( $this->wp_data[ $type . $args_key ] ) ) { |
|
| 116 | - $data = $this->wp_data[ $type . $args_key ]; |
|
| 115 | + if ( isset( $this->wp_data[$type . $args_key] ) ) { |
|
| 116 | + $data = $this->wp_data[$type . $args_key]; |
|
| 117 | 117 | } else { |
| 118 | 118 | /** |
| 119 | 119 | * Use data from WordPress to populate an option array. |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | if ( ! empty( $data ) ) { |
| 129 | 129 | $data = $this->order_data( $data, $data_sort, $data_order ); |
| 130 | - $this->wp_data[ $type . $args_key ] = $data; |
|
| 130 | + $this->wp_data[$type . $args_key] = $data; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if ( is_object( $v ) ) { |
| 163 | 163 | $key = $v->$id_key; |
| 164 | 164 | } elseif ( is_array( $v ) ) { |
| 165 | - $key = $v[ $id_key ]; |
|
| 165 | + $key = $v[$id_key]; |
|
| 166 | 166 | } else { |
| 167 | 167 | $key = $k; |
| 168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if ( is_object( $v ) ) { |
| 175 | 175 | $value = $v->$name_key; |
| 176 | 176 | } elseif ( is_array( $v ) ) { |
| 177 | - $value = $v[ $name_key ]; |
|
| 177 | + $value = $v[$name_key]; |
|
| 178 | 178 | } else { |
| 179 | 179 | $value = $v; |
| 180 | 180 | } |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | if ( is_object( $v ) && isset( $v->$secondary_key ) ) { |
| 186 | 186 | $display_key = $v->$secondary_key; |
| 187 | - } elseif ( ! is_object( $v ) && isset( $v[ $secondary_key ] ) ) { |
|
| 188 | - $display_key = $v[ $secondary_key ]; |
|
| 187 | + } elseif ( ! is_object( $v ) && isset( $v[$secondary_key] ) ) { |
|
| 188 | + $display_key = $v[$secondary_key]; |
|
| 189 | 189 | } |
| 190 | - $data[ $key ] = $value; |
|
| 190 | + $data[$key] = $value; |
|
| 191 | 191 | if ( $display_key !== $value && $add_key ) { |
| 192 | - $data[ $key ] = $data[ $key ] . ' [' . $display_key . ']'; |
|
| 192 | + $data[$key] = $data[$key] . ' [' . $display_key . ']'; |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | if ( isset( $sites ) ) { |
| 309 | 309 | $results = array(); |
| 310 | 310 | foreach ( $sites as $site ) { |
| 311 | - $site = (array) $site; |
|
| 311 | + $site = ( array ) $site; |
|
| 312 | 312 | $k = $site['blog_id']; |
| 313 | 313 | $v = $site['domain'] . $site['path']; |
| 314 | 314 | $name = get_blog_option( $k, 'blogname' ); |
| 315 | 315 | if ( ! empty( $name ) ) { |
| 316 | 316 | $v .= ' - [' . $name . ']'; |
| 317 | 317 | } |
| 318 | - $results[ $k ] = $v; |
|
| 318 | + $results[$k] = $v; |
|
| 319 | 319 | } |
| 320 | 320 | $data = $this->process_results( $results, '', '', $display_keys, $secondary_key ); |
| 321 | 321 | } |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | $post_types = get_post_types( $args, $output, $operator ); |
| 342 | 342 | |
| 343 | 343 | foreach ( $post_types as $name => $title ) { |
| 344 | - if ( isset( $wp_post_types[ $name ]->labels->menu_name ) ) { |
|
| 345 | - $data[ $name ] = $wp_post_types[ $name ]->labels->menu_name; |
|
| 344 | + if ( isset( $wp_post_types[$name]->labels->menu_name ) ) { |
|
| 345 | + $data[$name] = $wp_post_types[$name]->labels->menu_name; |
|
| 346 | 346 | } else { |
| 347 | - $data[ $name ] = ucfirst( $name ); |
|
| 347 | + $data[$name] = ucfirst( $name ); |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | break; |
@@ -353,9 +353,9 @@ discard block |
||
| 353 | 353 | case 'menu_location': |
| 354 | 354 | global $_wp_registered_nav_menus; |
| 355 | 355 | foreach ( $_wp_registered_nav_menus as $k => $v ) { |
| 356 | - $data[ $k ] = $v; |
|
| 356 | + $data[$k] = $v; |
|
| 357 | 357 | if ( ! has_nav_menu( $k ) ) { |
| 358 | - $data[ $k ] .= ' ' . __( '[unassigned]', 'redux-framework' ); |
|
| 358 | + $data[$k] .= ' ' . __( '[unassigned]', 'redux-framework' ); |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | break; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | global $_wp_additional_image_sizes; |
| 366 | 366 | $results = array(); |
| 367 | 367 | foreach ( $_wp_additional_image_sizes as $size_name => $size_attrs ) { |
| 368 | - $results[ $size_name ] = $size_name . ' - ' . $size_attrs['width'] . ' x ' . $size_attrs['height']; |
|
| 368 | + $results[$size_name] = $size_name . ' - ' . $size_attrs['width'] . ' x ' . $size_attrs['height']; |
|
| 369 | 369 | } |
| 370 | 370 | $data = $this->process_results( $results, '', '', $display_keys, $secondary_key ); |
| 371 | 371 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | if ( 'before' === $item ) { |
| 386 | 386 | continue; |
| 387 | 387 | } |
| 388 | - $data[ 'el el-' . $item ] = $item; |
|
| 388 | + $data['el el-' . $item] = $item; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | if ( 'before' === $item ) { |
| 423 | 423 | continue; |
| 424 | 424 | } |
| 425 | - $data[ 'dashicons dashicons-' . $item ] = $item; |
|
| 425 | + $data['dashicons dashicons-' . $item] = $item; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | break; |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $results = array(); |
| 447 | 447 | foreach ( $wp_roles->roles as $role ) { |
| 448 | 448 | foreach ( $role['capabilities'] as $key => $cap ) { |
| 449 | - $results[ $key ] = ucwords( str_replace( '_', ' ', $key ) ); |
|
| 449 | + $results[$key] = ucwords( str_replace( '_', ' ', $key ) ); |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | $data = $this->process_results( $results, '', '', $display_keys, $secondary_key ); |
@@ -462,10 +462,10 @@ discard block |
||
| 462 | 462 | foreach ( $wp_roles->roles as $role ) { |
| 463 | 463 | $caps = array(); |
| 464 | 464 | foreach ( $role['capabilities'] as $key => $cap ) { |
| 465 | - $caps[ $key ] = ucwords( str_replace( '_', ' ', $key ) ); |
|
| 465 | + $caps[$key] = ucwords( str_replace( '_', ' ', $key ) ); |
|
| 466 | 466 | } |
| 467 | 467 | asort( $caps ); |
| 468 | - $data[ $role['name'] ] = $caps; |
|
| 468 | + $data[$role['name']] = $caps; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | break; |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $value = apply_filters( 'wpml_object_id', $value, $post_type, true ); |
| 545 | 545 | } elseif ( is_array( $value ) ) { |
| 546 | 546 | $value = array_map( |
| 547 | - function ( $val ) use ( $post_type ) { |
|
| 547 | + function( $val ) use ( $post_type ) { |
|
| 548 | 548 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Third party hook. Cannot change. |
| 549 | 549 | return apply_filters( 'wpml_object_id', $val, $post_type, true ); |
| 550 | 550 | }, |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | require_once $extension['field']; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( ! isset( $redux_framework->extensions[ $name ] ) ) { |
|
| 249 | + if ( ! isset( $redux_framework->extensions[$name] ) ) { |
|
| 250 | 250 | $field_classes = array( $extension['class'], $old_class ); |
| 251 | 251 | $ext_class = Redux_Functions::class_exists_ex( $field_classes ); |
| 252 | 252 | if ( false !== $ext_class ) { |
| 253 | - $redux_framework->extensions[ $name ] = new $ext_class( $redux_framework ); |
|
| 253 | + $redux_framework->extensions[$name] = new $ext_class( $redux_framework ); |
|
| 254 | 254 | } elseif ( is_admin() && true === $redux_framework->args['dev_mode'] ) { |
| 255 | 255 | echo '<div id="message" class="error"><p>No class named <strong>' . esc_html( $extension['class'] ) . '</strong> exists. Please verify your extension path.</p></div>'; |
| 256 | 256 | } |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | * @return bool|mixed |
| 284 | 284 | */ |
| 285 | 285 | public static function extension_path( string $extension, bool $folder = true ) { |
| 286 | - if ( ! isset( self::$extensions[ $extension ] ) ) { |
|
| 286 | + if ( ! isset( self::$extensions[$extension] ) ) { |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - $path = end( self::$extensions[ $extension ] ); |
|
| 290 | + $path = end( self::$extensions[$extension] ); |
|
| 291 | 291 | |
| 292 | 292 | if ( ! $folder ) { |
| 293 | 293 | return $path; |
@@ -330,16 +330,16 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( class_exists( 'Redux_Options_Defaults' ) && ! isset( self::$options_defaults[ $opt_name ] ) ) { |
|
| 333 | + if ( class_exists( 'Redux_Options_Defaults' ) && ! isset( self::$options_defaults[$opt_name] ) ) { |
|
| 334 | 334 | $sections = self::construct_sections( $opt_name ); |
| 335 | 335 | $wordpress_data = ( ! class_exists( 'Redux_WordPress_Data' ) ) ? null : new Redux_WordPress_Data( $opt_name ); |
| 336 | 336 | $options_defaults_class = new Redux_Options_Defaults(); |
| 337 | - self::$options_defaults[ $opt_name ] = $options_defaults_class->default_values( $opt_name, $sections, $wordpress_data ); |
|
| 338 | - if ( ! isset( self::$args[ $opt_name ]['global_variable'] ) || ( '' === self::$args[ $opt_name ]['global_variable'] && false !== self::$args[ $opt_name ]['global_variable'] ) ) { |
|
| 339 | - self::$args[ $opt_name ]['global_variable'] = str_replace( '-', '_', $opt_name ); |
|
| 337 | + self::$options_defaults[$opt_name] = $options_defaults_class->default_values( $opt_name, $sections, $wordpress_data ); |
|
| 338 | + if ( ! isset( self::$args[$opt_name]['global_variable'] ) || ( '' === self::$args[$opt_name]['global_variable'] && false !== self::$args[$opt_name]['global_variable'] ) ) { |
|
| 339 | + self::$args[$opt_name]['global_variable'] = str_replace( '-', '_', $opt_name ); |
|
| 340 | 340 | } |
| 341 | - if ( isset( self::$args[ $opt_name ]['global_variable'] ) && self::$args[ $opt_name ]['global_variable'] ) { |
|
| 342 | - $option_global = self::$args[ $opt_name ]['global_variable']; |
|
| 341 | + if ( isset( self::$args[$opt_name]['global_variable'] ) && self::$args[$opt_name]['global_variable'] ) { |
|
| 342 | + $option_global = self::$args[$opt_name]['global_variable']; |
|
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | 345 | * Filter 'redux/options/{opt_name}/global_variable' |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | global $$option_global; |
| 350 | 350 | |
| 351 | 351 | // phpcs:ignore WordPress.NamingConventions.ValidHookName, WordPress.NamingConventions.PrefixAllGlobals |
| 352 | - $$option_global = apply_filters( 'redux/options/' . $opt_name . '/global_variable', self::$options_defaults[ $opt_name ] ); |
|
| 352 | + $$option_global = apply_filters( 'redux/options/' . $opt_name . '/global_variable', self::$options_defaults[$opt_name] ); |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if ( class_exists( 'ReduxFramework' ) ) { |
| 370 | - if ( isset( self::$init[ $opt_name ] ) && ! empty( self::$init[ $opt_name ] ) ) { |
|
| 370 | + if ( isset( self::$init[$opt_name] ) && ! empty( self::$init[$opt_name] ) ) { |
|
| 371 | 371 | return; |
| 372 | 372 | } |
| 373 | 373 | } else { |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 382 | 382 | |
| 383 | - if ( isset( self::$init[ $opt_name ] ) && 1 === self::$init[ $opt_name ] ) { |
|
| 383 | + if ( isset( self::$init[$opt_name] ) && 1 === self::$init[$opt_name] ) { |
|
| 384 | 384 | return; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -389,15 +389,15 @@ discard block |
||
| 389 | 389 | $args = self::construct_args( $opt_name ); |
| 390 | 390 | $sections = self::construct_sections( $opt_name ); |
| 391 | 391 | |
| 392 | - if ( isset( self::$uses_extensions[ $opt_name ] ) && ! empty( self::$uses_extensions[ $opt_name ] ) ) { |
|
| 392 | + if ( isset( self::$uses_extensions[$opt_name] ) && ! empty( self::$uses_extensions[$opt_name] ) ) { |
|
| 393 | 393 | add_action( "redux/extensions/$opt_name/before", array( 'Redux', 'load_extensions' ), 0 ); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | $redux = new ReduxFramework( $sections, $args ); |
| 397 | - self::$init[ $opt_name ] = 1; |
|
| 397 | + self::$init[$opt_name] = 1; |
|
| 398 | 398 | |
| 399 | 399 | if ( isset( $redux->args['opt_name'] ) && $redux->args['opt_name'] !== $opt_name ) { |
| 400 | - self::$init[ $redux->args['opt_name'] ] = 1; |
|
| 400 | + self::$init[$redux->args['opt_name']] = 1; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public static function create_redux() { |
| 423 | 423 | foreach ( self::$sections as $opt_name => $the_sections ) { |
| 424 | 424 | if ( ! empty( $the_sections ) ) { |
| 425 | - if ( ! self::$init[ $opt_name ] ) { |
|
| 425 | + if ( ! self::$init[$opt_name] ) { |
|
| 426 | 426 | self::load_redux( $opt_name ); |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | * @return array|mixed |
| 438 | 438 | */ |
| 439 | 439 | public static function construct_args( string $opt_name ) { |
| 440 | - $args = self::$args[ $opt_name ] ?? array(); |
|
| 440 | + $args = self::$args[$opt_name] ?? array(); |
|
| 441 | 441 | $args['opt_name'] = $opt_name; |
| 442 | 442 | |
| 443 | 443 | if ( ! isset( $args['menu_title'] ) ) { |
@@ -465,19 +465,19 @@ discard block |
||
| 465 | 465 | public static function construct_sections( string $opt_name ): array { |
| 466 | 466 | $sections = array(); |
| 467 | 467 | |
| 468 | - if ( ! isset( self::$sections[ $opt_name ] ) ) { |
|
| 468 | + if ( ! isset( self::$sections[$opt_name] ) ) { |
|
| 469 | 469 | return $sections; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - foreach ( self::$sections[ $opt_name ] as $section_id => $section ) { |
|
| 472 | + foreach ( self::$sections[$opt_name] as $section_id => $section ) { |
|
| 473 | 473 | $section['fields'] = self::construct_fields( $opt_name, $section_id ); |
| 474 | 474 | $p = $section['priority']; |
| 475 | 475 | |
| 476 | - while ( isset( $sections[ $p ] ) ) { |
|
| 476 | + while ( isset( $sections[$p] ) ) { |
|
| 477 | 477 | ++$p; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - $sections[ $p ] = $section; |
|
| 480 | + $sections[$p] = $section; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | ksort( $sections ); |
@@ -496,16 +496,16 @@ discard block |
||
| 496 | 496 | public static function construct_fields( string $opt_name = '', string $section_id = '' ): array { |
| 497 | 497 | $fields = array(); |
| 498 | 498 | |
| 499 | - if ( ! empty( self::$fields[ $opt_name ] ) ) { |
|
| 500 | - foreach ( self::$fields[ $opt_name ] as $field ) { |
|
| 499 | + if ( ! empty( self::$fields[$opt_name] ) ) { |
|
| 500 | + foreach ( self::$fields[$opt_name] as $field ) { |
|
| 501 | 501 | if ( $field['section_id'] === $section_id ) { |
| 502 | 502 | $p = esc_html( $field['priority'] ); |
| 503 | 503 | |
| 504 | - while ( isset( $fields[ $p ] ) ) { |
|
| 504 | + while ( isset( $fields[$p] ) ) { |
|
| 505 | 505 | echo intval( $p++ ); |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - $fields[ $p ] = $field; |
|
| 508 | + $fields[$p] = $field; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | self::check_opt_name( $opt_name ); |
| 543 | 543 | |
| 544 | 544 | if ( ! empty( $opt_name ) && ! empty( $id ) ) { |
| 545 | - if ( ! isset( self::$sections[ $opt_name ][ $id ] ) ) { |
|
| 545 | + if ( ! isset( self::$sections[$opt_name][$id] ) ) { |
|
| 546 | 546 | $id = Redux_Core::strtolower( sanitize_html_class( $id ) ); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - return self::$sections[ $opt_name ][ $id ] ?? false; |
|
| 549 | + return self::$sections[$opt_name][$id] ?? false; |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | return false; |
@@ -614,8 +614,8 @@ discard block |
||
| 614 | 614 | public static function get_sections( string $opt_name = '' ) { |
| 615 | 615 | self::check_opt_name( $opt_name ); |
| 616 | 616 | |
| 617 | - if ( ! empty( self::$sections[ $opt_name ] ) ) { |
|
| 618 | - return self::$sections[ $opt_name ]; |
|
| 617 | + if ( ! empty( self::$sections[$opt_name] ) ) { |
|
| 618 | + return self::$sections[$opt_name]; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | return array(); |
@@ -651,28 +651,27 @@ discard block |
||
| 651 | 651 | if ( '' !== $opt_name && '' !== $id ) { |
| 652 | 652 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 653 | 653 | |
| 654 | - if ( isset( self::$sections[ $opt_name ][ $id ] ) ) { |
|
| 654 | + if ( isset( self::$sections[$opt_name][$id] ) ) { |
|
| 655 | 655 | $priority = ''; |
| 656 | 656 | |
| 657 | - foreach ( self::$sections[ $opt_name ] as $key => $section ) { |
|
| 657 | + foreach ( self::$sections[$opt_name] as $key => $section ) { |
|
| 658 | 658 | if ( $key === $id ) { |
| 659 | - $priority = $section['priority']; |
|
| 660 | - --self::$priority[ $opt_name ]['sections']; |
|
| 661 | - unset( self::$sections[ $opt_name ][ $id ] ); |
|
| 659 | + $priority = $section['priority'];--self::$priority[$opt_name]['sections']; |
|
| 660 | + unset( self::$sections[$opt_name][$id] ); |
|
| 662 | 661 | continue; |
| 663 | 662 | } |
| 664 | 663 | if ( '' !== $priority ) { |
| 665 | 664 | $new_priority = $section['priority']; |
| 666 | 665 | $section['priority'] = $priority; |
| 667 | - self::$sections[ $opt_name ][ $key ] = $section; |
|
| 666 | + self::$sections[$opt_name][$key] = $section; |
|
| 668 | 667 | $priority = $new_priority; |
| 669 | 668 | } |
| 670 | 669 | } |
| 671 | 670 | |
| 672 | - if ( isset( self::$fields[ $opt_name ] ) && ! empty( self::$fields[ $opt_name ] ) && true === $fields ) { |
|
| 673 | - foreach ( self::$fields[ $opt_name ] as $key => $field ) { |
|
| 671 | + if ( isset( self::$fields[$opt_name] ) && ! empty( self::$fields[$opt_name] ) && true === $fields ) { |
|
| 672 | + foreach ( self::$fields[$opt_name] as $key => $field ) { |
|
| 674 | 673 | if ( $field['section_id'] === $id ) { |
| 675 | - unset( self::$fields[ $opt_name ][ $key ] ); |
|
| 674 | + unset( self::$fields[$opt_name][$key] ); |
|
| 676 | 675 | } |
| 677 | 676 | } |
| 678 | 677 | } |
@@ -725,24 +724,24 @@ discard block |
||
| 725 | 724 | $section['id'] = time(); |
| 726 | 725 | } |
| 727 | 726 | |
| 728 | - if ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) && ! $replace ) { |
|
| 727 | + if ( isset( self::$sections[$opt_name][$section['id']] ) && ! $replace ) { |
|
| 729 | 728 | $orig = $section['id']; |
| 730 | 729 | $i = 0; |
| 731 | 730 | |
| 732 | - while ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) { |
|
| 731 | + while ( isset( self::$sections[$opt_name][$section['id']] ) ) { |
|
| 733 | 732 | $section['id'] = $orig . '_' . $i; |
| 734 | 733 | ++$i; |
| 735 | 734 | } |
| 736 | - } elseif ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) && $replace ) { |
|
| 735 | + } elseif ( isset( self::$sections[$opt_name][$section['id']] ) && $replace ) { |
|
| 737 | 736 | // If replace is set, let's update the default values with these! |
| 738 | 737 | $fields = false; |
| 739 | - if ( isset( self::$sections[ $opt_name ][ $section['id'] ]['fields'] ) && ! empty( self::$sections[ $opt_name ][ $section['id'] ]['fields'] ) ) { |
|
| 740 | - $fields = self::$sections[ $opt_name ][ $section['id'] ]['fields']; |
|
| 738 | + if ( isset( self::$sections[$opt_name][$section['id']]['fields'] ) && ! empty( self::$sections[$opt_name][$section['id']]['fields'] ) ) { |
|
| 739 | + $fields = self::$sections[$opt_name][$section['id']]['fields']; |
|
| 741 | 740 | } |
| 742 | - self::$sections[ $opt_name ][ $section['id'] ] = wp_parse_args( $section, self::$sections[ $opt_name ][ $section['id'] ] ); |
|
| 741 | + self::$sections[$opt_name][$section['id']] = wp_parse_args( $section, self::$sections[$opt_name][$section['id']] ); |
|
| 743 | 742 | if ( ! empty( $fields ) ) { |
| 744 | - if ( ! isset( self::$sections[ $opt_name ][ $section['id'] ]['fields'] ) || ( isset( self::$sections[ $opt_name ][ $section['id'] ]['fields'] ) && empty( self::$sections[ $opt_name ][ $section['id'] ]['fields'] ) ) ) { |
|
| 745 | - self::$sections[ $opt_name ][ $section['id'] ]['fields'] = $fields; |
|
| 743 | + if ( ! isset( self::$sections[$opt_name][$section['id']]['fields'] ) || ( isset( self::$sections[$opt_name][$section['id']]['fields'] ) && empty( self::$sections[$opt_name][$section['id']]['fields'] ) ) ) { |
|
| 744 | + self::$sections[$opt_name][$section['id']]['fields'] = $fields; |
|
| 746 | 745 | } |
| 747 | 746 | } |
| 748 | 747 | } |
@@ -750,7 +749,7 @@ discard block |
||
| 750 | 749 | |
| 751 | 750 | if ( ! empty( $opt_name ) && is_array( $section ) && ! empty( $section ) ) { |
| 752 | 751 | if ( ! isset( $section['id'] ) && ! isset( $section['title'] ) ) { |
| 753 | - self::$errors[ $opt_name ]['section']['missing_title'] = esc_html__( 'Unable to create a section due to missing id and title.', 'redux-framework' ); |
|
| 752 | + self::$errors[$opt_name]['section']['missing_title'] = esc_html__( 'Unable to create a section due to missing id and title.', 'redux-framework' ); |
|
| 754 | 753 | |
| 755 | 754 | return; |
| 756 | 755 | } |
@@ -765,9 +764,9 @@ discard block |
||
| 765 | 764 | } |
| 766 | 765 | unset( $section['fields'] ); |
| 767 | 766 | } |
| 768 | - self::$sections[ $opt_name ][ $section['id'] ] = $section; |
|
| 767 | + self::$sections[$opt_name][$section['id']] = $section; |
|
| 769 | 768 | } else { |
| 770 | - self::$errors[ $opt_name ]['section']['empty'] = esc_html__( 'Unable to create a section due an empty section array or the section variable passed was not an array.', 'redux-framework' ); |
|
| 769 | + self::$errors[$opt_name]['section']['empty'] = esc_html__( 'Unable to create a section due an empty section array or the section variable passed was not an array.', 'redux-framework' ); |
|
| 771 | 770 | } |
| 772 | 771 | } |
| 773 | 772 | |
@@ -803,8 +802,8 @@ discard block |
||
| 803 | 802 | if ( '' !== $opt_name && '' !== $id ) { |
| 804 | 803 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 805 | 804 | |
| 806 | - if ( isset( self::$sections[ $opt_name ][ $id ] ) ) { |
|
| 807 | - self::$sections[ $opt_name ][ $id ]['hidden'] = $hide; |
|
| 805 | + if ( isset( self::$sections[$opt_name][$id] ) ) { |
|
| 806 | + self::$sections[$opt_name][$id]['hidden'] = $hide; |
|
| 808 | 807 | } |
| 809 | 808 | } |
| 810 | 809 | } |
@@ -854,7 +853,7 @@ discard block |
||
| 854 | 853 | self::check_opt_name( $opt_name ); |
| 855 | 854 | |
| 856 | 855 | if ( ! empty( $opt_name ) && ! empty( $id ) ) { |
| 857 | - return self::$fields[ $opt_name ][ $id ] ?? false; |
|
| 856 | + return self::$fields[$opt_name][$id] ?? false; |
|
| 858 | 857 | } |
| 859 | 858 | |
| 860 | 859 | return false; |
@@ -890,13 +889,13 @@ discard block |
||
| 890 | 889 | self::check_opt_name( $opt_name ); |
| 891 | 890 | |
| 892 | 891 | if ( '' !== $opt_name && '' !== $id ) { |
| 893 | - if ( isset( self::$fields[ $opt_name ][ $id ] ) ) { |
|
| 892 | + if ( isset( self::$fields[$opt_name][$id] ) ) { |
|
| 894 | 893 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 895 | 894 | |
| 896 | 895 | if ( ! $hide ) { |
| 897 | - self::$fields[ $opt_name ][ $id ]['class'] = str_replace( 'hidden', '', self::$fields[ $opt_name ][ $id ]['class'] ); |
|
| 896 | + self::$fields[$opt_name][$id]['class'] = str_replace( 'hidden', '', self::$fields[$opt_name][$id]['class'] ); |
|
| 898 | 897 | } else { |
| 899 | - self::$fields[ $opt_name ][ $id ]['class'] .= 'hidden'; |
|
| 898 | + self::$fields[$opt_name][$id]['class'] .= 'hidden'; |
|
| 900 | 899 | } |
| 901 | 900 | } |
| 902 | 901 | } |
@@ -953,7 +952,7 @@ discard block |
||
| 953 | 952 | } |
| 954 | 953 | $field['id'] = $field['id'] ?? "{$opt_name}_{$section_id}_{$field['type']}_" . wp_rand( 1, 9999 ); |
| 955 | 954 | |
| 956 | - self::$fields[ $opt_name ][ $field['id'] ] = $field; |
|
| 955 | + self::$fields[$opt_name][$field['id']] = $field; |
|
| 957 | 956 | } |
| 958 | 957 | |
| 959 | 958 | /** |
@@ -1013,19 +1012,18 @@ discard block |
||
| 1013 | 1012 | |
| 1014 | 1013 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 1015 | 1014 | |
| 1016 | - if ( isset( self::$fields[ $opt_name ][ $id ] ) ) { |
|
| 1017 | - foreach ( self::$fields[ $opt_name ] as $key => $field ) { |
|
| 1015 | + if ( isset( self::$fields[$opt_name][$id] ) ) { |
|
| 1016 | + foreach ( self::$fields[$opt_name] as $key => $field ) { |
|
| 1018 | 1017 | if ( $key === $id ) { |
| 1019 | - $priority = $field['priority']; |
|
| 1020 | - --self::$priority[ $opt_name ]['fields']; |
|
| 1021 | - unset( self::$fields[ $opt_name ][ $id ] ); |
|
| 1018 | + $priority = $field['priority'];--self::$priority[$opt_name]['fields']; |
|
| 1019 | + unset( self::$fields[$opt_name][$id] ); |
|
| 1022 | 1020 | continue; |
| 1023 | 1021 | } |
| 1024 | 1022 | |
| 1025 | 1023 | if ( isset( $priority ) && '' !== $priority ) { |
| 1026 | 1024 | $new_priority = $field['priority']; |
| 1027 | 1025 | $field['priority'] = $priority; |
| 1028 | - self::$fields[ $opt_name ][ $key ] = $field; |
|
| 1026 | + self::$fields[$opt_name][$key] = $field; |
|
| 1029 | 1027 | $priority = $new_priority; |
| 1030 | 1028 | } |
| 1031 | 1029 | } |
@@ -1063,15 +1061,15 @@ discard block |
||
| 1063 | 1061 | self::check_opt_name( $opt_name ); |
| 1064 | 1062 | |
| 1065 | 1063 | if ( '' !== $opt_name ) { |
| 1066 | - if ( ! isset( self::$args[ $opt_name ]['help_tabs'] ) ) { |
|
| 1067 | - self::$args[ $opt_name ]['help_tabs'] = array(); |
|
| 1064 | + if ( ! isset( self::$args[$opt_name]['help_tabs'] ) ) { |
|
| 1065 | + self::$args[$opt_name]['help_tabs'] = array(); |
|
| 1068 | 1066 | } |
| 1069 | 1067 | |
| 1070 | 1068 | if ( isset( $tab['id'] ) ) { |
| 1071 | - self::$args[ $opt_name ]['help_tabs'][] = $tab; |
|
| 1069 | + self::$args[$opt_name]['help_tabs'][] = $tab; |
|
| 1072 | 1070 | } elseif ( is_array( end( $tab ) ) ) { |
| 1073 | 1071 | foreach ( $tab as $tab_item ) { |
| 1074 | - self::$args[ $opt_name ]['help_tabs'][] = $tab_item; |
|
| 1072 | + self::$args[$opt_name]['help_tabs'][] = $tab_item; |
|
| 1075 | 1073 | } |
| 1076 | 1074 | } |
| 1077 | 1075 | } |
@@ -1103,7 +1101,7 @@ discard block |
||
| 1103 | 1101 | } |
| 1104 | 1102 | self::check_opt_name( $opt_name ); |
| 1105 | 1103 | |
| 1106 | - self::$args[ $opt_name ]['help_sidebar'] = $content; |
|
| 1104 | + self::$args[$opt_name]['help_sidebar'] = $content; |
|
| 1107 | 1105 | } |
| 1108 | 1106 | |
| 1109 | 1107 | /** |
@@ -1141,10 +1139,10 @@ discard block |
||
| 1141 | 1139 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 1142 | 1140 | |
| 1143 | 1141 | if ( is_array( $args ) ) { |
| 1144 | - if ( isset( self::$args[ $opt_name ]['clearArgs'] ) ) { |
|
| 1145 | - self::$args[ $opt_name ] = array(); |
|
| 1142 | + if ( isset( self::$args[$opt_name]['clearArgs'] ) ) { |
|
| 1143 | + self::$args[$opt_name] = array(); |
|
| 1146 | 1144 | } |
| 1147 | - self::$args[ $opt_name ] = wp_parse_args( $args, self::$args[ $opt_name ] ); |
|
| 1145 | + self::$args[$opt_name] = wp_parse_args( $args, self::$args[$opt_name] ); |
|
| 1148 | 1146 | } |
| 1149 | 1147 | } |
| 1150 | 1148 | |
@@ -1163,7 +1161,7 @@ discard block |
||
| 1163 | 1161 | |
| 1164 | 1162 | Redux_Functions_Ex::record_caller( $opt_name ); |
| 1165 | 1163 | |
| 1166 | - self::$args[ $opt_name ]['developer'] = $arg; |
|
| 1164 | + self::$args[$opt_name]['developer'] = $arg; |
|
| 1167 | 1165 | } |
| 1168 | 1166 | |
| 1169 | 1167 | /** |
@@ -1192,13 +1190,13 @@ discard block |
||
| 1192 | 1190 | self::check_opt_name( $opt_name ); |
| 1193 | 1191 | |
| 1194 | 1192 | if ( ! empty( $opt_name ) && ! empty( $key ) ) { |
| 1195 | - if ( ! empty( self::$args[ $opt_name ] ) ) { |
|
| 1196 | - return self::$args[ $opt_name ][ $key ]; |
|
| 1193 | + if ( ! empty( self::$args[$opt_name] ) ) { |
|
| 1194 | + return self::$args[$opt_name][$key]; |
|
| 1197 | 1195 | } else { |
| 1198 | 1196 | return null; |
| 1199 | 1197 | } |
| 1200 | - } elseif ( ! empty( $opt_name ) && ! empty( self::$args[ $opt_name ] ) ) { |
|
| 1201 | - return self::$args[ $opt_name ]; |
|
| 1198 | + } elseif ( ! empty( $opt_name ) && ! empty( self::$args[$opt_name] ) ) { |
|
| 1199 | + return self::$args[$opt_name]; |
|
| 1202 | 1200 | } |
| 1203 | 1201 | |
| 1204 | 1202 | return null; |
@@ -1230,8 +1228,8 @@ discard block |
||
| 1230 | 1228 | public static function get_arg( string $opt_name = '', string $key = '' ) { |
| 1231 | 1229 | self::check_opt_name( $opt_name ); |
| 1232 | 1230 | |
| 1233 | - if ( ! empty( $opt_name ) && ! empty( $key ) && ! empty( self::$args[ $opt_name ] ) ) { |
|
| 1234 | - return self::$args[ $opt_name ][ $key ]; |
|
| 1231 | + if ( ! empty( $opt_name ) && ! empty( $key ) && ! empty( self::$args[$opt_name] ) ) { |
|
| 1232 | + return self::$args[$opt_name][$key]; |
|
| 1235 | 1233 | } else { |
| 1236 | 1234 | return null; |
| 1237 | 1235 | } |
@@ -1318,7 +1316,7 @@ discard block |
||
| 1318 | 1316 | $values = $$opt_name; |
| 1319 | 1317 | } |
| 1320 | 1318 | |
| 1321 | - if ( ! isset( $values[ $key ] ) ) { |
|
| 1319 | + if ( ! isset( $values[$key] ) ) { |
|
| 1322 | 1320 | if ( null === $default ) { |
| 1323 | 1321 | $field = self::get_field( $opt_name, $key ); |
| 1324 | 1322 | |
@@ -1327,8 +1325,8 @@ discard block |
||
| 1327 | 1325 | $sections = self::construct_sections( $opt_name ); |
| 1328 | 1326 | $defaults = $defaults_class->default_values( $opt_name, $sections ); |
| 1329 | 1327 | |
| 1330 | - if ( isset( $defaults[ $key ] ) ) { |
|
| 1331 | - $default = $defaults[ $key ]; |
|
| 1328 | + if ( isset( $defaults[$key] ) ) { |
|
| 1329 | + $default = $defaults[$key]; |
|
| 1332 | 1330 | } |
| 1333 | 1331 | } |
| 1334 | 1332 | } |
@@ -1337,25 +1335,25 @@ discard block |
||
| 1337 | 1335 | if ( ! empty( $subkeys ) && is_array( $subkeys ) ) { |
| 1338 | 1336 | $value = $default; |
| 1339 | 1337 | |
| 1340 | - if ( isset( $values[ $key ] ) ) { |
|
| 1338 | + if ( isset( $values[$key] ) ) { |
|
| 1341 | 1339 | $count = count( $subkeys ); |
| 1342 | 1340 | |
| 1343 | 1341 | if ( 1 === $count ) { |
| 1344 | - $value = $values[ $key ][ $subkeys[1] ] ?? $default; |
|
| 1342 | + $value = $values[$key][$subkeys[1]] ?? $default; |
|
| 1345 | 1343 | } elseif ( 2 === $count ) { |
| 1346 | - if ( isset( $values[ $key ][ $subkeys[1] ] ) ) { |
|
| 1347 | - $value = $values[ $key ][ $subkeys[1] ][ $subkeys[2] ] ?? $default; |
|
| 1344 | + if ( isset( $values[$key][$subkeys[1]] ) ) { |
|
| 1345 | + $value = $values[$key][$subkeys[1]][$subkeys[2]] ?? $default; |
|
| 1348 | 1346 | } |
| 1349 | 1347 | } elseif ( 3 === $count ) { |
| 1350 | - if ( isset( $values[ $key ][ $subkeys[1] ] ) ) { |
|
| 1351 | - if ( isset( $values[ $key ][ $subkeys[1] ][ $subkeys[2] ] ) ) { |
|
| 1352 | - $value = $values[ $key ][ $subkeys[1] ][ $subkeys[2] ][ $subkeys[3] ] ?? $default; |
|
| 1348 | + if ( isset( $values[$key][$subkeys[1]] ) ) { |
|
| 1349 | + if ( isset( $values[$key][$subkeys[1]][$subkeys[2]] ) ) { |
|
| 1350 | + $value = $values[$key][$subkeys[1]][$subkeys[2]][$subkeys[3]] ?? $default; |
|
| 1353 | 1351 | } |
| 1354 | 1352 | } |
| 1355 | 1353 | } |
| 1356 | 1354 | } |
| 1357 | 1355 | } else { |
| 1358 | - $value = $values[ $key ] ?? $default; |
|
| 1356 | + $value = $values[$key] ?? $default; |
|
| 1359 | 1357 | } |
| 1360 | 1358 | |
| 1361 | 1359 | return $value; |
@@ -1404,7 +1402,7 @@ discard block |
||
| 1404 | 1402 | |
| 1405 | 1403 | if ( '' !== $opt_name ) { |
| 1406 | 1404 | $redux = get_option( $opt_name ); |
| 1407 | - $redux[ $key ] = $option; |
|
| 1405 | + $redux[$key] = $option; |
|
| 1408 | 1406 | |
| 1409 | 1407 | return update_option( $opt_name, $redux ); |
| 1410 | 1408 | } else { |
@@ -1421,8 +1419,8 @@ discard block |
||
| 1421 | 1419 | * @return mixed |
| 1422 | 1420 | */ |
| 1423 | 1421 | public static function get_priority( string $opt_name, string $type ) { |
| 1424 | - $priority = self::$priority[ $opt_name ][ $type ]; |
|
| 1425 | - self::$priority[ $opt_name ][ $type ] += 1; |
|
| 1422 | + $priority = self::$priority[$opt_name][$type]; |
|
| 1423 | + self::$priority[$opt_name][$type] += 1; |
|
| 1426 | 1424 | |
| 1427 | 1425 | return $priority; |
| 1428 | 1426 | } |
@@ -1437,32 +1435,32 @@ discard block |
||
| 1437 | 1435 | return; |
| 1438 | 1436 | } |
| 1439 | 1437 | |
| 1440 | - if ( ! isset( self::$sections[ $opt_name ] ) ) { |
|
| 1441 | - self::$sections[ $opt_name ] = array(); |
|
| 1442 | - self::$priority[ $opt_name ]['sections'] = 1; |
|
| 1438 | + if ( ! isset( self::$sections[$opt_name] ) ) { |
|
| 1439 | + self::$sections[$opt_name] = array(); |
|
| 1440 | + self::$priority[$opt_name]['sections'] = 1; |
|
| 1443 | 1441 | } |
| 1444 | 1442 | |
| 1445 | - if ( ! isset( self::$args[ $opt_name ] ) ) { |
|
| 1446 | - self::$args[ $opt_name ] = array(); |
|
| 1447 | - self::$priority[ $opt_name ]['args'] = 1; |
|
| 1443 | + if ( ! isset( self::$args[$opt_name] ) ) { |
|
| 1444 | + self::$args[$opt_name] = array(); |
|
| 1445 | + self::$priority[$opt_name]['args'] = 1; |
|
| 1448 | 1446 | } |
| 1449 | 1447 | |
| 1450 | - if ( ! isset( self::$fields[ $opt_name ] ) ) { |
|
| 1451 | - self::$fields[ $opt_name ] = array(); |
|
| 1452 | - self::$priority[ $opt_name ]['fields'] = 1; |
|
| 1448 | + if ( ! isset( self::$fields[$opt_name] ) ) { |
|
| 1449 | + self::$fields[$opt_name] = array(); |
|
| 1450 | + self::$priority[$opt_name]['fields'] = 1; |
|
| 1453 | 1451 | } |
| 1454 | 1452 | |
| 1455 | - if ( ! isset( self::$help[ $opt_name ] ) ) { |
|
| 1456 | - self::$help[ $opt_name ] = array(); |
|
| 1457 | - self::$priority[ $opt_name ]['help'] = 1; |
|
| 1453 | + if ( ! isset( self::$help[$opt_name] ) ) { |
|
| 1454 | + self::$help[$opt_name] = array(); |
|
| 1455 | + self::$priority[$opt_name]['help'] = 1; |
|
| 1458 | 1456 | } |
| 1459 | 1457 | |
| 1460 | - if ( ! isset( self::$errors[ $opt_name ] ) ) { |
|
| 1461 | - self::$errors[ $opt_name ] = array(); |
|
| 1458 | + if ( ! isset( self::$errors[$opt_name] ) ) { |
|
| 1459 | + self::$errors[$opt_name] = array(); |
|
| 1462 | 1460 | } |
| 1463 | 1461 | |
| 1464 | - if ( ! isset( self::$init[ $opt_name ] ) ) { |
|
| 1465 | - self::$init[ $opt_name ] = false; |
|
| 1462 | + if ( ! isset( self::$init[$opt_name] ) ) { |
|
| 1463 | + self::$init[$opt_name] = false; |
|
| 1466 | 1464 | } |
| 1467 | 1465 | } |
| 1468 | 1466 | |
@@ -1491,13 +1489,13 @@ discard block |
||
| 1491 | 1489 | $instance = null; |
| 1492 | 1490 | |
| 1493 | 1491 | if ( file_exists( $class_file ) ) { |
| 1494 | - self::$uses_extensions[ $opt_name ] = self::$uses_extensions[ $opt_name ] ?? array(); |
|
| 1492 | + self::$uses_extensions[$opt_name] = self::$uses_extensions[$opt_name] ?? array(); |
|
| 1495 | 1493 | |
| 1496 | - if ( ! in_array( $name, self::$uses_extensions[ $opt_name ], true ) ) { |
|
| 1497 | - self::$uses_extensions[ $opt_name ][] = $name; |
|
| 1494 | + if ( ! in_array( $name, self::$uses_extensions[$opt_name], true ) ) { |
|
| 1495 | + self::$uses_extensions[$opt_name][] = $name; |
|
| 1498 | 1496 | } |
| 1499 | 1497 | |
| 1500 | - self::$extensions[ $name ] = self::$extensions[ $name ] ?? array(); |
|
| 1498 | + self::$extensions[$name] = self::$extensions[$name] ?? array(); |
|
| 1501 | 1499 | |
| 1502 | 1500 | $version = Redux_Helpers::get_template_version( $class_file ); |
| 1503 | 1501 | |
@@ -1506,7 +1504,7 @@ discard block |
||
| 1506 | 1504 | $version = $instance->version; |
| 1507 | 1505 | } |
| 1508 | 1506 | } |
| 1509 | - self::$extensions[ $name ][ $version ] = self::$extensions[ $name ][ $version ] ?? $class_file; |
|
| 1507 | + self::$extensions[$name][$version] = self::$extensions[$name][$version] ?? $class_file; |
|
| 1510 | 1508 | |
| 1511 | 1509 | $new_name = str_replace( '_', '-', $name ); |
| 1512 | 1510 | $api_check = str_replace( |
@@ -1597,10 +1595,10 @@ discard block |
||
| 1597 | 1595 | } |
| 1598 | 1596 | } |
| 1599 | 1597 | |
| 1600 | - self::$extension_paths[ $opt_name ] = $path; |
|
| 1598 | + self::$extension_paths[$opt_name] = $path; |
|
| 1601 | 1599 | |
| 1602 | 1600 | if ( true === $force ) { |
| 1603 | - if ( isset( self::$uses_extensions[ $opt_name ] ) && ! empty( self::$uses_extensions[ $opt_name ] ) ) { |
|
| 1601 | + if ( isset( self::$uses_extensions[$opt_name] ) && ! empty( self::$uses_extensions[$opt_name] ) ) { |
|
| 1604 | 1602 | $redux = self::instance( $opt_name ); |
| 1605 | 1603 | |
| 1606 | 1604 | if ( isset( $redux ) ) { |
@@ -1617,7 +1615,7 @@ discard block |
||
| 1617 | 1615 | $redux = self::all_instances(); |
| 1618 | 1616 | |
| 1619 | 1617 | foreach ( $redux as $instance ) { |
| 1620 | - if ( ! empty( self::$uses_extensions[ $instance['args']['opt_name'] ] ) ) { |
|
| 1618 | + if ( ! empty( self::$uses_extensions[$instance['args']['opt_name']] ) ) { |
|
| 1621 | 1619 | continue; |
| 1622 | 1620 | } |
| 1623 | 1621 | if ( ! empty( $instance['extensions'] ) ) { |
@@ -1633,7 +1631,7 @@ discard block |
||
| 1633 | 1631 | * @param object|null $instance ReduxFramework instance. |
| 1634 | 1632 | */ |
| 1635 | 1633 | public static function get_instance_extension( string $opt_name, $instance ) { |
| 1636 | - if ( ! empty( self::$uses_extensions[ $opt_name ] ) || empty( $opt_name ) ) { |
|
| 1634 | + if ( ! empty( self::$uses_extensions[$opt_name] ) || empty( $opt_name ) ) { |
|
| 1637 | 1635 | return; |
| 1638 | 1636 | } |
| 1639 | 1637 | |
@@ -1650,7 +1648,7 @@ discard block |
||
| 1650 | 1648 | new Redux_Widget_Areas( $instance ); |
| 1651 | 1649 | } |
| 1652 | 1650 | |
| 1653 | - if ( isset( self::$uses_extensions[ $opt_name ][ $name ] ) ) { |
|
| 1651 | + if ( isset( self::$uses_extensions[$opt_name][$name] ) ) { |
|
| 1654 | 1652 | continue; |
| 1655 | 1653 | } |
| 1656 | 1654 | |
@@ -1689,22 +1687,22 @@ discard block |
||
| 1689 | 1687 | |
| 1690 | 1688 | if ( empty( $key ) ) { |
| 1691 | 1689 | return self::$extension_paths; |
| 1692 | - } elseif ( isset( self::$extension_paths[ $key ] ) ) { |
|
| 1693 | - return self::$extension_paths[ $key ]; |
|
| 1690 | + } elseif ( isset( self::$extension_paths[$key] ) ) { |
|
| 1691 | + return self::$extension_paths[$key]; |
|
| 1694 | 1692 | } |
| 1695 | 1693 | } else { |
| 1696 | - if ( empty( self::$uses_extensions[ $opt_name ] ) ) { |
|
| 1694 | + if ( empty( self::$uses_extensions[$opt_name] ) ) { |
|
| 1697 | 1695 | self::get_instance_extension( $opt_name, null ); |
| 1698 | 1696 | } |
| 1699 | 1697 | |
| 1700 | - if ( empty( self::$uses_extensions[ $opt_name ] ) ) { |
|
| 1698 | + if ( empty( self::$uses_extensions[$opt_name] ) ) { |
|
| 1701 | 1699 | return false; |
| 1702 | 1700 | } |
| 1703 | 1701 | |
| 1704 | 1702 | $instance_extensions = array(); |
| 1705 | 1703 | |
| 1706 | - foreach ( self::$uses_extensions[ $opt_name ] as $extension ) { |
|
| 1707 | - $class_file = end( self::$extensions[ $extension ] ); |
|
| 1704 | + foreach ( self::$uses_extensions[$opt_name] as $extension ) { |
|
| 1705 | + $class_file = end( self::$extensions[$extension] ); |
|
| 1708 | 1706 | $directory = explode( DIRECTORY_SEPARATOR, $class_file ); |
| 1709 | 1707 | array_pop( $directory ); |
| 1710 | 1708 | $directory = trailingslashit( join( DIRECTORY_SEPARATOR, $directory ) ); |
@@ -1727,7 +1725,7 @@ discard block |
||
| 1727 | 1725 | $the_data['field'] = $test_path . str_replace( '-', '', $extension ) . '.php'; |
| 1728 | 1726 | } |
| 1729 | 1727 | } |
| 1730 | - $instance_extensions[ $extension ] = $the_data; |
|
| 1728 | + $instance_extensions[$extension] = $the_data; |
|
| 1731 | 1729 | } |
| 1732 | 1730 | |
| 1733 | 1731 | return $instance_extensions; |