@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | function gravityview_register_gravityview_widgets() { |
22 | 22 | |
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
24 | 24 | |
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
30 | 30 | |
31 | - if( class_exists('GFPolls') ) { |
|
32 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
31 | + if ( class_exists( 'GFPolls' ) ) { |
|
32 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $gv_page = gravityview()->request->is_admin( '', 'single' ); |
79 | 79 | |
80 | 80 | // New View or Edit View page |
81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
83 | 83 | } |
84 | 84 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | parent::add_hooks(); |
69 | 69 | |
70 | - if( gravityview()->request->is_admin( '', null ) ) { |
|
70 | + if ( gravityview()->request->is_admin( '', null ) ) { |
|
71 | 71 | |
72 | 72 | // Make Yoast metabox go down to the bottom please. |
73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, 'return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function disable_content_analysis( $options ) { |
94 | 94 | |
95 | - $options['keyword_analysis_active'] = false; |
|
96 | - $options['content_analysis_active'] = false; |
|
95 | + $options[ 'keyword_analysis_active' ] = false; |
|
96 | + $options[ 'content_analysis_active' ] = false; |
|
97 | 97 | |
98 | 98 | return $options; |
99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | global $pagenow; |
113 | 113 | |
114 | 114 | // New View page |
115 | - if( $pagenow === 'post-new.php' ) { |
|
116 | - $options['hideeditbox-gravityview'] = true; |
|
115 | + if ( $pagenow === 'post-new.php' ) { |
|
116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return $options; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return array |
103 | 103 | */ |
104 | 104 | public function modify_app_settings_menu_title( $setting_tabs ) { |
105 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
105 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
106 | 106 | return $setting_tabs; |
107 | 107 | } |
108 | 108 | |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | </ul> |
309 | 309 | <div class="gv-followup widefat"> |
310 | 310 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
311 | - <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> |
|
311 | + <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> |
|
312 | 312 | </div> |
313 | 313 | <div class="scale-description"> |
314 | 314 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
315 | 315 | <ul class="inline"> |
316 | 316 | <?php |
317 | 317 | $i = 0; |
318 | - while( $i < 11 ) { |
|
319 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
318 | + while ( $i < 11 ) { |
|
319 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
320 | 320 | $i++; |
321 | 321 | } |
322 | 322 | ?> |
@@ -533,15 +533,15 @@ discard block |
||
533 | 533 | * @return string The HTML |
534 | 534 | */ |
535 | 535 | public function as_html( $field, $echo = true ) { |
536 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
536 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
537 | 537 | |
538 | 538 | $attributes = $this->get_field_attributes( $field ); |
539 | 539 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
540 | - $value = $this->get( $field['name'], $default_value ); |
|
540 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
541 | 541 | |
542 | 542 | |
543 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
544 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
543 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
544 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
545 | 545 | |
546 | 546 | if ( empty( $value ) ) { |
547 | 547 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $attributes = $this->get_field_attributes( $field ); |
551 | 551 | |
552 | 552 | $html = '<input |
553 | - type="' . $field['type'] . '" |
|
553 | + type="' . $field[ 'type' ] . '" |
|
554 | 554 | name="' . esc_attr( $name ) . '" |
555 | 555 | value="' . $value . '" ' . |
556 | 556 | implode( ' ', $attributes ) . |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @return bool |
582 | 582 | */ |
583 | 583 | public function is_save_postback() { |
584 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
584 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function license_key_notice() { |
593 | 593 | |
594 | - if( $this->is_save_postback() ) { |
|
594 | + if ( $this->is_save_postback() ) { |
|
595 | 595 | $settings = $this->get_posted_settings(); |
596 | 596 | $license_key = \GV\Utils::get( $settings, 'license_key' ); |
597 | 597 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * but didn't want to mess up the translation strings for the translators. |
613 | 613 | */ |
614 | 614 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
615 | - $title = __( 'Inactive License', 'gravityview'); |
|
615 | + $title = __( 'Inactive License', 'gravityview' ); |
|
616 | 616 | $status = ''; |
617 | 617 | $update_below = false; |
618 | 618 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
643 | 643 | break; |
644 | 644 | } |
645 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
645 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
646 | 646 | |
647 | 647 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
648 | 648 | if ( $update_below && gravityview()->request->is_admin( '', 'settings' ) ) { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | public function scripts() { |
687 | 687 | $scripts = parent::scripts(); |
688 | 688 | |
689 | - $scripts[] = array( |
|
689 | + $scripts[ ] = array( |
|
690 | 690 | 'handle' => 'gform_tooltip_init', |
691 | 691 | 'enqueue' => array( |
692 | 692 | array( |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | public function styles() { |
706 | 706 | $styles = parent::styles(); |
707 | 707 | |
708 | - $styles[] = array( |
|
708 | + $styles[ ] = array( |
|
709 | 709 | 'handle' => 'gravityview_settings', |
710 | 710 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
711 | 711 | 'version' => Plugin::$version, |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * If multisite and not network admin, we don't want the settings to show. |
737 | 737 | * @since 1.7.6 |
738 | 738 | */ |
739 | - $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
739 | + $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -784,26 +784,26 @@ discard block |
||
784 | 784 | 'label' => __( 'License Key', 'gravityview' ), |
785 | 785 | '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' ) ), |
786 | 786 | 'type' => 'edd_license', |
787 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
787 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
788 | 788 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
789 | - 'default_value' => $default_settings['license_key'], |
|
789 | + 'default_value' => $default_settings[ 'license_key' ], |
|
790 | 790 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
791 | 791 | ), |
792 | 792 | array( |
793 | 793 | 'name' => 'license_key_response', |
794 | - 'default_value' => $default_settings['license_key_response'], |
|
794 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
795 | 795 | 'type' => 'hidden', |
796 | 796 | ), |
797 | 797 | array( |
798 | 798 | 'name' => 'license_key_status', |
799 | - 'default_value' => $default_settings['license_key_status'], |
|
799 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
800 | 800 | 'type' => 'hidden', |
801 | 801 | ), |
802 | 802 | array( |
803 | 803 | 'name' => 'support-email', |
804 | 804 | 'type' => 'text', |
805 | 805 | 'validate' => 'email', |
806 | - 'default_value' => $default_settings['support-email'], |
|
806 | + 'default_value' => $default_settings[ 'support-email' ], |
|
807 | 807 | 'label' => __( 'Support Email', 'gravityview' ), |
808 | 808 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
809 | 809 | 'class' => 'code regular-text', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | 'name' => 'support_port', |
816 | 816 | 'type' => 'radio', |
817 | 817 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
818 | - 'default_value' => $default_settings['support_port'], |
|
818 | + 'default_value' => $default_settings[ 'support_port' ], |
|
819 | 819 | 'horizontal' => 1, |
820 | 820 | 'choices' => array( |
821 | 821 | array( |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | 'name' => 'no-conflict-mode', |
835 | 835 | 'type' => 'radio', |
836 | 836 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
837 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
837 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
838 | 838 | 'horizontal' => 1, |
839 | 839 | 'choices' => array( |
840 | 840 | array( |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | 'name' => 'rest_api', |
857 | 857 | 'type' => 'radio', |
858 | 858 | 'label' => __( 'REST API', 'gravityview' ), |
859 | - 'default_value' => $default_settings['rest_api'], |
|
859 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
860 | 860 | 'horizontal' => 1, |
861 | 861 | 'choices' => array( |
862 | 862 | array( |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | 'name' => 'beta', |
876 | 876 | 'type' => 'checkbox', |
877 | 877 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
878 | - 'default_value' => $default_settings['beta'], |
|
878 | + 'default_value' => $default_settings[ 'beta' ], |
|
879 | 879 | 'horizontal' => 1, |
880 | 880 | 'choices' => array( |
881 | 881 | array( |
@@ -908,17 +908,17 @@ discard block |
||
908 | 908 | * @since 1.7.4 |
909 | 909 | */ |
910 | 910 | foreach ( $fields as &$field ) { |
911 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
912 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
913 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
914 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
911 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
912 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
913 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
914 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
915 | 915 | |
916 | 916 | if ( $disabled_attribute ) { |
917 | - $field['disabled'] = $disabled_attribute; |
|
917 | + $field[ 'disabled' ] = $disabled_attribute; |
|
918 | 918 | } |
919 | 919 | |
920 | - if ( empty( $field['disabled'] ) ) { |
|
921 | - unset( $field['disabled'] ); |
|
920 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
921 | + unset( $field[ 'disabled' ] ); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | ); |
937 | 937 | |
938 | 938 | if ( $disabled_attribute ) { |
939 | - $button['disabled'] = $disabled_attribute; |
|
939 | + $button[ 'disabled' ] = $disabled_attribute; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | /** |
@@ -955,20 +955,20 @@ discard block |
||
955 | 955 | // If there are extensions, add a section for them |
956 | 956 | if ( ! empty( $extension_sections ) ) { |
957 | 957 | |
958 | - if( $disabled_attribute ) { |
|
958 | + if ( $disabled_attribute ) { |
|
959 | 959 | foreach ( $extension_sections as &$section ) { |
960 | - foreach ( $section['fields'] as &$field ) { |
|
961 | - $field['disabled'] = $disabled_attribute; |
|
960 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
961 | + $field[ 'disabled' ] = $disabled_attribute; |
|
962 | 962 | } |
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - $k = count( $extension_sections ) - 1 ; |
|
967 | - $extension_sections[ $k ]['fields'][] = $button; |
|
966 | + $k = count( $extension_sections ) - 1; |
|
967 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
968 | 968 | $sections = array_merge( $sections, $extension_sections ); |
969 | 969 | } else { |
970 | 970 | // add the 'update settings' button to the general section |
971 | - $sections[0]['fields'][] = $button; |
|
971 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | return $sections; |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | protected function settings_edd_license( $field, $echo = true ) { |
1025 | 1025 | |
1026 | 1026 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1027 | - $field['input_type'] = 'password'; |
|
1027 | + $field[ 'input_type' ] = 'password'; |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $text = $this->settings_text( $field, false ); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | public function single_setting_row_html( $field ) { |
1074 | 1074 | ?> |
1075 | 1075 | |
1076 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1076 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1077 | 1077 | <td colspan="2"> |
1078 | 1078 | <?php $this->single_setting( $field ); ?> |
1079 | 1079 | </td> |
@@ -1091,10 +1091,10 @@ discard block |
||
1091 | 1091 | * @return string |
1092 | 1092 | */ |
1093 | 1093 | public function settings_save( $field, $echo = true ) { |
1094 | - $field['type'] = 'submit'; |
|
1095 | - $field['name'] = 'gform-settings-save'; |
|
1096 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
1097 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1094 | + $field[ 'type' ] = 'submit'; |
|
1095 | + $field[ 'name' ] = 'gform-settings-save'; |
|
1096 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
1097 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1098 | 1098 | |
1099 | 1099 | $output = $this->settings_submit( $field, false ); |
1100 | 1100 | |
@@ -1125,8 +1125,8 @@ discard block |
||
1125 | 1125 | * @return void |
1126 | 1126 | */ |
1127 | 1127 | public function single_setting_row( $field ) { |
1128 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1129 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1128 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1129 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1130 | 1130 | parent::single_setting_row( $field ); |
1131 | 1131 | } |
1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | public function single_setting_label( $field ) { |
1139 | 1139 | parent::single_setting_label( $field ); |
1140 | 1140 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
1141 | - echo '<span class="description">'. $description .'</span>'; |
|
1141 | + echo '<span class="description">' . $description . '</span>'; |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
@@ -1175,9 +1175,9 @@ discard block |
||
1175 | 1175 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
1176 | 1176 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1177 | 1177 | if ( $local_key !== $response_key ) { |
1178 | - unset( $posted_settings['license_key_response'] ); |
|
1179 | - unset( $posted_settings['license_key_status'] ); |
|
1180 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1178 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1179 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1180 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1181 | 1181 | } |
1182 | 1182 | return $posted_settings; |
1183 | 1183 | } |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | type="' . $field['type'] . '" |
559 | 559 | name="' . esc_attr( $name ) . '" |
560 | 560 | value="' . $value . '" ' . |
561 | - implode( ' ', $attributes ) . |
|
562 | - ' />'; |
|
561 | + implode( ' ', $attributes ) . |
|
562 | + ' />'; |
|
563 | 563 | |
564 | 564 | if ( $echo ) { |
565 | 565 | echo $html; |
@@ -577,12 +577,12 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
580 | - * Check whether GravityView is being saved |
|
581 | - * |
|
582 | - * The generic is_save_postback() is true for all addons |
|
583 | - * |
|
584 | - * @since 2.0.8 |
|
585 | - * |
|
580 | + * Check whether GravityView is being saved |
|
581 | + * |
|
582 | + * The generic is_save_postback() is true for all addons |
|
583 | + * |
|
584 | + * @since 2.0.8 |
|
585 | + * |
|
586 | 586 | * @return bool |
587 | 587 | */ |
588 | 588 | public function is_save_postback() { |
@@ -596,16 +596,16 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public function license_key_notice() { |
598 | 598 | |
599 | - if( $this->is_save_postback() ) { |
|
600 | - $settings = $this->get_posted_settings(); |
|
601 | - $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
602 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
603 | - } else { |
|
604 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
605 | - $license_key = $this->get( 'license_key' ); |
|
606 | - } |
|
599 | + if( $this->is_save_postback() ) { |
|
600 | + $settings = $this->get_posted_settings(); |
|
601 | + $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
602 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
603 | + } else { |
|
604 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
605 | + $license_key = $this->get( 'license_key' ); |
|
606 | + } |
|
607 | 607 | |
608 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
608 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
609 | 609 | |
610 | 610 | $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' ); |
611 | 611 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $update_below = false; |
623 | 623 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
624 | 624 | |
625 | - switch ( $license_status ) { |
|
625 | + switch ( $license_status ) { |
|
626 | 626 | /** @since 1.17 */ |
627 | 627 | case 'expired': |
628 | 628 | $title = __( 'Expired License', 'gravityview' ); |
@@ -660,13 +660,13 @@ discard block |
||
660 | 660 | return; |
661 | 661 | } |
662 | 662 | |
663 | - \GravityView_Admin_Notices::add_notice( array( |
|
664 | - 'message' => $message, |
|
665 | - 'class' => 'notice notice-warning', |
|
666 | - 'title' => $title, |
|
667 | - 'cap' => 'gravityview_edit_settings', |
|
668 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
669 | - ) ); |
|
663 | + \GravityView_Admin_Notices::add_notice( array( |
|
664 | + 'message' => $message, |
|
665 | + 'class' => 'notice notice-warning', |
|
666 | + 'title' => $title, |
|
667 | + 'cap' => 'gravityview_edit_settings', |
|
668 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
669 | + ) ); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
683 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
684 | - * |
|
685 | - * @since 1.21.5 |
|
686 | - * |
|
687 | - * @see GFAddOn::scripts() |
|
688 | - * |
|
683 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
684 | + * |
|
685 | + * @since 1.21.5 |
|
686 | + * |
|
687 | + * @see GFAddOn::scripts() |
|
688 | + * |
|
689 | 689 | * @return array Array of scripts |
690 | 690 | */ |
691 | 691 | public function scripts() { |
@@ -694,10 +694,10 @@ discard block |
||
694 | 694 | $scripts[] = array( |
695 | 695 | 'handle' => 'gform_tooltip_init', |
696 | 696 | 'enqueue' => array( |
697 | - array( |
|
698 | - 'admin_page' => array( 'app_settings' ) |
|
699 | - ) |
|
700 | - ) |
|
697 | + array( |
|
698 | + 'admin_page' => array( 'app_settings' ) |
|
699 | + ) |
|
700 | + ) |
|
701 | 701 | ); |
702 | 702 | |
703 | 703 | return $scripts; |
@@ -715,10 +715,10 @@ discard block |
||
715 | 715 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
716 | 716 | 'version' => Plugin::$version, |
717 | 717 | 'deps' => array( |
718 | - 'gform_admin', |
|
718 | + 'gform_admin', |
|
719 | 719 | 'gaddon_form_settings_css', |
720 | - 'gform_tooltip', |
|
721 | - 'gform_font_awesome', |
|
720 | + 'gform_tooltip', |
|
721 | + 'gform_font_awesome', |
|
722 | 722 | ), |
723 | 723 | 'enqueue' => array( |
724 | 724 | array( 'admin_page' => array( |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | array( |
887 | 887 | 'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ), |
888 | 888 | 'value' => '1', |
889 | - 'name' => 'beta', |
|
889 | + 'name' => 'beta', |
|
890 | 890 | ), |
891 | 891 | ), |
892 | 892 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -924,38 +924,38 @@ discard block |
||
924 | 924 | |
925 | 925 | if ( empty( $field['disabled'] ) ) { |
926 | 926 | unset( $field['disabled'] ); |
927 | - } |
|
927 | + } |
|
928 | 928 | } |
929 | 929 | |
930 | - $sections = array( |
|
931 | - array( |
|
932 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
933 | - 'fields' => $fields, |
|
934 | - ) |
|
935 | - ); |
|
930 | + $sections = array( |
|
931 | + array( |
|
932 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
933 | + 'fields' => $fields, |
|
934 | + ) |
|
935 | + ); |
|
936 | 936 | |
937 | - // custom 'update settings' button |
|
938 | - $button = array( |
|
939 | - 'class' => 'button button-primary button-hero', |
|
940 | - 'type' => 'save', |
|
941 | - ); |
|
937 | + // custom 'update settings' button |
|
938 | + $button = array( |
|
939 | + 'class' => 'button button-primary button-hero', |
|
940 | + 'type' => 'save', |
|
941 | + ); |
|
942 | 942 | |
943 | 943 | if ( $disabled_attribute ) { |
944 | 944 | $button['disabled'] = $disabled_attribute; |
945 | 945 | } |
946 | 946 | |
947 | - /** |
|
948 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
949 | - * Extensions can tap in here to insert their own section and settings. |
|
950 | - * <code> |
|
951 | - * $sections[] = array( |
|
952 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
953 | - * 'fields' => $settings, |
|
954 | - * ); |
|
955 | - * </code> |
|
956 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
957 | - */ |
|
958 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
947 | + /** |
|
948 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
949 | + * Extensions can tap in here to insert their own section and settings. |
|
950 | + * <code> |
|
951 | + * $sections[] = array( |
|
952 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
953 | + * 'fields' => $settings, |
|
954 | + * ); |
|
955 | + * </code> |
|
956 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
957 | + */ |
|
958 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
959 | 959 | |
960 | 960 | // If there are extensions, add a section for them |
961 | 961 | if ( ! empty( $extension_sections ) ) { |
@@ -968,13 +968,13 @@ discard block |
||
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 | - // add the 'update settings' button to the general section |
|
976 | - $sections[0]['fields'][] = $button; |
|
977 | - } |
|
975 | + // add the 'update settings' button to the general section |
|
976 | + $sections[0]['fields'][] = $button; |
|
977 | + } |
|
978 | 978 | |
979 | 979 | return $sections; |
980 | 980 | } |
@@ -1028,9 +1028,9 @@ discard block |
||
1028 | 1028 | */ |
1029 | 1029 | protected function settings_edd_license( $field, $echo = true ) { |
1030 | 1030 | |
1031 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1032 | - $field['input_type'] = 'password'; |
|
1033 | - } |
|
1031 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1032 | + $field['input_type'] = 'password'; |
|
1033 | + } |
|
1034 | 1034 | |
1035 | 1035 | $text = $this->settings_text( $field, false ); |
1036 | 1036 | |
@@ -1047,9 +1047,9 @@ discard block |
||
1047 | 1047 | |
1048 | 1048 | /** |
1049 | 1049 | * Allow pure HTML settings row |
1050 | - * |
|
1051 | - * @since 2.0.6 |
|
1052 | - * |
|
1050 | + * |
|
1051 | + * @since 2.0.6 |
|
1052 | + * |
|
1053 | 1053 | * @param array $field |
1054 | 1054 | * @param bool $echo Whether to echo the |
1055 | 1055 | * |
@@ -1115,19 +1115,19 @@ discard block |
||
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | /** |
1118 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1119 | - * |
|
1120 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1121 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1122 | - * |
|
1123 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1124 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1125 | - * |
|
1126 | - * @since 1.21.5.2 |
|
1127 | - * |
|
1118 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1119 | + * |
|
1120 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1121 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1122 | + * |
|
1123 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1124 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1125 | + * |
|
1126 | + * @since 1.21.5.2 |
|
1127 | + * |
|
1128 | 1128 | * @param array $field |
1129 | - * |
|
1130 | - * @return void |
|
1129 | + * |
|
1130 | + * @return void |
|
1131 | 1131 | */ |
1132 | 1132 | public function single_setting_row( $field ) { |
1133 | 1133 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | $is_page = false; |
40 | 40 | |
41 | - if( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) { |
|
41 | + if ( function_exists( '\get_current_screen' ) || function_exists( 'get_current_screen' ) ) { |
|
42 | 42 | $current_screen = \get_current_screen(); |
43 | 43 | } else { |
44 | 44 | $current_screen = false; |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | $is_page = 'single'; |
52 | 52 | } elseif ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) { |
53 | 53 | $is_page = 'settings'; |
54 | - } elseif( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
54 | + } elseif ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
55 | 55 | $is_page = 'downloads'; |
56 | - } elseif( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) { |
|
56 | + } elseif ( $is_changelog = 'gravityview_page_gv-changelog' === $current_screen->id ) { |
|
57 | 57 | $is_page = 'changelog'; |
58 | - } elseif( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) { |
|
58 | + } elseif ( $is_getting_started = 'gravityview_page_gv-getting-started' === $current_screen->id ) { |
|
59 | 59 | $is_page = 'getting-started'; |
60 | - } elseif( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) { |
|
60 | + } elseif ( $is_credits = 'gravityview_page_gv-credits' === $current_screen->id ) { |
|
61 | 61 | $is_page = 'credits'; |
62 | 62 | } |
63 | 63 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function gf_query_debug( $query ) { |
146 | 146 | $introspect = $query->_introspect(); |
147 | 147 | return array( |
148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | $KWS_GF_Change_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
30 | 30 | |
31 | 31 | // Now, no validation is required in the methods; let's hook in. |
32 | - remove_action('admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
32 | + remove_action( 'admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
33 | 33 | |
34 | - remove_action("gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
34 | + remove_action( "gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
35 | 35 | |
36 | - remove_action("gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
36 | + remove_action( "gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * This allows us to fake it till we make it. |
110 | 110 | */ |
111 | 111 | $parameters = $view->settings->as_atts(); |
112 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
112 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
113 | 113 | $has_multisort = true; |
114 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
115 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
116 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
114 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
115 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
116 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | 'entries' => $entries, |
129 | 129 | 'request' => $request, |
130 | 130 | ), empty( $parameters ) ? array() : array( |
131 | - 'paging' => $parameters['paging'], |
|
132 | - 'sorting' => $parameters['sorting'], |
|
131 | + 'paging' => $parameters[ 'paging' ], |
|
132 | + 'sorting' => $parameters[ 'sorting' ], |
|
133 | 133 | ), empty( $post ) ? array() : array( |
134 | 134 | 'post' => $post, |
135 | 135 | ) ) ); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | if( is_array( $search_field['value'] ) ) { |
19 | - gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
19 | + gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
20 | 20 | $search_field['value'] = reset( $search_field['value'] ); |
21 | 21 | } |
22 | 22 |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-select.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | -if( is_array( $search_field['value'] ) ) { |
|
18 | +if ( is_array( $search_field[ 'value' ] ) ) { |
|
19 | 19 | gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
20 | - $search_field['value'] = reset( $search_field['value'] ); |
|
20 | + $search_field[ 'value' ] = reset( $search_field[ 'value' ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | * @param string $default_option Default: `—` (—) |
27 | 27 | * @param string $field_type Field type: "select" or "multiselect" |
28 | 28 | */ |
29 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
29 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | <div class="gv-search-box gv-search-field-select"> |
33 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
34 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
33 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
34 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
35 | 35 | <?php } ?> |
36 | 36 | <p> |
37 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
38 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
37 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
38 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
39 | 39 | <?php |
40 | - foreach( $search_field['choices'] as $choice ) { ?> |
|
41 | - <?php if ( is_array( $choice['value'] ) ) { ?> |
|
42 | - <optgroup label="<?php echo esc_attr( $choice['text'] ); ?>"> |
|
43 | - <?php foreach ( $choice['value'] as $subchoice ): ?> |
|
44 | - <option value="<?php echo esc_attr( $subchoice['value'] ); ?>"><?php echo esc_html( $subchoice['text'] ); ?></option> |
|
40 | + foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
41 | + <?php if ( is_array( $choice[ 'value' ] ) ) { ?> |
|
42 | + <optgroup label="<?php echo esc_attr( $choice[ 'text' ] ); ?>"> |
|
43 | + <?php foreach ( $choice[ 'value' ] as $subchoice ): ?> |
|
44 | + <option value="<?php echo esc_attr( $subchoice[ 'value' ] ); ?>"><?php echo esc_html( $subchoice[ 'text' ] ); ?></option> |
|
45 | 45 | <?php endforeach; ?> |
46 | 46 | </optgroup> |
47 | 47 | <?php } else { ?> |
48 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
48 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
49 | 49 | <?php } ?> |
50 | 50 | <?php } ?> |
51 | 51 | </select> |