@@ -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(); |
@@ -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> |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | */ |
695 | 695 | public function as_html( $field, $echo = true ) { |
696 | 696 | |
697 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit'; |
|
697 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
698 | 698 | |
699 | 699 | $attributes = $this->get_field_attributes( $field ); |
700 | 700 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
701 | - $value = $this->get( $field['name'], $default_value ); |
|
701 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
702 | 702 | |
703 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton'; |
|
704 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
703 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton'; |
|
704 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
705 | 705 | |
706 | 706 | if ( empty( $value ) ) { |
707 | 707 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $attributes = $this->get_field_attributes( $field ); |
711 | 711 | |
712 | 712 | $html = '<input |
713 | - type="' . $field['type'] . '" |
|
713 | + type="' . $field[ 'type' ] . '" |
|
714 | 714 | name="' . esc_attr( $name ) . '" |
715 | 715 | value="' . $value . '" ' . |
716 | 716 | implode( ' ', $attributes ) . |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | */ |
745 | 745 | public function is_save_postback() { |
746 | 746 | |
747 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
747 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | $scripts = parent::scripts(); |
858 | 858 | |
859 | - $scripts[] = array( |
|
859 | + $scripts[ ] = array( |
|
860 | 860 | 'handle' => 'gform_tooltip_init', |
861 | 861 | 'enqueue' => array( |
862 | 862 | array( |
@@ -884,11 +884,11 @@ discard block |
||
884 | 884 | ); |
885 | 885 | |
886 | 886 | // This file was removed from 2.5 |
887 | - if( ! gravityview()->plugin->is_GF_25() ) { |
|
888 | - $deps[] = 'gform_tooltip'; |
|
887 | + if ( ! gravityview()->plugin->is_GF_25() ) { |
|
888 | + $deps[ ] = 'gform_tooltip'; |
|
889 | 889 | } |
890 | 890 | |
891 | - $styles[] = array( |
|
891 | + $styles[ ] = array( |
|
892 | 892 | 'handle' => 'gravityview_settings', |
893 | 893 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
894 | 894 | 'version' => Plugin::$version, |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | 'name' => 'support-email', |
976 | 976 | 'type' => 'text', |
977 | 977 | 'validate' => 'email', |
978 | - 'default_value' => $default_settings['support-email'], |
|
978 | + 'default_value' => $default_settings[ 'support-email' ], |
|
979 | 979 | 'label' => __( 'Support Email', 'gravityview' ), |
980 | 980 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
981 | 981 | 'class' => 'code regular-text', |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | 'name' => 'support_port', |
988 | 988 | 'type' => 'radio', |
989 | 989 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
990 | - 'default_value' => $default_settings['support_port'], |
|
990 | + 'default_value' => $default_settings[ 'support_port' ], |
|
991 | 991 | 'horizontal' => 1, |
992 | 992 | 'choices' => array( |
993 | 993 | array( |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | 'name' => 'no-conflict-mode', |
1007 | 1007 | 'type' => 'radio', |
1008 | 1008 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
1009 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
1009 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
1010 | 1010 | 'horizontal' => 1, |
1011 | 1011 | 'choices' => array( |
1012 | 1012 | array( |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | 'name' => 'rest_api', |
1029 | 1029 | 'type' => 'radio', |
1030 | 1030 | 'label' => __( 'REST API', 'gravityview' ), |
1031 | - 'default_value' => $default_settings['rest_api'], |
|
1031 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
1032 | 1032 | 'horizontal' => 1, |
1033 | 1033 | 'choices' => array( |
1034 | 1034 | array( |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | 'name' => 'powered_by', |
1048 | 1048 | 'type' => 'checkbox', |
1049 | 1049 | 'label' => __( 'Display "Powered By" Link', 'gravityview' ), |
1050 | - 'default_value' => $default_settings['powered_by'], |
|
1050 | + 'default_value' => $default_settings[ 'powered_by' ], |
|
1051 | 1051 | 'choices' => array( |
1052 | 1052 | array( |
1053 | 1053 | 'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ), |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | 'name' => 'beta', |
1073 | 1073 | 'type' => 'checkbox', |
1074 | 1074 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
1075 | - 'default_value' => $default_settings['beta'], |
|
1075 | + 'default_value' => $default_settings[ 'beta' ], |
|
1076 | 1076 | 'horizontal' => 1, |
1077 | 1077 | 'choices' => array( |
1078 | 1078 | array( |
@@ -1106,17 +1106,17 @@ discard block |
||
1106 | 1106 | * @since 1.7.4 |
1107 | 1107 | */ |
1108 | 1108 | foreach ( $fields as &$field ) { |
1109 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
1110 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
1111 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
1112 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
1109 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
1110 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
1111 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
1112 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
1113 | 1113 | |
1114 | 1114 | if ( $disabled_attribute ) { |
1115 | - $field['disabled'] = $disabled_attribute; |
|
1115 | + $field[ 'disabled' ] = $disabled_attribute; |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | - if ( empty( $field['disabled'] ) ) { |
|
1119 | - unset( $field['disabled'] ); |
|
1118 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
1119 | + unset( $field[ 'disabled' ] ); |
|
1120 | 1120 | } |
1121 | 1121 | } |
1122 | 1122 | |
@@ -1128,23 +1128,23 @@ discard block |
||
1128 | 1128 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
1129 | 1129 | 'type' => 'edd_license', |
1130 | 1130 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
1131 | - 'default_value' => $default_settings['license_key'], |
|
1131 | + 'default_value' => $default_settings[ 'license_key' ], |
|
1132 | 1132 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
1133 | 1133 | ), |
1134 | 1134 | array( |
1135 | 1135 | 'name' => 'license_key_response', |
1136 | - 'default_value' => $default_settings['license_key_response'], |
|
1136 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
1137 | 1137 | 'type' => 'hidden', |
1138 | 1138 | ), |
1139 | 1139 | array( |
1140 | 1140 | 'name' => 'license_key_status', |
1141 | - 'default_value' => $default_settings['license_key_status'], |
|
1141 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
1142 | 1142 | 'type' => 'hidden', |
1143 | 1143 | ), |
1144 | 1144 | ); |
1145 | 1145 | |
1146 | 1146 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1147 | - $license_fields[0] = array_merge( $license_fields[0], array( |
|
1147 | + $license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array( |
|
1148 | 1148 | 'disabled' => true, |
1149 | 1149 | 'title' => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ), |
1150 | 1150 | ) ); |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | if ( \gravityview()->plugin->is_GF_25() ) { |
1157 | 1157 | |
1158 | - $sections[] = array( |
|
1158 | + $sections[ ] = array( |
|
1159 | 1159 | 'title' => __( 'GravityView License', 'gravityview' ), |
1160 | 1160 | 'class' => 'gform-settings-panel--full gv-settings-panel--license', |
1161 | 1161 | 'description' => $version_info, |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | ) ); |
1174 | 1174 | } |
1175 | 1175 | |
1176 | - $sections[] = array( |
|
1176 | + $sections[ ] = array( |
|
1177 | 1177 | 'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ), |
1178 | 1178 | 'class' => 'gform-settings-panel--full gv-settings-panel--core', |
1179 | 1179 | 'fields' => $fields, |
@@ -1197,8 +1197,8 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | if ( $disabled_attribute ) { |
1199 | 1199 | foreach ( $extension_sections as &$section ) { |
1200 | - foreach ( $section['fields'] as &$field ) { |
|
1201 | - $field['disabled'] = $disabled_attribute; |
|
1200 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
1201 | + $field[ 'disabled' ] = $disabled_attribute; |
|
1202 | 1202 | } |
1203 | 1203 | } |
1204 | 1204 | } |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | public function settings_edd_license( $field, $echo = true ) { |
1265 | 1265 | |
1266 | 1266 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1267 | - $field['input_type'] = 'password'; |
|
1267 | + $field[ 'input_type' ] = 'password'; |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | $text = $this->settings_text( $field, false ); |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | |
1317 | 1317 | ?> |
1318 | 1318 | |
1319 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1319 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1320 | 1320 | <td colspan="2"> |
1321 | 1321 | <?php $this->single_setting( $field ); ?> |
1322 | 1322 | </td> |
@@ -1342,8 +1342,8 @@ discard block |
||
1342 | 1342 | */ |
1343 | 1343 | public function single_setting_row( $field ) { |
1344 | 1344 | |
1345 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1346 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1345 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1346 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1347 | 1347 | parent::single_setting_row( $field ); |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1404,8 +1404,8 @@ discard block |
||
1404 | 1404 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1405 | 1405 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
1406 | 1406 | |
1407 | - unset( $posted_settings['license_key_response'] ); |
|
1408 | - unset( $posted_settings['license_key_status'] ); |
|
1407 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1408 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1409 | 1409 | |
1410 | 1410 | \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
1411 | 1411 |
@@ -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 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | function update_priority() { |
53 | 53 | global $wp_meta_boxes; |
54 | 54 | |
55 | - if ( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
55 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
56 | 56 | foreach ( array( 'high', 'core', 'low' ) as $position ) { |
57 | - if ( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
58 | - foreach ( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
57 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
58 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
59 | 59 | if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
60 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
61 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
60 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
61 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach ( $metaboxes as $m ) { |
193 | 193 | |
194 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
194 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
195 | 195 | |
196 | 196 | GravityView_Metabox_Tabs::add( $tab ); |
197 | 197 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | |
262 | 262 | $form = gravityview_get_form( $curr_form ); |
263 | 263 | |
264 | - $get_id_backup = isset( $_GET['id'] ) ? $_GET['id'] : null; |
|
264 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : null; |
|
265 | 265 | |
266 | - if ( isset( $form['id'] ) ) { |
|
266 | + if ( isset( $form[ 'id' ] ) ) { |
|
267 | 267 | $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
268 | 268 | |
269 | 269 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
270 | - $_GET['id'] = $form['id']; |
|
270 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
271 | 271 | |
272 | 272 | } else { |
273 | 273 | $form_script = 'var form = new Form();'; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
277 | 277 | |
278 | 278 | // Restore previous $_GET setting |
279 | - $_GET['id'] = $get_id_backup; |
|
279 | + $_GET[ 'id' ] = $get_id_backup; |
|
280 | 280 | |
281 | 281 | return $output; |
282 | 282 | } |
@@ -532,7 +532,7 @@ |
||
532 | 532 | * @since 1.16.4 |
533 | 533 | * @param int $entry_id ID of the Gravity Forms entry |
534 | 534 | * @param array $entry Deleted entry array |
535 | - */ |
|
535 | + */ |
|
536 | 536 | do_action( 'gravityview/delete-entry/deleted', $entry_id, $entry ); |
537 | 537 | } |
538 | 538 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function add_reserved_arg( $args ) { |
114 | 114 | |
115 | - $args[] = 'delete'; |
|
115 | + $args[ ] = 'delete'; |
|
116 | 116 | |
117 | 117 | return $args; |
118 | 118 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | // Index 100 is the default GravityView template path. |
184 | 184 | // Index 110 is Edit Entry link |
185 | - $file_paths[115] = self::$file; |
|
185 | + $file_paths[ 115 ] = self::$file; |
|
186 | 186 | |
187 | 187 | return $file_paths; |
188 | 188 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $attributes = array( |
288 | 288 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
289 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
289 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
290 | 290 | 'onclick' => self::get_confirm_dialog(), |
291 | 291 | ); |
292 | 292 | |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | ); |
323 | 323 | |
324 | 324 | // If the form is not submitted, return early |
325 | - if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) { |
|
325 | + if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) { |
|
326 | 326 | return; |
327 | 327 | } |
328 | 328 | |
329 | 329 | // Make sure it's a GravityView request |
330 | - $valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) ); |
|
330 | + $valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) ); |
|
331 | 331 | |
332 | 332 | if ( ! $valid_nonce_key ) { |
333 | 333 | gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' ); |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | // Get the entry slug |
339 | - $entry_slug = esc_attr( $get_fields['entry_id'] ); |
|
339 | + $entry_slug = esc_attr( $get_fields[ 'entry_id' ] ); |
|
340 | 340 | |
341 | 341 | // Redirect after deleting the entry. |
342 | - $view = \GV\View::by_id( $get_fields['view_id'] ); |
|
342 | + $view = \GV\View::by_id( $get_fields[ 'view_id' ] ); |
|
343 | 343 | |
344 | 344 | // See if there's an entry there |
345 | 345 | $entry = gravityview_get_entry( $entry_slug, true, false, $view ); |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | $this->_redirect_and_exit( $delete_redirect_base, $delete_response->get_error_message(), 'error' ); |
367 | 367 | } |
368 | 368 | |
369 | - if ( (int) $view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) { |
|
369 | + if ( (int)$view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) { |
|
370 | 370 | |
371 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
371 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
372 | 372 | $redirect_url_setting = $view->settings->get( 'delete_redirect_url' ); |
373 | 373 | $redirect_url = GFCommon::replace_variables( $redirect_url_setting, $form, $entry, false, false, false, 'text' ); |
374 | 374 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | private function delete_or_trash_entry( $entry ) { |
446 | 446 | |
447 | - $entry_id = $entry['id']; |
|
447 | + $entry_id = $entry[ 'id' ]; |
|
448 | 448 | |
449 | 449 | $mode = $this->get_delete_mode(); |
450 | 450 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
509 | 509 | |
510 | 510 | // The entry had no connected post |
511 | - if ( empty( $entry['post_id'] ) ) { |
|
511 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
512 | 512 | return; |
513 | 513 | } |
514 | 514 | |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | $action = current_action(); |
527 | 527 | |
528 | 528 | if ( 'gravityview/delete-entry/deleted' === $action ) { |
529 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
529 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
530 | 530 | } else { |
531 | - $result = wp_trash_post( $entry['post_id'] ); |
|
531 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | if ( false === $result ) { |
@@ -559,13 +559,13 @@ discard block |
||
559 | 559 | public function verify_nonce() { |
560 | 560 | |
561 | 561 | // No delete entry request was made |
562 | - if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
562 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
563 | 563 | return false; |
564 | 564 | } |
565 | 565 | |
566 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
566 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
567 | 567 | |
568 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
568 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
569 | 569 | |
570 | 570 | /** |
571 | 571 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
622 | 622 | } |
623 | 623 | |
624 | - if ( $entry['status'] === 'trash' ) { |
|
624 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
625 | 625 | if ( 'trash' === $this->get_delete_mode() ) { |
626 | 626 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
627 | 627 | } else { |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | |
666 | 666 | $current_user = wp_get_current_user(); |
667 | 667 | |
668 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : null; |
|
668 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null; |
|
669 | 669 | |
670 | 670 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
671 | 671 | if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
@@ -679,17 +679,17 @@ discard block |
||
679 | 679 | if ( ! empty( $field ) ) { |
680 | 680 | |
681 | 681 | // If capability is not defined, something is not right! |
682 | - if ( empty( $field['allow_edit_cap'] ) ) { |
|
682 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
683 | 683 | |
684 | 684 | gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) ); |
685 | 685 | |
686 | 686 | return false; |
687 | 687 | } |
688 | 688 | |
689 | - if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
689 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
690 | 690 | |
691 | 691 | // Do not return true if cap is read, as we need to check if the current user created the entry |
692 | - if ( $field['allow_edit_cap'] !== 'read' ) { |
|
692 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
693 | 693 | return true; |
694 | 694 | } |
695 | 695 | } else { |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
703 | - if ( ! isset( $entry['created_by'] ) ) { |
|
703 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
704 | 704 | |
705 | 705 | gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
706 | 706 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | } |
717 | 717 | |
718 | 718 | // If the logged-in user is the same as the user who created the entry, we're good. |
719 | - if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
719 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
720 | 720 | |
721 | 721 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
722 | 722 | |
@@ -741,12 +741,12 @@ discard block |
||
741 | 741 | */ |
742 | 742 | public function maybe_display_message( $current_view_id = 0 ) { |
743 | 743 | |
744 | - if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
744 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
745 | 745 | return; |
746 | 746 | } |
747 | 747 | |
748 | 748 | // Entry wasn't deleted from current View |
749 | - if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
749 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
750 | 750 | return; |
751 | 751 | } |
752 | 752 | |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | |
756 | 756 | public function display_message() { |
757 | 757 | |
758 | - if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) { |
|
758 | + if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
762 | - $status = esc_attr( $_GET['status'] ); |
|
762 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
763 | 763 | $message_from_url = \GV\Utils::_GET( 'message' ); |
764 | 764 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
765 | 765 | $class = ''; |
@@ -12,11 +12,11 @@ |
||
12 | 12 | extract( $gravityview_view->getCurrentField() ); |
13 | 13 | |
14 | 14 | // Only show the link to logged-in users with the right caps. |
15 | -if( !GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
15 | +if ( ! GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
16 | 16 | return; |
17 | 17 | } |
18 | 18 | |
19 | -$link_text = empty( $field_settings['delete_link'] ) ? __('Delete Entry', 'gravityview') : $field_settings['delete_link']; |
|
19 | +$link_text = empty( $field_settings[ 'delete_link' ] ) ? __( 'Delete Entry', 'gravityview' ) : $field_settings[ 'delete_link' ]; |
|
20 | 20 | |
21 | 21 | $link_text = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
22 | 22 |