@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( ! class_exists('GFAddOn') ) { |
|
3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
4 | 4 | return; |
5 | 5 | } |
6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
77 | 77 | |
78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
79 | 79 | return parent::__construct(); |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function get_instance() { |
89 | 89 | |
90 | - if( empty( self::$instance ) ) { |
|
90 | + if ( empty( self::$instance ) ) { |
|
91 | 91 | self::$instance = new self( 'get_instance' ); |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function current_user_can_any( $caps ) { |
108 | 108 | |
109 | - if( empty( $caps ) ) { |
|
109 | + if ( empty( $caps ) ) { |
|
110 | 110 | $caps = array( 'gravityview_full_access' ); |
111 | 111 | } |
112 | 112 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ), |
161 | 161 | 'found-other' => array( |
162 | 162 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
163 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
163 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
164 | 164 | ), |
165 | 165 | 'other' => array( |
166 | 166 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | }); |
248 | 248 | |
249 | 249 | function gv_feedback_append_error_message() { |
250 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
250 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
251 | 251 | } |
252 | 252 | }); |
253 | 253 | </script> |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | </ul> |
265 | 265 | <div class="gv-followup widefat"> |
266 | 266 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
267 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
267 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
268 | 268 | </div> |
269 | 269 | <div class="scale-description"> |
270 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
270 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
271 | 271 | <ul class="inline"> |
272 | 272 | <?php |
273 | 273 | $i = 0; |
274 | - while( $i < 11 ) { |
|
275 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
274 | + while ( $i < 11 ) { |
|
275 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
276 | 276 | $i++; |
277 | 277 | } |
278 | 278 | ?> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | </div> |
282 | 282 | |
283 | 283 | <div class="gv-form-field-wrapper"> |
284 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
284 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
285 | 285 | </div> |
286 | 286 | |
287 | 287 | <div class="submit"> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
296 | 296 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
297 | 297 | <p><?php echo gravityview_get_floaty(); ?> |
298 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
298 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
299 | 299 | </p> |
300 | 300 | <div class="wp-clearfix"></div> |
301 | 301 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
370 | 370 | |
371 | 371 | /** @since 1.7.6 */ |
372 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
372 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
373 | 373 | |
374 | 374 | parent::init_admin(); |
375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function modify_app_settings_menu_title( $setting_tabs ) { |
385 | 385 | |
386 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
386 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
387 | 387 | |
388 | 388 | return $setting_tabs; |
389 | 389 | } |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | */ |
401 | 401 | private function _load_license_handler() { |
402 | 402 | |
403 | - if( !empty( $this->License_Handler ) ) { |
|
403 | + if ( ! empty( $this->License_Handler ) ) { |
|
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
407 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
408 | 408 | |
409 | 409 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
410 | 410 | } |
@@ -416,42 +416,42 @@ discard block |
||
416 | 416 | function license_key_notice() { |
417 | 417 | |
418 | 418 | // Only show on GravityView pages |
419 | - if( ! gravityview_is_admin_page() ) { |
|
419 | + if ( ! gravityview_is_admin_page() ) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | - $license_status = self::getSetting('license_key_status'); |
|
424 | - $license_key = self::getSetting('license_key'); |
|
425 | - if( '' === $license_key ) { |
|
423 | + $license_status = self::getSetting( 'license_key_status' ); |
|
424 | + $license_key = self::getSetting( 'license_key' ); |
|
425 | + if ( '' === $license_key ) { |
|
426 | 426 | $license_status = 'inactive'; |
427 | 427 | } |
428 | 428 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
429 | 429 | |
430 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
430 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
431 | 431 | |
432 | 432 | /** |
433 | 433 | * I wanted to remove the period from after the buttons in the string, |
434 | 434 | * but didn't want to mess up the translation strings for the translators. |
435 | 435 | */ |
436 | 436 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
437 | - $title = __('Inactive License', 'gravityview'); |
|
437 | + $title = __( 'Inactive License', 'gravityview' ); |
|
438 | 438 | $status = ''; |
439 | 439 | $update_below = false; |
440 | 440 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
441 | 441 | switch ( $license_status ) { |
442 | 442 | /** @since 1.17 */ |
443 | 443 | case 'expired': |
444 | - $title = __('Expired License', 'gravityview'); |
|
444 | + $title = __( 'Expired License', 'gravityview' ); |
|
445 | 445 | $status = 'expired'; |
446 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
446 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
447 | 447 | break; |
448 | 448 | case 'invalid': |
449 | - $title = __('Invalid License', 'gravityview'); |
|
450 | - $status = __('is invalid', 'gravityview'); |
|
449 | + $title = __( 'Invalid License', 'gravityview' ); |
|
450 | + $status = __( 'is invalid', 'gravityview' ); |
|
451 | 451 | break; |
452 | 452 | case 'deactivated': |
453 | - $status = __('is inactive', 'gravityview'); |
|
454 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
453 | + $status = __( 'is inactive', 'gravityview' ); |
|
454 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
455 | 455 | break; |
456 | 456 | /** @noinspection PhpMissingBreakStatementInspection */ |
457 | 457 | case '': |
@@ -459,27 +459,27 @@ discard block |
||
459 | 459 | // break intentionally left blank |
460 | 460 | case 'inactive': |
461 | 461 | case 'site_inactive': |
462 | - $status = __('has not been activated', 'gravityview'); |
|
463 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
462 | + $status = __( 'has not been activated', 'gravityview' ); |
|
463 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
464 | 464 | break; |
465 | 465 | } |
466 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
466 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
467 | 467 | |
468 | 468 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
469 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
469 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
470 | 470 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
471 | 471 | } else { |
472 | 472 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
473 | 473 | } |
474 | 474 | |
475 | - if( !empty( $status ) ) { |
|
475 | + if ( ! empty( $status ) ) { |
|
476 | 476 | GravityView_Admin_Notices::add_notice( array( |
477 | 477 | 'message' => $message, |
478 | 478 | 'class' => 'updated', |
479 | 479 | 'title' => $title, |
480 | 480 | 'cap' => 'gravityview_edit_settings', |
481 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
482 | - )); |
|
481 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
482 | + ) ); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | |
492 | 492 | $styles = parent::styles(); |
493 | 493 | |
494 | - $styles[] = array( |
|
494 | + $styles[ ] = array( |
|
495 | 495 | 'handle' => 'gravityview_settings', |
496 | 496 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
497 | 497 | 'version' => GravityView_Plugin::version, |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @return void |
515 | 515 | */ |
516 | 516 | public function add_network_menu() { |
517 | - if( GravityView_Plugin::is_network_activated() ) { |
|
517 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
518 | 518 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
519 | 519 | } |
520 | 520 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * If multisite and not network admin, we don't want the settings to show. |
532 | 532 | * @since 1.7.6 |
533 | 533 | */ |
534 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
534 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
535 | 535 | |
536 | 536 | /** |
537 | 537 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | */ |
541 | 541 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
542 | 542 | |
543 | - if( $show_submenu ) { |
|
543 | + if ( $show_submenu ) { |
|
544 | 544 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
545 | 545 | } |
546 | 546 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * Backward compatibility with Redux |
581 | 581 | */ |
582 | - if( $setting_name === 'license' ) { |
|
582 | + if ( $setting_name === 'license' ) { |
|
583 | 583 | return array( |
584 | 584 | 'license' => parent::get_app_setting( 'license_key' ), |
585 | 585 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | |
644 | 644 | $return = $text . $activation; |
645 | 645 | |
646 | - if( $echo ) { |
|
646 | + if ( $echo ) { |
|
647 | 647 | echo $return; |
648 | 648 | } |
649 | 649 | |
@@ -670,15 +670,15 @@ discard block |
||
670 | 670 | */ |
671 | 671 | public function settings_submit( $field, $echo = true ) { |
672 | 672 | |
673 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
673 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
674 | 674 | |
675 | 675 | $attributes = $this->get_field_attributes( $field ); |
676 | 676 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
677 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
677 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
678 | 678 | |
679 | 679 | |
680 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
681 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
680 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
681 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
682 | 682 | |
683 | 683 | if ( empty( $value ) ) { |
684 | 684 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $attributes = $this->get_field_attributes( $field ); |
688 | 688 | |
689 | 689 | $html = '<input |
690 | - type="' . $field['type'] . '" |
|
690 | + type="' . $field[ 'type' ] . '" |
|
691 | 691 | name="' . esc_attr( $name ) . '" |
692 | 692 | value="' . $value . '" ' . |
693 | 693 | implode( ' ', $attributes ) . |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | * @return string |
710 | 710 | */ |
711 | 711 | public function settings_save( $field, $echo = true ) { |
712 | - $field['type'] = 'submit'; |
|
713 | - $field['name'] = 'gform-settings-save'; |
|
714 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
712 | + $field[ 'type' ] = 'submit'; |
|
713 | + $field[ 'name' ] = 'gform-settings-save'; |
|
714 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
715 | 715 | |
716 | 716 | if ( ! rgar( $field, 'value' ) ) { |
717 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
717 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | $output = $this->settings_submit( $field, false ); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $this->app_settings_uninstall_tab(); |
724 | 724 | $output .= ob_get_clean(); |
725 | 725 | |
726 | - if( $echo ) { |
|
726 | + if ( $echo ) { |
|
727 | 727 | echo $output; |
728 | 728 | } |
729 | 729 | |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | parent::single_setting_label( $field ); |
742 | 742 | |
743 | 743 | // Added by GravityView |
744 | - if ( isset( $field['description'] ) ) { |
|
745 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
744 | + if ( isset( $field[ 'description' ] ) ) { |
|
745 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | } |
@@ -804,11 +804,11 @@ discard block |
||
804 | 804 | |
805 | 805 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
806 | 806 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
807 | - if( $local_key !== $response_key ) { |
|
807 | + if ( $local_key !== $response_key ) { |
|
808 | 808 | |
809 | - unset( $posted_settings['license_key_response'] ); |
|
810 | - unset( $posted_settings['license_key_status'] ); |
|
811 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
809 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
810 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
811 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | return $posted_settings; |
@@ -843,25 +843,25 @@ discard block |
||
843 | 843 | 'label' => __( 'License Key', 'gravityview' ), |
844 | 844 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
845 | 845 | 'type' => 'edd_license', |
846 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
847 | - 'default_value' => $default_settings['license_key'], |
|
846 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
847 | + 'default_value' => $default_settings[ 'license_key' ], |
|
848 | 848 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
849 | 849 | ), |
850 | 850 | array( |
851 | 851 | 'name' => 'license_key_response', |
852 | - 'default_value' => $default_settings['license_key_response'], |
|
852 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
853 | 853 | 'type' => 'hidden', |
854 | 854 | ), |
855 | 855 | array( |
856 | 856 | 'name' => 'license_key_status', |
857 | - 'default_value' => $default_settings['license_key_status'], |
|
857 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
858 | 858 | 'type' => 'hidden', |
859 | 859 | ), |
860 | 860 | array( |
861 | 861 | 'name' => 'support-email', |
862 | 862 | 'type' => 'text', |
863 | 863 | 'validate' => 'email', |
864 | - 'default_value' => $default_settings['support-email'], |
|
864 | + 'default_value' => $default_settings[ 'support-email' ], |
|
865 | 865 | 'label' => __( 'Support Email', 'gravityview' ), |
866 | 866 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
867 | 867 | 'class' => 'code regular-text', |
@@ -873,38 +873,38 @@ discard block |
||
873 | 873 | 'name' => 'support_port', |
874 | 874 | 'type' => 'radio', |
875 | 875 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
876 | - 'default_value' => $default_settings['support_port'], |
|
876 | + 'default_value' => $default_settings[ 'support_port' ], |
|
877 | 877 | 'horizontal' => 1, |
878 | 878 | 'choices' => array( |
879 | 879 | array( |
880 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
880 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
881 | 881 | 'value' => '1', |
882 | 882 | ), |
883 | 883 | array( |
884 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
884 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
885 | 885 | 'value' => '0', |
886 | 886 | ), |
887 | 887 | ), |
888 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
888 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
889 | 889 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
890 | 890 | ), |
891 | 891 | array( |
892 | 892 | 'name' => 'no-conflict-mode', |
893 | 893 | 'type' => 'radio', |
894 | 894 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
895 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
895 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
896 | 896 | 'horizontal' => 1, |
897 | 897 | 'choices' => array( |
898 | 898 | array( |
899 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
899 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
900 | 900 | 'value' => '1', |
901 | 901 | ), |
902 | 902 | array( |
903 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
903 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
904 | 904 | 'value' => '0', |
905 | 905 | ), |
906 | 906 | ), |
907 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
907 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
908 | 908 | ), |
909 | 909 | ) ); |
910 | 910 | |
@@ -915,20 +915,20 @@ discard block |
||
915 | 915 | * @since 1.7.4 |
916 | 916 | */ |
917 | 917 | foreach ( $fields as &$field ) { |
918 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
919 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
920 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
921 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
918 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
919 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
920 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
921 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
922 | 922 | |
923 | - if( $disabled_attribute ) { |
|
924 | - $field['disabled'] = $disabled_attribute; |
|
923 | + if ( $disabled_attribute ) { |
|
924 | + $field[ 'disabled' ] = $disabled_attribute; |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | 928 | |
929 | 929 | $sections = array( |
930 | 930 | array( |
931 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
931 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
932 | 932 | 'fields' => $fields, |
933 | 933 | ) |
934 | 934 | ); |
@@ -939,8 +939,8 @@ discard block |
||
939 | 939 | 'type' => 'save', |
940 | 940 | ); |
941 | 941 | |
942 | - if( $disabled_attribute ) { |
|
943 | - $button['disabled'] = $disabled_attribute; |
|
942 | + if ( $disabled_attribute ) { |
|
943 | + $button[ 'disabled' ] = $disabled_attribute; |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | |
@@ -960,20 +960,20 @@ discard block |
||
960 | 960 | // If there are extensions, add a section for them |
961 | 961 | if ( ! empty( $extension_sections ) ) { |
962 | 962 | |
963 | - if( $disabled_attribute ) { |
|
963 | + if ( $disabled_attribute ) { |
|
964 | 964 | foreach ( $extension_sections as &$section ) { |
965 | - foreach ( $section['fields'] as &$field ) { |
|
966 | - $field['disabled'] = $disabled_attribute; |
|
965 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
966 | + $field[ 'disabled' ] = $disabled_attribute; |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | - $k = count( $extension_sections ) - 1 ; |
|
972 | - $extension_sections[ $k ]['fields'][] = $button; |
|
971 | + $k = count( $extension_sections ) - 1; |
|
972 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
973 | 973 | $sections = array_merge( $sections, $extension_sections ); |
974 | 974 | } else { |
975 | 975 | // add the 'update settings' button to the general section |
976 | - $sections[0]['fields'][] = $button; |
|
976 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | return $sections; |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
22 | 22 | |
23 | - unset( $field_options['search_filter'] ); |
|
23 | + unset( $field_options[ 'search_filter' ] ); |
|
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $add_options['link_to_file'] = array( |
|
29 | + $add_options[ 'link_to_file' ] = array( |
|
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
33 | 33 | 'value' => false, |
34 | 34 | 'merge_tags' => false, |
35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $output_arr = array(); |
66 | 66 | |
67 | 67 | // Get an array of file paths for the field. |
68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
69 | 69 | |
70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Process each file path |
82 | - foreach( $file_paths as $file_path ) { |
|
82 | + foreach ( $file_paths as $file_path ) { |
|
83 | 83 | |
84 | 84 | // If the site is HTTPS, use HTTPS |
85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
86 | 86 | |
87 | 87 | // This is from Gravity Forms's code |
88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
89 | 89 | |
90 | 90 | // If the field is set to link to the single entry, link to it. |
91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
92 | 92 | |
93 | 93 | // Get file path information |
94 | - $file_path_info = pathinfo($file_path); |
|
94 | + $file_path_info = pathinfo( $file_path ); |
|
95 | 95 | |
96 | 96 | $html_format = NULL; |
97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
100 | 100 | $disable_wrapped_link = false; |
101 | 101 | |
102 | 102 | // Is this an image? |
103 | - $image = new GravityView_Image(array( |
|
103 | + $image = new GravityView_Image( array( |
|
104 | 104 | 'src' => $file_path, |
105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
106 | - 'alt' => $field_settings['label'], |
|
107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
108 | - )); |
|
105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
106 | + 'alt' => $field_settings[ 'label' ], |
|
107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
108 | + ) ); |
|
109 | 109 | |
110 | 110 | $content = $image->html(); |
111 | 111 | |
112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
114 | 114 | |
115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
117 | 117 | |
118 | 118 | |
119 | - switch( true ) { |
|
119 | + switch ( true ) { |
|
120 | 120 | |
121 | 121 | // Audio file |
122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
123 | 123 | |
124 | 124 | $disable_lightbox = true; |
125 | 125 | |
126 | - if( shortcode_exists( 'audio' ) ) { |
|
126 | + if ( shortcode_exists( 'audio' ) ) { |
|
127 | 127 | |
128 | 128 | $disable_wrapped_link = true; |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
136 | 136 | 'src' => $file_path, |
137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
138 | - )); |
|
137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
138 | + ) ); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $disable_lightbox = true; |
155 | 155 | |
156 | - if( shortcode_exists( 'video' ) ) { |
|
156 | + if ( shortcode_exists( 'video' ) ) { |
|
157 | 157 | |
158 | 158 | $disable_wrapped_link = true; |
159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
166 | 166 | 'src' => $file_path, |
167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
168 | - )); |
|
167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
168 | + ) ); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
191 | 191 | |
192 | 192 | $disable_lightbox = true; |
193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | |
198 | 198 | // If using Link to File, override the content. |
199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
201 | 201 | |
202 | 202 | // Force the content to be the file name |
203 | - $content = $file_path_info["basename"]; |
|
203 | + $content = $file_path_info[ "basename" ]; |
|
204 | 204 | |
205 | 205 | // Restore the wrapped link |
206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Whether to use lightbox or not |
211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
212 | 212 | |
213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
214 | 214 | |
215 | 215 | } else { |
216 | 216 | |
217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
218 | 218 | |
219 | 219 | $link_atts = array( |
220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
241 | 241 | |
242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
256 | 256 | } |
257 | 257 | |
258 | - $output_arr[] = array( |
|
258 | + $output_arr[ ] = array( |
|
259 | 259 | 'file_path' => $file_path, |
260 | 260 | 'content' => $content |
261 | 261 | ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
65 | 65 | |
66 | - if( false === $approved_result || false === $disapproved_result ) { |
|
66 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
67 | 67 | do_action( 'gravityview_log_error', __METHOD__ . ': There was an error processing the query.', $wpdb->last_error ); |
68 | 68 | } else { |
69 | 69 | // All done: Meta values are migrated |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $redux_settings = $this->get_redux_settings(); |
97 | 97 | |
98 | 98 | // No need to process |
99 | - if( false === $redux_settings ) { |
|
99 | + if ( false === $redux_settings ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
103 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
104 | 104 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
105 | 105 | } |
106 | 106 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
115 | 115 | |
116 | 116 | // And now remove the previous option, so this is a one-time thing. |
117 | - delete_option('gravityview_settings'); |
|
118 | - delete_option('gravityview_settings-transients'); |
|
117 | + delete_option( 'gravityview_settings' ); |
|
118 | + delete_option( 'gravityview_settings-transients' ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $data = array( |
133 | 133 | 'edd_action' => 'check_license', |
134 | - 'license' => rgget('license_key', $redux_settings ), |
|
134 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
135 | 135 | 'update' => false, |
136 | 136 | 'format' => 'object', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
140 | 140 | |
141 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | - $redux_settings['license_key_status'] = $license_call->license; |
|
143 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
141 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
143 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $redux_settings; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | function get_redux_settings() { |
155 | 155 | |
156 | 156 | // Previous settings set by Redux |
157 | - $redux_option = get_option('gravityview_settings'); |
|
157 | + $redux_option = get_option( 'gravityview_settings' ); |
|
158 | 158 | |
159 | 159 | // No Redux settings? Don't proceed. |
160 | - if( false === $redux_option ) { |
|
160 | + if ( false === $redux_option ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
168 | 168 | ); |
169 | 169 | |
170 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
170 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
171 | 171 | |
172 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
172 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
173 | 173 | |
174 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
174 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
175 | 175 | |
176 | 176 | // This contains the last response for license validation |
177 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
177 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
178 | 178 | |
179 | - $saved_license = rgget('license', $saved_values ); |
|
179 | + $saved_license = rgget( 'license', $saved_values ); |
|
180 | 180 | |
181 | 181 | // Only use the last-saved values if they are for the same license |
182 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
184 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
182 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
184 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** ---- Migrate from old search widget to new search widget ---- */ |
194 | 194 | function update_search_on_views() { |
195 | 195 | |
196 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
197 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
196 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
197 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Loop through all the views |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | $views = get_posts( $query_args ); |
208 | 208 | |
209 | - foreach( $views as $view ) { |
|
209 | + foreach ( $views as $view ) { |
|
210 | 210 | |
211 | 211 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
212 | 212 | $search_fields = null; |
213 | 213 | |
214 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
214 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
215 | 215 | |
216 | 216 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
217 | 217 | |
218 | - foreach( $widgets as $area => $ws ) { |
|
219 | - foreach( $ws as $k => $widget ) { |
|
220 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
218 | + foreach ( $widgets as $area => $ws ) { |
|
219 | + foreach ( $ws as $k => $widget ) { |
|
220 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
221 | 221 | |
222 | - if( is_null( $search_fields ) ) { |
|
222 | + if ( is_null( $search_fields ) ) { |
|
223 | 223 | $search_fields = $this->get_search_fields( $view->ID ); |
224 | 224 | } |
225 | 225 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | // [search_free] => 1 |
228 | 228 | // [search_date] => 1 |
229 | 229 | $search_generic = array(); |
230 | - if( !empty( $widget['search_free'] ) ) { |
|
231 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
230 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
231 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
232 | 232 | } |
233 | - if( !empty( $widget['search_date'] ) ) { |
|
234 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
233 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
234 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $search_config = array_merge( $search_generic, $search_fields ); |
238 | 238 | |
239 | 239 | // don't throw '[]' when json_encode an empty array |
240 | - if( empty( $search_config ) ) { |
|
240 | + if ( empty( $search_config ) ) { |
|
241 | 241 | $search_config = ''; |
242 | 242 | } else { |
243 | 243 | $search_config = json_encode( $search_config ); |
244 | 244 | } |
245 | 245 | |
246 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
247 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
246 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
247 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
248 | 248 | |
249 | 249 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
250 | 250 | } |
@@ -272,26 +272,26 @@ discard block |
||
272 | 272 | // check view fields' settings |
273 | 273 | $fields = gravityview_get_directory_fields( $view_id, false ); |
274 | 274 | |
275 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
275 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
276 | 276 | |
277 | - foreach( $fields as $t => $fs ) { |
|
277 | + foreach ( $fields as $t => $fs ) { |
|
278 | 278 | |
279 | - foreach( $fs as $k => $field ) { |
|
279 | + foreach ( $fs as $k => $field ) { |
|
280 | 280 | // is field a search_filter ? |
281 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
281 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
282 | 282 | |
283 | 283 | // get field type & calculate the input type (by default) |
284 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
284 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
285 | 285 | |
286 | - if( empty( $form_field['type'] ) ) { |
|
286 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // depending on the field type assign a group of possible search field types |
291 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
291 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
292 | 292 | |
293 | 293 | // add field to config |
294 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
294 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
76 | 76 | |
77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
77 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
78 | 78 | |
79 | 79 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
80 | 80 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
81 | - )); |
|
81 | + ) ); |
|
82 | 82 | |
83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
83 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | function widget( $args, $instance ) { |
96 | 96 | |
97 | 97 | // Don't have the Customizer render too soon. |
98 | - if( empty( $instance['view_id'] ) ) { |
|
98 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
102 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
103 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
104 | 104 | |
105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
105 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
106 | 106 | |
107 | - echo $args['before_widget']; |
|
107 | + echo $args[ 'before_widget' ]; |
|
108 | 108 | |
109 | - if ( !empty( $title ) ) { |
|
110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
109 | + if ( ! empty( $title ) ) { |
|
110 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
129 | 129 | |
130 | - echo $args['after_widget']; |
|
130 | + echo $args[ 'after_widget' ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function get_output( $instance ) { |
143 | 143 | |
144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
144 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
145 | 145 | |
146 | 146 | $form = gravityview_get_form( $form_id ); |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @since 1.6.1 |
152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
153 | 153 | */ |
154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
154 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Generate list output |
158 | 158 | * @since 1.7.2 |
159 | 159 | */ |
160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
160 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
161 | 161 | |
162 | 162 | $output = $List->get_output(); |
163 | 163 | |
@@ -182,30 +182,30 @@ discard block |
||
182 | 182 | private function get_entries( $instance, $form_id ) { |
183 | 183 | |
184 | 184 | // Get the settings for the View ID |
185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
185 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
186 | 186 | |
187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
188 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
191 | - $view_settings['id'] = $instance['view_id']; |
|
192 | - $view_settings['page_size'] = $instance['limit']; |
|
190 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
191 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
192 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
193 | 193 | |
194 | 194 | // Prepare paging criteria |
195 | - $criteria['paging'] = array( |
|
195 | + $criteria[ 'paging' ] = array( |
|
196 | 196 | 'offset' => 0, |
197 | - 'page_size' => $instance['limit'] |
|
197 | + 'page_size' => $instance[ 'limit' ] |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Prepare Search Criteria |
201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
201 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
202 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
203 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Modify the search parameters before the entries are fetched |
207 | 207 | */ |
208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
208 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
209 | 209 | |
210 | 210 | $results = GVCommon::get_entries( $form_id, $criteria ); |
211 | 211 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | $instance = $new_instance; |
227 | 227 | |
228 | 228 | // Force positive number |
229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
229 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
230 | 230 | |
231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
231 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
232 | 232 | |
233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
233 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
234 | 234 | |
235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
235 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
236 | 236 | |
237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
237 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
238 | 238 | |
239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
240 | 240 | |
241 | 241 | //check if post_id is a valid post with embedded View |
242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
242 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
243 | 243 | |
244 | 244 | // Share that the widget isn't brand new |
245 | - $instance['updated'] = 1; |
|
245 | + $instance[ 'updated' ] = 1; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
267 | - 'title' => __('Recent Entries', 'gravityview'), |
|
267 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
268 | 268 | 'view_id' => NULL, |
269 | 269 | 'post_id' => NULL, |
270 | 270 | 'limit' => 10, |
271 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
271 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
272 | 272 | 'after_link' => '' |
273 | 273 | ); |
274 | 274 | |
275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
275 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
276 | 276 | |
277 | 277 | ?> |
278 | 278 | |
279 | 279 | <!-- Title --> |
280 | 280 | <p> |
281 | 281 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
282 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $views = get_posts( $args ); |
293 | 293 | |
294 | 294 | // If there are no views set up yet, we get outta here. |
295 | - if( empty( $views ) ) { |
|
295 | + if ( empty( $views ) ) { |
|
296 | 296 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
297 | 297 | return; |
298 | 298 | } |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Display errors generated for invalid embed IDs |
305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
306 | 306 | */ |
307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
307 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
308 | 308 | ?> |
309 | 309 | <div class="error inline hide-on-view-change"> |
310 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
310 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | unset ( $error ); |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | ?> |
316 | 316 | |
317 | 317 | <p> |
318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
318 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
319 | 319 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
320 | 320 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
321 | 321 | <?php |
322 | 322 | |
323 | - foreach( $views as $view ) { |
|
324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
323 | + foreach ( $views as $view ) { |
|
324 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
325 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * Display errors generated for invalid embed IDs |
335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
336 | 336 | */ |
337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
337 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
338 | 338 | ?> |
339 | 339 | <div class="error inline"> |
340 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
340 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
341 | 341 | </div> |
342 | 342 | <?php |
343 | 343 | unset ( $error ); |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | |
347 | 347 | <p> |
348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
348 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
350 | 350 | <span class="howto"><?php |
351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
353 | 353 | ?></span> |
354 | 354 | </p> |
355 | 355 | |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
358 | 358 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
359 | 359 | </label> |
360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
360 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
364 | 364 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
365 | 365 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
366 | 366 | </label> |
367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
367 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
371 | 371 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
372 | 372 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
373 | 373 | </label> |
374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
374 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
375 | 375 | </p> |
376 | 376 | |
377 | 377 | <?php |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
382 | 382 | * @param array $instance Current widget instance |
383 | 383 | */ |
384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
384 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
385 | 385 | |
386 | 386 | ?> |
387 | 387 |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | $new_value = $old_value; |
114 | 114 | |
115 | 115 | // Meta value does not exist yet |
116 | - if( false === $old_value ) { |
|
116 | + if ( false === $old_value ) { |
|
117 | 117 | return self::UNAPPROVED; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Meta value does not exist yet |
121 | - if( true === $old_value ) { |
|
121 | + if ( true === $old_value ) { |
|
122 | 122 | return self::APPROVED; |
123 | 123 | } |
124 | 124 | |
125 | - switch ( (string) $old_value ) { |
|
125 | + switch ( (string)$old_value ) { |
|
126 | 126 | |
127 | 127 | // Approved values |
128 | 128 | case 'Approved': |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | foreach ( $choices as $key => $choice ) { |
248 | 248 | |
249 | 249 | // Is the passed status value the same as the choice value or key? |
250 | - if ( $status === $choice['value'] || $status === $key ) { |
|
250 | + if ( $status === $choice[ 'value' ] || $status === $key ) { |
|
251 | 251 | |
252 | - if( 'key' === $attr_key ) { |
|
252 | + if ( 'key' === $attr_key ) { |
|
253 | 253 | return $key; |
254 | 254 | } else { |
255 | 255 | return rgar( $choice, $attr_key, false ); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | // Load even when invalid to allow for export |
20 | 20 | add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) ); |
21 | 21 | |
22 | - if( GravityView_Compatibility::is_valid() ) { |
|
22 | + if ( GravityView_Compatibility::is_valid() ) { |
|
23 | 23 | add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) ); |
24 | 24 | } |
25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | $supports = array( 'title', 'revisions' ); |
45 | 45 | |
46 | - if( $is_hierarchical ) { |
|
47 | - $supports[] = 'page-attributes'; |
|
46 | + if ( $is_hierarchical ) { |
|
47 | + $supports[ ] = 'page-attributes'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | |
64 | 64 | add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) ); |
65 | 65 | |
66 | - add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 ); |
|
67 | - add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
68 | - add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
66 | + add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 ); |
|
67 | + add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
68 | + add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
69 | 69 | |
70 | - add_action( 'wp', array( $this, 'maybe_add_note'), 1000 ); |
|
71 | - add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') ); |
|
72 | - add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') ); |
|
70 | + add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 ); |
|
71 | + add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
72 | + add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
73 | 73 | |
74 | 74 | // add template path to check for field |
75 | 75 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
76 | 76 | |
77 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
77 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
78 | 78 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); |
79 | 79 | |
80 | 80 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 ); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function add_entry_default_field( $entry_default_fields, $form, $zone ) { |
98 | 98 | |
99 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
100 | - $entry_default_fields['notes'] = array( |
|
99 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
100 | + $entry_default_fields[ 'notes' ] = array( |
|
101 | 101 | 'label' => __( 'Entry Notes', 'gravityview' ), |
102 | 102 | 'type' => 'notes', |
103 | 103 | 'desc' => __( 'Display, add, and delete notes for an entry.', 'gravityview' ), |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | public function enqueue_scripts() { |
131 | 131 | global $wp_actions; |
132 | 132 | |
133 | - if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
133 | + if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
134 | 134 | wp_enqueue_style( 'gravityview-notes' ); |
135 | 135 | wp_enqueue_script( 'gravityview-notes' ); |
136 | 136 | } |
137 | 137 | |
138 | - if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
138 | + if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
139 | 139 | |
140 | 140 | $strings = self::strings(); |
141 | 141 | |
142 | 142 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( |
143 | 143 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
144 | 144 | 'text' => array( |
145 | - 'processing' => $strings['processing'], |
|
146 | - 'delete_confirm' => $strings['delete-confirm'], |
|
147 | - 'note_added' => $strings['added-note'], |
|
148 | - 'error_invalid' => $strings['error-invalid'], |
|
149 | - 'error_empty_note' => $strings['error-empty-note'], |
|
145 | + 'processing' => $strings[ 'processing' ], |
|
146 | + 'delete_confirm' => $strings[ 'delete-confirm' ], |
|
147 | + 'note_added' => $strings[ 'added-note' ], |
|
148 | + 'error_invalid' => $strings[ 'error-invalid' ], |
|
149 | + 'error_empty_note' => $strings[ 'error-empty-note' ], |
|
150 | 150 | ), |
151 | 151 | ) ); |
152 | 152 | } |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function maybe_add_note() { |
165 | 165 | |
166 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
166 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
167 | 167 | do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - if( 'gv_note_add' === rgpost('action') ) { |
|
171 | + if ( 'gv_note_add' === rgpost( 'action' ) ) { |
|
172 | 172 | |
173 | 173 | $post = wp_unslash( $_POST ); |
174 | 174 | |
175 | - if( $this->doing_ajax ) { |
|
176 | - parse_str( $post['data'], $data ); |
|
175 | + if ( $this->doing_ajax ) { |
|
176 | + parse_str( $post[ 'data' ], $data ); |
|
177 | 177 | } else { |
178 | 178 | $data = $post; |
179 | 179 | } |
180 | 180 | |
181 | - $this->process_add_note( (array) $data ); |
|
181 | + $this->process_add_note( (array)$data ); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -205,23 +205,23 @@ discard block |
||
205 | 205 | $error = false; |
206 | 206 | $success = false; |
207 | 207 | |
208 | - if( empty( $data['entry-slug'] ) ) { |
|
208 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
209 | 209 | |
210 | - $error = self::strings('error-invalid'); |
|
210 | + $error = self::strings( 'error-invalid' ); |
|
211 | 211 | do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' ); |
212 | 212 | |
213 | 213 | } else { |
214 | 214 | |
215 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
215 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
216 | 216 | |
217 | 217 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
218 | 218 | |
219 | - if( ! $has_cap ) { |
|
219 | + if ( ! $has_cap ) { |
|
220 | 220 | $error = self::strings( 'error-cap-add' ); |
221 | 221 | do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
222 | 222 | } elseif ( $valid ) { |
223 | 223 | |
224 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
224 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
225 | 225 | |
226 | 226 | $added = $this->add_note( $entry, $data ); |
227 | 227 | |
@@ -239,22 +239,22 @@ discard block |
||
239 | 239 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
240 | 240 | |
241 | 241 | if ( $note ) { |
242 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
243 | - do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') ); |
|
242 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
243 | + do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) ); |
|
244 | 244 | } else { |
245 | - $error = self::strings('error-add-note'); |
|
246 | - do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') ); |
|
245 | + $error = self::strings( 'error-add-note' ); |
|
246 | + do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) ); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } else { |
250 | - $error = self::strings('error-invalid'); |
|
250 | + $error = self::strings( 'error-invalid' ); |
|
251 | 251 | do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | |
256 | - if( $this->doing_ajax ) { |
|
257 | - if( $success ) { |
|
256 | + if ( $this->doing_ajax ) { |
|
257 | + if ( $success ) { |
|
258 | 258 | wp_send_json_success( array( 'html' => $success ) ); |
259 | 259 | } else { |
260 | 260 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | return; |
281 | 281 | } |
282 | 282 | |
283 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
283 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
284 | 284 | |
285 | 285 | $post = wp_unslash( $_POST ); |
286 | 286 | if ( $this->doing_ajax ) { |
287 | - parse_str( $post['data'], $data ); |
|
287 | + parse_str( $post[ 'data' ], $data ); |
|
288 | 288 | } else { |
289 | 289 | $data = $post; |
290 | 290 | } |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function process_delete_notes( $data ) { |
317 | 317 | |
318 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
318 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
319 | 319 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
320 | 320 | $success = false; |
321 | 321 | |
322 | 322 | if ( $valid && $has_cap ) { |
323 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
323 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
324 | 324 | $success = true; |
325 | 325 | } |
326 | 326 | |
327 | - if( $this->doing_ajax ) { |
|
327 | + if ( $this->doing_ajax ) { |
|
328 | 328 | |
329 | - if( $success ) { |
|
329 | + if ( $success ) { |
|
330 | 330 | wp_send_json_success(); |
331 | 331 | } else { |
332 | 332 | if ( ! $valid ) { |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | |
360 | 360 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
361 | 361 | |
362 | - unset( $field_options['show_as_link'] ); |
|
362 | + unset( $field_options[ 'show_as_link' ] ); |
|
363 | 363 | |
364 | 364 | $notes_options = array( |
365 | 365 | 'notes' => array( |
366 | 366 | 'type' => 'checkboxes', |
367 | - 'label' => __('Note Settings', 'gravityview'), |
|
368 | - 'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
367 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
368 | + 'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
369 | 369 | 'options' => array( |
370 | 370 | 'view' => array( |
371 | 371 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | 'processing' => __( 'Processing…', 'gravityview' ), |
418 | 418 | 'other-email' => __( 'Other email address', 'gravityview' ), |
419 | 419 | 'email-label' => __( 'Email address', 'gravityview' ), |
420 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
420 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
421 | 421 | 'subject-label' => __( 'Subject', 'gravityview' ), |
422 | 422 | 'subject' => __( 'Email subject', 'gravityview' ), |
423 | 423 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
439 | 439 | |
440 | - if( $key ) { |
|
440 | + if ( $key ) { |
|
441 | 441 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
442 | 442 | } |
443 | 443 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | static public function display_note( $note, $show_delete = false ) { |
458 | 458 | |
459 | - if( ! is_object( $note ) ) { |
|
459 | + if ( ! is_object( $note ) ) { |
|
460 | 460 | return ''; |
461 | 461 | } |
462 | 462 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $note_row = ob_get_clean(); |
498 | 498 | |
499 | 499 | $replacements = array( |
500 | - '{note_id}' => $note_content['note_id'], |
|
500 | + '{note_id}' => $note_content[ 'note_id' ], |
|
501 | 501 | '{row_class}' => 'gv-note', |
502 | 502 | '{note_detail}' => $note_detail_html |
503 | 503 | ); |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | |
530 | 530 | $user_data = get_userdata( $current_user->ID ); |
531 | 531 | |
532 | - $note_content = trim( $data['gv-note-content'] ); |
|
532 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
533 | 533 | |
534 | - if( empty( $note_content ) ) { |
|
534 | + if ( empty( $note_content ) ) { |
|
535 | 535 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
536 | 536 | } |
537 | 537 | |
538 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
538 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
539 | 539 | |
540 | 540 | return $return; |
541 | 541 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public static function get_add_note_part() { |
553 | 553 | |
554 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
554 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
555 | 555 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
556 | 556 | return ''; |
557 | 557 | } |
@@ -564,19 +564,19 @@ discard block |
||
564 | 564 | |
565 | 565 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
566 | 566 | $entry = $gravityview_view->getCurrentEntry(); |
567 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
567 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
568 | 568 | $nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false ); |
569 | 569 | |
570 | 570 | // Only generate the dropdown if the field settings allow it |
571 | 571 | $email_fields = ''; |
572 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
572 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
573 | 573 | $email_fields = self::get_note_email_fields( $entry_slug ); |
574 | 574 | } |
575 | 575 | |
576 | 576 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
577 | 577 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
578 | - $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html ); |
|
579 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
578 | + $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
579 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
580 | 580 | $add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html ); |
581 | 581 | |
582 | 582 | return $add_note_html; |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | $note_emails = array(); |
602 | 602 | |
603 | 603 | foreach ( $email_fields as $email_field ) { |
604 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
605 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
604 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
605 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | */ |
615 | 615 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
616 | 616 | |
617 | - return (array) $note_emails; |
|
617 | + return (array)$note_emails; |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /** |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | */ |
631 | 631 | private static function get_note_email_fields( $entry_slug = '' ) { |
632 | 632 | |
633 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
633 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
634 | 634 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
635 | 635 | return ''; |
636 | 636 | } |
@@ -652,27 +652,27 @@ discard block |
||
652 | 652 | |
653 | 653 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
654 | 654 | <div class="gv-note-email-container"> |
655 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
655 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
656 | 656 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
657 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
657 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
658 | 658 | <?php foreach ( $note_emails as $email ) { |
659 | 659 | ?> |
660 | 660 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
661 | 661 | <?php } |
662 | - if( $include_custom ) { ?> |
|
663 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
662 | + if ( $include_custom ) { ?> |
|
663 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
664 | 664 | <?php } ?> |
665 | 665 | </select> |
666 | 666 | <fieldset class="gv-note-to-container"> |
667 | - <?php if( $include_custom ) { ?> |
|
667 | + <?php if ( $include_custom ) { ?> |
|
668 | 668 | <div class='gv-note-to-custom-container'> |
669 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
670 | - <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
669 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
670 | + <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
671 | 671 | </div> |
672 | 672 | <?php } ?> |
673 | 673 | <div class='gv-note-subject-container'> |
674 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
675 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
674 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
675 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
676 | 676 | </div> |
677 | 677 | </fieldset> |
678 | 678 | </div> |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | */ |
696 | 696 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
697 | 697 | |
698 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
698 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
699 | 699 | do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note ); |
700 | 700 | return; |
701 | 701 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data ); |
704 | 704 | |
705 | 705 | //emailing notes if configured |
706 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
706 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
707 | 707 | |
708 | 708 | $default_data = array( |
709 | 709 | 'gv-note-to' => '', |
@@ -713,11 +713,11 @@ discard block |
||
713 | 713 | 'current-url' => '', |
714 | 714 | ); |
715 | 715 | |
716 | - $current_user = wp_get_current_user(); |
|
716 | + $current_user = wp_get_current_user(); |
|
717 | 717 | $email_data = wp_parse_args( $data, $default_data ); |
718 | 718 | |
719 | - $from = $current_user->user_email; |
|
720 | - $to = $email_data['gv-note-to']; |
|
719 | + $from = $current_user->user_email; |
|
720 | + $to = $email_data[ 'gv-note-to' ]; |
|
721 | 721 | |
722 | 722 | /** |
723 | 723 | * Documented in get_note_email_fields |
@@ -725,8 +725,8 @@ discard block |
||
725 | 725 | */ |
726 | 726 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
727 | 727 | |
728 | - if( 'custom' === $to && $include_custom ) { |
|
729 | - $to = $email_data['gv-note-to-custom']; |
|
728 | + if ( 'custom' === $to && $include_custom ) { |
|
729 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
730 | 730 | do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to ); |
731 | 731 | } |
732 | 732 | |
@@ -737,13 +737,13 @@ discard block |
||
737 | 737 | |
738 | 738 | $bcc = false; |
739 | 739 | $reply_to = $from; |
740 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
740 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
741 | 741 | |
742 | 742 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
743 | 743 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
744 | - $message = $email_data['gv-note-content']; |
|
744 | + $message = $email_data[ 'gv-note-content' ]; |
|
745 | 745 | $email_footer = self::strings( 'email-footer' ); |
746 | - $from_name = $current_user->display_name; |
|
746 | + $from_name = $current_user->display_name; |
|
747 | 747 | $message_format = 'html'; |
748 | 748 | |
749 | 749 | /** |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | |
775 | 775 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
776 | 776 | |
777 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
777 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
778 | 778 | |
779 | 779 | /** |
780 | 780 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | |
801 | 801 | $output = ''; |
802 | 802 | |
803 | - if( ! empty( $email_footer ) ) { |
|
803 | + if ( ! empty( $email_footer ) ) { |
|
804 | 804 | $url = rgar( $email_data, 'current-url' ); |
805 | 805 | $url = html_entity_decode( $url ); |
806 | 806 | $url = site_url( $url ); |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
50 | 50 | |
51 | 51 | // Get details about the current View |
52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
87 | 87 | |
88 | 88 | // Only keep the passed attributes after making sure that they're valid pairs |
89 | - $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts; |
|
89 | + $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts; |
|
90 | 90 | |
91 | 91 | $atts = array(); |
92 | 92 | |
93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
94 | 94 | |
95 | 95 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
96 | 96 | $passed_value = GravityView_Merge_Tags::replace_variables( $passed_value ); |
97 | 97 | |
98 | - switch( $defaults[ $key ]['type'] ) { |
|
98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
104 | 104 | */ |
105 | 105 | case 'number': |
106 | - if( is_numeric( $passed_value ) ) { |
|
106 | + if ( is_numeric( $passed_value ) ) { |
|
107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
108 | 108 | } |
109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | case 'select': |
120 | 120 | case 'radio': |
121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
123 | 123 | $atts[ $key ] = $passed_value; |
124 | 124 | } |
125 | 125 | break; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
149 | 149 | $return = ''; |
150 | 150 | |
151 | - switch( $detail ) { |
|
151 | + switch ( $detail ) { |
|
152 | 152 | case 'total_entries': |
153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
154 | 154 | break; |