@@ -21,13 +21,13 @@ |
||
| 21 | 21 | $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' ); |
| 22 | 22 | |
| 23 | 23 | // Load all plugin files automatically |
| 24 | -foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) { |
|
| 24 | +foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) { |
|
| 25 | 25 | include $plugin_hooks_file; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' ); |
| 29 | 29 | |
| 30 | 30 | // Load all theme files automatically |
| 31 | -foreach ( (array) $theme_hooks_files as $theme_hooks_file ) { |
|
| 31 | +foreach ( (array)$theme_hooks_files as $theme_hooks_file ) { |
|
| 32 | 32 | include $theme_hooks_file; |
| 33 | 33 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
| 66 | 66 | |
| 67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
| 67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function filter_gravityview_back_link( $link ) { |
| 85 | 85 | global $wpml_url_filters; |
| 86 | 86 | |
| 87 | - if( $wpml_url_filters ) { |
|
| 87 | + if ( $wpml_url_filters ) { |
|
| 88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | private function remove_url_hooks() { |
| 102 | 102 | global $wpml_url_filters; |
| 103 | 103 | |
| 104 | - if( ! $wpml_url_filters ) { |
|
| 104 | + if ( ! $wpml_url_filters ) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | private function add_url_hooks() { |
| 130 | 130 | global $wpml_url_filters; |
| 131 | 131 | |
| 132 | - if( ! $wpml_url_filters ) { |
|
| 132 | + if ( ! $wpml_url_filters ) { |
|
| 133 | 133 | return; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | break; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
| 229 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $this->add_url_hooks(); |
@@ -140,7 +140,7 @@ |
||
| 140 | 140 | * |
| 141 | 141 | * @param array $items Styles to exclude from no-conflict |
| 142 | 142 | * |
| 143 | - * @return array |
|
| 143 | + * @return string[] |
|
| 144 | 144 | */ |
| 145 | 145 | public function register_no_conflict( $items ) { |
| 146 | 146 | |
@@ -421,7 +421,7 @@ |
||
| 421 | 421 | </header> |
| 422 | 422 | <div class="gform-settings-panel__content" style="padding: 0 1rem 1.25rem"> |
| 423 | 423 | |
| 424 | -HTML; |
|
| 424 | +html; |
|
| 425 | 425 | } else { |
| 426 | 426 | echo '<div class="gv-uninstall-form-wrapper" style="font-size: 110%; padding: 15px 0;">'; |
| 427 | 427 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $setting_tabs = parent::get_app_settings_tabs(); |
| 119 | 119 | |
| 120 | 120 | foreach ( $setting_tabs as &$tab ) { |
| 121 | - if ( 'uninstall' !== $tab['name'] ) { |
|
| 121 | + if ( 'uninstall' !== $tab[ 'name' ] ) { |
|
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Add trash can icon to resemble the look and feel of the GF Settings page |
| 132 | - $tab['icon'] = 'dashicons-trash'; |
|
| 132 | + $tab[ 'icon' ] = 'dashicons-trash'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return array_filter( $setting_tabs ); |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function register_no_conflict( $items ) { |
| 146 | 146 | |
| 147 | - $items[] = 'gform_settings'; |
|
| 148 | - $items[] = 'gv-admin-edd-license'; |
|
| 147 | + $items[ ] = 'gform_settings'; |
|
| 148 | + $items[ ] = 'gv-admin-edd-license'; |
|
| 149 | 149 | |
| 150 | 150 | return $items; |
| 151 | 151 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) ); |
| 198 | 198 | |
| 199 | - $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
| 199 | + $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
| 200 | 200 | |
| 201 | 201 | $html .= $uninstall_button; |
| 202 | 202 | |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function settings_save( $field, $echo = true ) { |
| 217 | 217 | |
| 218 | - $field['type'] = 'submit'; |
|
| 219 | - $field['name'] = 'gform-settings-save'; |
|
| 220 | - $field['class'] = 'button button-primary primary button-hero'; |
|
| 221 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 218 | + $field[ 'type' ] = 'submit'; |
|
| 219 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 220 | + $field[ 'class' ] = 'button button-primary primary button-hero'; |
|
| 221 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 222 | 222 | |
| 223 | 223 | $html = $this->as_html( $field, false ); |
| 224 | 224 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 242 | 242 | |
| 243 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
| 244 | - $setting_tabs[0]['icon'] = 'dashicons-admin-settings'; |
|
| 243 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 244 | + $setting_tabs[ 0 ][ 'icon' ] = 'dashicons-admin-settings'; |
|
| 245 | 245 | |
| 246 | 246 | return $setting_tabs; |
| 247 | 247 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $i = 0; |
| 490 | 490 | while ( $i < 11 ) { |
| 491 | 491 | echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
| 492 | - $i ++; |
|
| 492 | + $i++; |
|
| 493 | 493 | } |
| 494 | 494 | ?> |
| 495 | 495 | </ul> |
@@ -693,14 +693,14 @@ discard block |
||
| 693 | 693 | */ |
| 694 | 694 | public function as_html( $field, $echo = true ) { |
| 695 | 695 | |
| 696 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit'; |
|
| 696 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 697 | 697 | |
| 698 | 698 | $attributes = $this->get_field_attributes( $field ); |
| 699 | 699 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
| 700 | - $value = $this->get( $field['name'], $default_value ); |
|
| 700 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
| 701 | 701 | |
| 702 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton'; |
|
| 703 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
| 702 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton'; |
|
| 703 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 704 | 704 | |
| 705 | 705 | if ( empty( $value ) ) { |
| 706 | 706 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $attributes = $this->get_field_attributes( $field ); |
| 710 | 710 | |
| 711 | 711 | $html = '<input |
| 712 | - type="' . $field['type'] . '" |
|
| 712 | + type="' . $field[ 'type' ] . '" |
|
| 713 | 713 | name="' . esc_attr( $name ) . '" |
| 714 | 714 | value="' . $value . '" ' . |
| 715 | 715 | implode( ' ', $attributes ) . |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | */ |
| 744 | 744 | public function is_save_postback() { |
| 745 | 745 | |
| 746 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
| 746 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | /** |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | |
| 856 | 856 | $scripts = parent::scripts(); |
| 857 | 857 | |
| 858 | - $scripts[] = array( |
|
| 858 | + $scripts[ ] = array( |
|
| 859 | 859 | 'handle' => 'gform_tooltip_init', |
| 860 | 860 | 'enqueue' => array( |
| 861 | 861 | array( |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | $styles = parent::styles(); |
| 878 | 878 | |
| 879 | - $styles[] = array( |
|
| 879 | + $styles[ ] = array( |
|
| 880 | 880 | 'handle' => 'gravityview_settings', |
| 881 | 881 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 882 | 882 | 'version' => Plugin::$version, |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | 'name' => 'support-email', |
| 968 | 968 | 'type' => 'text', |
| 969 | 969 | 'validate' => 'email', |
| 970 | - 'default_value' => $default_settings['support-email'], |
|
| 970 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 971 | 971 | 'label' => __( 'Support Email', 'gravityview' ), |
| 972 | 972 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 973 | 973 | 'class' => 'code regular-text', |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | 'name' => 'support_port', |
| 980 | 980 | 'type' => 'radio', |
| 981 | 981 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 982 | - 'default_value' => $default_settings['support_port'], |
|
| 982 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 983 | 983 | 'horizontal' => 1, |
| 984 | 984 | 'choices' => array( |
| 985 | 985 | array( |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | 'name' => 'no-conflict-mode', |
| 999 | 999 | 'type' => 'radio', |
| 1000 | 1000 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 1001 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 1001 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 1002 | 1002 | 'horizontal' => 1, |
| 1003 | 1003 | 'choices' => array( |
| 1004 | 1004 | array( |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | 'name' => 'rest_api', |
| 1021 | 1021 | 'type' => 'radio', |
| 1022 | 1022 | 'label' => __( 'REST API', 'gravityview' ), |
| 1023 | - 'default_value' => $default_settings['rest_api'], |
|
| 1023 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
| 1024 | 1024 | 'horizontal' => 1, |
| 1025 | 1025 | 'choices' => array( |
| 1026 | 1026 | array( |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | 'name' => 'powered_by', |
| 1040 | 1040 | 'type' => 'checkbox', |
| 1041 | 1041 | 'label' => __( 'Display "Powered By" Link', 'gravityview' ), |
| 1042 | - 'default_value' => $default_settings['powered_by'], |
|
| 1042 | + 'default_value' => $default_settings[ 'powered_by' ], |
|
| 1043 | 1043 | 'choices' => array( |
| 1044 | 1044 | array( |
| 1045 | 1045 | 'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ), |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | 'name' => 'beta', |
| 1065 | 1065 | 'type' => 'checkbox', |
| 1066 | 1066 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
| 1067 | - 'default_value' => $default_settings['beta'], |
|
| 1067 | + 'default_value' => $default_settings[ 'beta' ], |
|
| 1068 | 1068 | 'horizontal' => 1, |
| 1069 | 1069 | 'choices' => array( |
| 1070 | 1070 | array( |
@@ -1098,17 +1098,17 @@ discard block |
||
| 1098 | 1098 | * @since 1.7.4 |
| 1099 | 1099 | */ |
| 1100 | 1100 | foreach ( $fields as &$field ) { |
| 1101 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
| 1102 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
| 1103 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
| 1104 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
| 1101 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
| 1102 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
| 1103 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
| 1104 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
| 1105 | 1105 | |
| 1106 | 1106 | if ( $disabled_attribute ) { |
| 1107 | - $field['disabled'] = $disabled_attribute; |
|
| 1107 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | - if ( empty( $field['disabled'] ) ) { |
|
| 1111 | - unset( $field['disabled'] ); |
|
| 1110 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
| 1111 | + unset( $field[ 'disabled' ] ); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | |
@@ -1120,23 +1120,23 @@ discard block |
||
| 1120 | 1120 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
| 1121 | 1121 | 'type' => 'edd_license', |
| 1122 | 1122 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
| 1123 | - 'default_value' => $default_settings['license_key'], |
|
| 1123 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 1124 | 1124 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 1125 | 1125 | ), |
| 1126 | 1126 | array( |
| 1127 | 1127 | 'name' => 'license_key_response', |
| 1128 | - 'default_value' => $default_settings['license_key_response'], |
|
| 1128 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 1129 | 1129 | 'type' => 'hidden', |
| 1130 | 1130 | ), |
| 1131 | 1131 | array( |
| 1132 | 1132 | 'name' => 'license_key_status', |
| 1133 | - 'default_value' => $default_settings['license_key_status'], |
|
| 1133 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 1134 | 1134 | 'type' => 'hidden', |
| 1135 | 1135 | ), |
| 1136 | 1136 | ); |
| 1137 | 1137 | |
| 1138 | 1138 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 1139 | - $license_fields[0] = array_merge( $license_fields[0], array( |
|
| 1139 | + $license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array( |
|
| 1140 | 1140 | 'disabled' => true, |
| 1141 | 1141 | 'title' => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ), |
| 1142 | 1142 | ) ); |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | if ( \gravityview()->plugin->is_GF_25() ) { |
| 1149 | 1149 | |
| 1150 | - $sections[] = array( |
|
| 1150 | + $sections[ ] = array( |
|
| 1151 | 1151 | 'title' => __( 'GravityView License', 'gravityview' ), |
| 1152 | 1152 | 'class' => 'gform-settings-panel--full gv-settings-panel--license', |
| 1153 | 1153 | 'description' => $version_info, |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | ) ); |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - $sections[] = array( |
|
| 1168 | + $sections[ ] = array( |
|
| 1169 | 1169 | 'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ), |
| 1170 | 1170 | 'class' => 'gform-settings-panel--full gv-settings-panel--core', |
| 1171 | 1171 | 'fields' => $fields, |
@@ -1189,8 +1189,8 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | if ( $disabled_attribute ) { |
| 1191 | 1191 | foreach ( $extension_sections as &$section ) { |
| 1192 | - foreach ( $section['fields'] as &$field ) { |
|
| 1193 | - $field['disabled'] = $disabled_attribute; |
|
| 1192 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 1193 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1194 | 1194 | } |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | public function settings_edd_license( $field, $echo = true ) { |
| 1257 | 1257 | |
| 1258 | 1258 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 1259 | - $field['input_type'] = 'password'; |
|
| 1259 | + $field[ 'input_type' ] = 'password'; |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | $text = $this->settings_text( $field, false ); |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | |
| 1309 | 1309 | ?> |
| 1310 | 1310 | |
| 1311 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
| 1311 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
| 1312 | 1312 | <td colspan="2"> |
| 1313 | 1313 | <?php $this->single_setting( $field ); ?> |
| 1314 | 1314 | </td> |
@@ -1334,8 +1334,8 @@ discard block |
||
| 1334 | 1334 | */ |
| 1335 | 1335 | public function single_setting_row( $field ) { |
| 1336 | 1336 | |
| 1337 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
| 1338 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
| 1337 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
| 1338 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
| 1339 | 1339 | parent::single_setting_row( $field ); |
| 1340 | 1340 | } |
| 1341 | 1341 | |
@@ -1396,8 +1396,8 @@ discard block |
||
| 1396 | 1396 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 1397 | 1397 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
| 1398 | 1398 | |
| 1399 | - unset( $posted_settings['license_key_response'] ); |
|
| 1400 | - unset( $posted_settings['license_key_status'] ); |
|
| 1399 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 1400 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 1401 | 1401 | |
| 1402 | 1402 | \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
| 1403 | 1403 | |
@@ -505,8 +505,8 @@ discard block |
||
| 505 | 505 | */ |
| 506 | 506 | private function get_php_version() { |
| 507 | 507 | |
| 508 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 509 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 508 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 509 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | /** |
@@ -518,8 +518,8 @@ discard block |
||
| 518 | 518 | */ |
| 519 | 519 | private function get_wordpress_version() { |
| 520 | 520 | |
| 521 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 522 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 521 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 522 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /** |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | private function get_gravityforms_version() { |
| 533 | 533 | |
| 534 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 534 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
| 535 | 535 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
| 536 | 536 | |
| 537 | 537 | return null; |
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 541 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 540 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 541 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | /** |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $items = get_posts( array( |
| 585 | 585 | 'post_type' => 'gravityview', |
| 586 | 586 | 'post_status' => 'any', |
| 587 | - 'numberposts' => - 1, |
|
| 587 | + 'numberposts' => -1, |
|
| 588 | 588 | 'fields' => 'ids', |
| 589 | 589 | ) ); |
| 590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | $tables = array(); |
| 599 | 599 | |
| 600 | 600 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
| 601 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
| 601 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
| 602 | 602 | } elseif ( ! $this->is_GF_25() ) { |
| 603 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
| 603 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | foreach ( $tables as $meta_table ) { |
@@ -619,9 +619,9 @@ discard block |
||
| 619 | 619 | $tables = array(); |
| 620 | 620 | |
| 621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
| 622 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 622 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
| 624 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 624 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
| 32 | 32 | |
| 33 | - if( 'field' === $field_type ) { |
|
| 33 | + if ( 'field' === $field_type ) { |
|
| 34 | 34 | |
| 35 | 35 | // Default options - fields |
| 36 | 36 | $field_options = array( |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'custom_class' => array( |
| 50 | 50 | 'type' => 'text', |
| 51 | 51 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 52 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
| 52 | + 'desc' => __( 'This class will be added to the field container', 'gravityview' ), |
|
| 53 | 53 | 'value' => '', |
| 54 | 54 | 'merge_tags' => true, |
| 55 | 55 | 'tooltip' => 'gv_css_merge_tags', |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | // Match Table as well as DataTables |
| 73 | - if( $is_table_layout && 'directory' === $context ) { |
|
| 74 | - $field_options['width'] = array( |
|
| 73 | + if ( $is_table_layout && 'directory' === $context ) { |
|
| 74 | + $field_options[ 'width' ] = array( |
|
| 75 | 75 | 'type' => 'number', |
| 76 | - 'label' => __('Percent Width', 'gravityview'), |
|
| 77 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
| 76 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
| 77 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
| 78 | 78 | 'class' => 'code widefat', |
| 79 | 79 | 'value' => '', |
| 80 | 80 | ); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | - if( is_multisite() ) { |
|
| 133 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
| 132 | + if ( is_multisite() ) { |
|
| 133 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
| 144 | 144 | * @param string $input_type Optional. (textarea, list, select, etc.) |
| 145 | 145 | */ |
| 146 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 146 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 147 | 147 | |
| 148 | 148 | return $select_cap_choices; |
| 149 | 149 | } |
@@ -170,27 +170,27 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
| 172 | 172 | |
| 173 | - if( empty( $uniqid ) ) { |
|
| 173 | + if ( empty( $uniqid ) ) { |
|
| 174 | 174 | //generate a unique field id |
| 175 | - $uniqid = uniqid('', false); |
|
| 175 | + $uniqid = uniqid( '', false ); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // get field/widget options |
| 179 | 179 | $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id ); |
| 180 | 180 | |
| 181 | 181 | // two different post arrays, depending of the field type |
| 182 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
| 182 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
| 183 | 183 | |
| 184 | 184 | // build output |
| 185 | 185 | $output = ''; |
| 186 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
| 187 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
| 186 | + $output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
| 187 | + $output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
| 188 | 188 | if ( $form_id ) { |
| 189 | - $output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
| 189 | + $output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // If there are no options, return what we got. |
| 193 | - if(empty($options)) { |
|
| 193 | + if ( empty( $options ) ) { |
|
| 194 | 194 | |
| 195 | 195 | // This is here for checking if the output is empty in render_label() |
| 196 | 196 | $output .= '<!-- No Options -->'; |
@@ -198,33 +198,33 @@ discard block |
||
| 198 | 198 | return $output; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
| 201 | + $output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">'; |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * @since 1.8 |
| 205 | 205 | */ |
| 206 | - if( !empty( $item['subtitle'] ) ) { |
|
| 207 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
| 206 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
| 207 | + $output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - foreach( $options as $key => $option ) { |
|
| 210 | + foreach ( $options as $key => $option ) { |
|
| 211 | 211 | |
| 212 | 212 | $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
| 213 | 213 | |
| 214 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
| 214 | + $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
|
| 215 | 215 | |
| 216 | 216 | // The setting is empty |
| 217 | - if( empty( $field_output ) ) { |
|
| 217 | + if ( empty( $field_output ) ) { |
|
| 218 | 218 | continue; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - switch( $option['type'] ) { |
|
| 221 | + switch ( $option[ 'type' ] ) { |
|
| 222 | 222 | // Hide hidden fields |
| 223 | 223 | case 'hidden': |
| 224 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
| 224 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
|
| 225 | 225 | break; |
| 226 | 226 | default: |
| 227 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
| 227 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>'; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -253,17 +253,17 @@ discard block |
||
| 253 | 253 | * @deprecated setting index 'default' was replaced by 'value' |
| 254 | 254 | * @see GravityView_FieldType::get_field_defaults |
| 255 | 255 | */ |
| 256 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
| 257 | - $option['value'] = $option['default']; |
|
| 258 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
| 256 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
| 257 | + $option[ 'value' ] = $option[ 'default' ]; |
|
| 258 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // prepare to render option field type |
| 262 | - if( isset( $option['type'] ) ) { |
|
| 262 | + if ( isset( $option[ 'type' ] ) ) { |
|
| 263 | 263 | |
| 264 | 264 | $type_class = self::load_type_class( $option ); |
| 265 | 265 | |
| 266 | - if( class_exists( $type_class ) ) { |
|
| 266 | + if ( class_exists( $type_class ) ) { |
|
| 267 | 267 | |
| 268 | 268 | /** @type GravityView_FieldType $render_type */ |
| 269 | 269 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @param[in,out] string $output field class name |
| 281 | 281 | * @param[in] array $option option field data |
| 282 | 282 | */ |
| 283 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
| 283 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | } // isset option[type] |
@@ -315,27 +315,27 @@ discard block |
||
| 315 | 315 | * @deprecated setting index 'name' was replaced by 'label' |
| 316 | 316 | * @see GravityView_FieldType::get_field_defaults |
| 317 | 317 | */ |
| 318 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
| 319 | - $setting['label'] = $setting['name']; |
|
| 320 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
| 318 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
| 319 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
| 320 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $name = esc_attr( sprintf( $name, $key ) ); |
| 324 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
| 325 | - $setting['tooltip'] = 'gv_' . $key; |
|
| 324 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
| 325 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
| 326 | 326 | |
| 327 | 327 | // Use default if current setting isn't set. |
| 328 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
| 328 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
| 329 | 329 | |
| 330 | 330 | // default setting type = text |
| 331 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
| 331 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
| 332 | 332 | |
| 333 | 333 | // merge tags |
| 334 | - if( !isset( $setting['merge_tags'] ) ) { |
|
| 335 | - if( $setting['type'] === 'text' ) { |
|
| 336 | - $setting['merge_tags'] = true; |
|
| 334 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
| 335 | + if ( $setting[ 'type' ] === 'text' ) { |
|
| 336 | + $setting[ 'merge_tags' ] = true; |
|
| 337 | 337 | } else { |
| 338 | - $setting['merge_tags'] = false; |
|
| 338 | + $setting[ 'merge_tags' ] = false; |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | // render the setting |
| 345 | 345 | $type_class = self::load_type_class( $setting ); |
| 346 | - if( class_exists( $type_class ) ) { |
|
| 346 | + if ( class_exists( $type_class ) ) { |
|
| 347 | 347 | /** @type GravityView_FieldType $render_type */ |
| 348 | 348 | $render_type = new $type_class( $name, $setting, $curr_value ); |
| 349 | 349 | ob_start(); |
@@ -352,25 +352,25 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | // Check if setting is specific for a template |
| 355 | - if( !empty( $setting['show_in_template'] ) ) { |
|
| 356 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
| 357 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
| 355 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
| 356 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
| 357 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
| 358 | 358 | } |
| 359 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
| 359 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
| 360 | 360 | } else { |
| 361 | 361 | $show_if = ''; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if( ! empty( $setting['requires'] ) ) { |
|
| 365 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
| 364 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
| 365 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if( ! empty( $setting['requires_not'] ) ) { |
|
| 369 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
| 368 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
| 369 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // output |
| 373 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
| 373 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
| 374 | 374 | |
| 375 | 375 | } |
| 376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public static function load_type_class( $field = NULL ) { |
| 384 | 384 | |
| 385 | - if( empty( $field['type'] ) ) { |
|
| 385 | + if ( empty( $field[ 'type' ] ) ) { |
|
| 386 | 386 | return NULL; |
| 387 | 387 | } |
| 388 | 388 | |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
| 392 | 392 | * @param array $field field data |
| 393 | 393 | */ |
| 394 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
| 394 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
| 395 | 395 | |
| 396 | - if( class_exists( $type_class ) ) { |
|
| 396 | + if ( class_exists( $type_class ) ) { |
|
| 397 | 397 | return $type_class; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | * @param string $field_type_include_path field class file path |
| 403 | 403 | * @param array $field field data |
| 404 | 404 | */ |
| 405 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
| 405 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
| 406 | 406 | |
| 407 | - if( $class_file && file_exists( $class_file ) ) { |
|
| 407 | + if ( $class_file && file_exists( $class_file ) ) { |
|
| 408 | 408 | require_once( $class_file ); |
| 409 | 409 | } |
| 410 | 410 | |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
| 428 | 428 | |
| 429 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
| 430 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
| 429 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
| 430 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
| 431 | 431 | |
| 432 | 432 | return $output; |
| 433 | 433 | } |
@@ -447,22 +447,22 @@ discard block |
||
| 447 | 447 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
| 448 | 448 | |
| 449 | 449 | // Show the merge tags if the field is a list view |
| 450 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 450 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 451 | 451 | |
| 452 | 452 | // Or is a single entry view |
| 453 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 453 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 454 | 454 | $show = ( $is_single || $is_list ); |
| 455 | 455 | |
| 456 | 456 | $class = ''; |
| 457 | 457 | // and $add_merge_tags is not false |
| 458 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 458 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 459 | 459 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
| 463 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
| 462 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
| 463 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
| 464 | 464 | |
| 465 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
| 465 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -479,21 +479,21 @@ discard block |
||
| 479 | 479 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
| 480 | 480 | |
| 481 | 481 | // Show the merge tags if the field is a list view |
| 482 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 482 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 483 | 483 | |
| 484 | 484 | // Or is a single entry view |
| 485 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 485 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 486 | 486 | $show = ( $is_single || $is_list ); |
| 487 | 487 | |
| 488 | 488 | $class = ''; |
| 489 | 489 | // and $add_merge_tags is not false |
| 490 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 490 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 491 | 491 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
| 494 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
| 495 | 495 | |
| 496 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
| 496 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | /** |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
| 511 | 511 | |
| 512 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
| 513 | - foreach( $choices as $value => $label ) { |
|
| 514 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
| 512 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
| 513 | + foreach ( $choices as $value => $label ) { |
|
| 514 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
| 515 | 515 | } |
| 516 | 516 | $output .= '</select>'; |
| 517 | 517 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 66 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 65 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 66 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 67 | 67 | $form = GravityView_View::getInstance()->getForm(); |
| 68 | 68 | |
| 69 | 69 | /** @type GF_Field_Address $address_field */ |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $choices = array(); |
| 73 | 73 | |
| 74 | 74 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 75 | - if( method_exists( $this, $method_name ) ) { |
|
| 75 | + if ( method_exists( $this, $method_name ) ) { |
|
| 76 | 76 | /** |
| 77 | 77 | * @uses GravityView_Field_Address::get_choices_country() |
| 78 | 78 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $choices = $this->{$method_name}( $address_field, $form ); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if( ! empty( $choices ) ) { |
|
| 84 | - $search_field['choices'] = $choices; |
|
| 85 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 83 | + if ( ! empty( $choices ) ) { |
|
| 84 | + $search_field[ 'choices' ] = $choices; |
|
| 85 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 86 | 86 | } else { |
| 87 | - $search_field['type'] = 'text'; |
|
| 88 | - $search_field['input'] = 'input_text'; |
|
| 87 | + $search_field[ 'type' ] = 'text'; |
|
| 88 | + $search_field[ 'input' ] = 'input_text'; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $country_choices = array(); |
| 111 | 111 | |
| 112 | 112 | foreach ( $countries as $key => $country ) { |
| 113 | - $country_choices[] = array( |
|
| 113 | + $country_choices[ ] = array( |
|
| 114 | 114 | 'value' => $country, |
| 115 | 115 | 'text' => $country, |
| 116 | 116 | ); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | private function get_choices_state( $address_field, $form ) { |
| 137 | 137 | |
| 138 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 138 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 139 | 139 | |
| 140 | 140 | $state_choices = array(); |
| 141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | $states = GFCommon::get_canadian_provinces(); |
| 148 | 148 | break; |
| 149 | 149 | default: |
| 150 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 151 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 150 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 151 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 152 | 152 | break; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | $state_subchoices = array(); |
| 158 | 158 | |
| 159 | 159 | foreach ( $state as $key => $substate ) { |
| 160 | - $state_subchoices[] = array( |
|
| 160 | + $state_subchoices[ ] = array( |
|
| 161 | 161 | 'value' => is_numeric( $key ) ? $substate : $key, |
| 162 | 162 | 'text' => $substate, |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $state_choices[] = array( |
|
| 166 | + $state_choices[ ] = array( |
|
| 167 | 167 | 'text' => $key, |
| 168 | 168 | 'value' => $state_subchoices, |
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | 171 | } else { |
| 172 | - $state_choices[] = array( |
|
| 172 | + $state_choices[ ] = array( |
|
| 173 | 173 | 'value' => is_numeric( $key ) ? $state : $key, |
| 174 | 174 | 'text' => $state, |
| 175 | 175 | ); |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | // Use the same inputs as the "text" input type allows |
| 194 | 194 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 195 | 195 | |
| 196 | - $input_types['street'] = $text_inputs; |
|
| 197 | - $input_types['street2'] = $text_inputs; |
|
| 198 | - $input_types['city'] = $text_inputs; |
|
| 196 | + $input_types[ 'street' ] = $text_inputs; |
|
| 197 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 198 | + $input_types[ 'city' ] = $text_inputs; |
|
| 199 | 199 | |
| 200 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 201 | - $input_types['zip'] = array( 'input_text' ); |
|
| 202 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 201 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 202 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 203 | 203 | |
| 204 | 204 | return $input_types; |
| 205 | 205 | } |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 221 | 221 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 222 | 222 | |
| 223 | - if( 'address' !== $field_type && $input_id ) { |
|
| 223 | + if ( 'address' !== $field_type && $input_id ) { |
|
| 224 | 224 | return $input_type; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 228 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 228 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 229 | 229 | $input_type = $address_field_name; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -273,20 +273,20 @@ discard block |
||
| 273 | 273 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 274 | 274 | |
| 275 | 275 | // If this is NOT the full address field, return default options. |
| 276 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 276 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 277 | 277 | return $field_options; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if( 'edit' === $context ) { |
|
| 280 | + if ( 'edit' === $context ) { |
|
| 281 | 281 | return $field_options; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | $add_options = array(); |
| 285 | 285 | |
| 286 | - $add_options['show_map_link'] = array( |
|
| 286 | + $add_options[ 'show_map_link' ] = array( |
|
| 287 | 287 | 'type' => 'checkbox', |
| 288 | 288 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 289 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 289 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 290 | 290 | 'value' => true, |
| 291 | 291 | 'merge_tags' => false, |
| 292 | 292 | ); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
| 50 | 50 | |
| 51 | 51 | /** @type GF_Field $field */ |
| 52 | - foreach( $fields as &$field ) { |
|
| 52 | + foreach ( $fields as &$field ) { |
|
| 53 | 53 | |
| 54 | 54 | if ( 'hidden' === $field->type ) { |
| 55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field ); |
| 64 | 64 | |
| 65 | - if( ! $reveal_hidden_field ) { |
|
| 65 | + if ( ! $reveal_hidden_field ) { |
|
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | public function edit_entry_fix_uid_fields( $fields ) { |
| 51 | 51 | |
| 52 | 52 | /** @type \GF_Field $field */ |
| 53 | - foreach( $fields as &$field ) { |
|
| 53 | + foreach ( $fields as &$field ) { |
|
| 54 | 54 | if ( 'uid' === $field->type ) { |
| 55 | 55 | |
| 56 | 56 | // Replace GF_Field with GF_Field_Text, copying all the data from $field |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
| 167 | 167 | */ |
| 168 | 168 | public static function from_configuration( $configuration ) { |
| 169 | - if ( empty( $configuration['id'] ) ) { |
|
| 169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
| 170 | 170 | $field = new self(); |
| 171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
| 172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | } else { |
| 180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
| 181 | 181 | } |
| 182 | - $trace = $trace[1]; |
|
| 183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
| 182 | + $trace = $trace[ 1 ]; |
|
| 183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
| 184 | 184 | $field = new self(); |
| 185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
| 186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** @type \GV\GF_Field|\GV\Internal_Field $field_class Determine the field implementation to use, and try to use. */ |
| 191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | public function update_configuration( $configuration ) { |
| 228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
| 229 | 229 | |
| 230 | - if ( $this->ID != $configuration['id'] ) { |
|
| 230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
| 231 | 231 | /** Smelling trouble here... */ |
| 232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->ID = $configuration['id']; |
|
| 236 | - $this->label = $configuration['label']; |
|
| 237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
| 238 | - $this->custom_label = $configuration['custom_label']; |
|
| 239 | - $this->custom_class = $configuration['custom_class']; |
|
| 240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
| 241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
| 242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
| 235 | + $this->ID = $configuration[ 'id' ]; |
|
| 236 | + $this->label = $configuration[ 'label' ]; |
|
| 237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
| 238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
| 239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
| 240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
| 241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
| 242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
| 243 | 243 | |
| 244 | 244 | /** Shared among all field types (sort of). */ |
| 245 | 245 | $shared_configuration_keys = array( |
| 246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
| 247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | /** A custom label is available. */ |
| 275 | 275 | if ( ! empty( $this->custom_label ) ) { |
| 276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
| 276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return ''; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
| 360 | 360 | */ |
| 361 | 361 | public function __get( $key ) { |
| 362 | - switch( $key ) { |
|
| 362 | + switch ( $key ) { |
|
| 363 | 363 | default: |
| 364 | 364 | if ( isset( $this->configuration[ $key ] ) ) { |
| 365 | 365 | return $this->configuration[ $key ]; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @return boolean Whether this $key is set or not. |
| 378 | 378 | */ |
| 379 | 379 | public function __isset( $key ) { |
| 380 | - switch( $key ) { |
|
| 380 | + switch ( $key ) { |
|
| 381 | 381 | default: |
| 382 | 382 | return isset( $this->configuration[ $key ] ); |
| 383 | 383 | } |