@@ -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 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | |
179 | 179 | $this->remove_url_hooks(); |
180 | 180 | |
181 | - if( $translations ) { |
|
181 | + if ( $translations ) { |
|
182 | 182 | foreach ( $languages as $lang_code => $language ) { |
183 | 183 | |
184 | - if( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
184 | + if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | break; |
216 | 216 | } |
217 | 217 | |
218 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
218 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return GV_License_Handler |
48 | 48 | */ |
49 | 49 | public static function get_instance( GravityView_Settings $GFAddOn ) { |
50 | - if( empty( self::$instance ) ) { |
|
50 | + if ( empty( self::$instance ) ) { |
|
51 | 51 | self::$instance = new self( $GFAddOn ); |
52 | 52 | } |
53 | 53 | return self::$instance; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'url' => home_url(), |
124 | 124 | 'site_data' => $this->get_site_data(), |
125 | 125 | ), |
126 | - )); |
|
126 | + ) ); |
|
127 | 127 | |
128 | 128 | // make sure the response came back okay |
129 | 129 | if ( is_wp_error( $response ) ) { |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function refresh_license_status() { |
151 | 151 | |
152 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
152 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | 156 | global $pagenow; |
157 | 157 | |
158 | - $is_force_check = ( isset( $pagenow ) && 'update-core.php' === $pagenow && isset( $_REQUEST['force-check'] ) && '1' === $_REQUEST['force-check'] ); |
|
158 | + $is_force_check = ( isset( $pagenow ) && 'update-core.php' === $pagenow && isset( $_REQUEST[ 'force-check' ] ) && '1' === $_REQUEST[ 'force-check' ] ); |
|
159 | 159 | |
160 | 160 | // The transient is fresh; don't fetch. |
161 | - if( $status = get_transient( self::status_transient_key ) && ! $is_force_check ) { |
|
161 | + if ( $status = get_transient( self::status_transient_key ) && ! $is_force_check ) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
@@ -191,49 +191,49 @@ discard block |
||
191 | 191 | $theme_data = wp_get_theme(); |
192 | 192 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
193 | 193 | |
194 | - $data['gv_version'] = GravityView_Plugin::version; |
|
195 | - $data['php_version'] = phpversion(); |
|
196 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
197 | - $data['gf_version'] = GFForms::$version; |
|
198 | - $data['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : ''; |
|
199 | - $data['multisite'] = is_multisite(); |
|
200 | - $data['theme'] = $theme; |
|
201 | - $data['url'] = home_url(); |
|
202 | - $data['license_key'] = GravityView_Settings::get_instance()->get_app_setting( 'license_key' ); |
|
203 | - $data['beta'] = GravityView_Settings::get_instance()->get_app_setting( 'beta' ); |
|
194 | + $data[ 'gv_version' ] = GravityView_Plugin::version; |
|
195 | + $data[ 'php_version' ] = phpversion(); |
|
196 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
197 | + $data[ 'gf_version' ] = GFForms::$version; |
|
198 | + $data[ 'server' ] = isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) ? $_SERVER[ 'SERVER_SOFTWARE' ] : ''; |
|
199 | + $data[ 'multisite' ] = is_multisite(); |
|
200 | + $data[ 'theme' ] = $theme; |
|
201 | + $data[ 'url' ] = home_url(); |
|
202 | + $data[ 'license_key' ] = GravityView_Settings::get_instance()->get_app_setting( 'license_key' ); |
|
203 | + $data[ 'beta' ] = GravityView_Settings::get_instance()->get_app_setting( 'beta' ); |
|
204 | 204 | |
205 | 205 | // View Data |
206 | - $gravityview_posts = get_posts('numberposts=-1&post_type=gravityview&post_status=publish&order=ASC'); |
|
206 | + $gravityview_posts = get_posts( 'numberposts=-1&post_type=gravityview&post_status=publish&order=ASC' ); |
|
207 | 207 | |
208 | 208 | if ( ! empty( $gravityview_posts ) ) { |
209 | 209 | $first = array_shift( $gravityview_posts ); |
210 | 210 | $latest = array_pop( $gravityview_posts ); |
211 | - $data['view_count'] = count( $gravityview_posts ); |
|
212 | - $data['view_first'] = $first->post_date; |
|
213 | - $data['view_latest'] = $latest->post_date; |
|
211 | + $data[ 'view_count' ] = count( $gravityview_posts ); |
|
212 | + $data[ 'view_first' ] = $first->post_date; |
|
213 | + $data[ 'view_latest' ] = $latest->post_date; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | // Form counts |
217 | 217 | if ( class_exists( 'GFFormsModel' ) ) { |
218 | 218 | $form_data = GFFormsModel::get_form_count(); |
219 | - $data['forms_total'] = rgar( $form_data, 'total', 0 ); |
|
220 | - $data['forms_active'] = rgar( $form_data, 'active', 0 ); |
|
221 | - $data['forms_inactive'] = rgar( $form_data, 'inactive', 0 ); |
|
222 | - $data['forms_trash'] = rgar( $form_data, 'inactive', 0 ); |
|
219 | + $data[ 'forms_total' ] = rgar( $form_data, 'total', 0 ); |
|
220 | + $data[ 'forms_active' ] = rgar( $form_data, 'active', 0 ); |
|
221 | + $data[ 'forms_inactive' ] = rgar( $form_data, 'inactive', 0 ); |
|
222 | + $data[ 'forms_trash' ] = rgar( $form_data, 'inactive', 0 ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Retrieve current plugin information |
226 | - if( ! function_exists( 'get_plugins' ) ) { |
|
226 | + if ( ! function_exists( 'get_plugins' ) ) { |
|
227 | 227 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
228 | 228 | } |
229 | 229 | |
230 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
231 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
232 | - $data['inactive_plugins'] = array(); |
|
233 | - $data['locale'] = get_locale(); |
|
230 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
231 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
232 | + $data[ 'inactive_plugins' ] = array(); |
|
233 | + $data[ 'locale' ] = get_locale(); |
|
234 | 234 | |
235 | 235 | // Validate request on the GV server |
236 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
236 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
237 | 237 | |
238 | 238 | return $data; |
239 | 239 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | |
266 | 266 | $plugin_data = get_plugin_data( $active_plugin ); |
267 | 267 | |
268 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
268 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
269 | 269 | } |
270 | 270 | |
271 | - if( ! empty( $extensions ) ) { |
|
271 | + if ( ! empty( $extensions ) ) { |
|
272 | 272 | set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
273 | 273 | } else { |
274 | 274 | return 'There was an error fetching related plugins.'; |
@@ -287,37 +287,37 @@ discard block |
||
287 | 287 | $status = trim( $this->Addon->get_app_setting( 'license_key_status' ) ); |
288 | 288 | $key = trim( $this->Addon->get_app_setting( 'license_key' ) ); |
289 | 289 | |
290 | - if( !empty( $key ) ) { |
|
290 | + if ( ! empty( $key ) ) { |
|
291 | 291 | $response = $this->Addon->get_app_setting( 'license_key_response' ); |
292 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
292 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
293 | 293 | } else { |
294 | 294 | $response = array(); |
295 | 295 | } |
296 | 296 | |
297 | 297 | wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array( |
298 | 298 | 'license_box' => $this->get_license_message( $response ) |
299 | - )); |
|
299 | + ) ); |
|
300 | 300 | |
301 | 301 | |
302 | 302 | $fields = array( |
303 | 303 | array( |
304 | 304 | 'name' => 'edd-activate', |
305 | - 'value' => __('Activate License', 'gravityview'), |
|
306 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
305 | + 'value' => __( 'Activate License', 'gravityview' ), |
|
306 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
307 | 307 | 'data-edd_action' => 'activate_license', |
308 | 308 | 'class' => 'button-primary', |
309 | 309 | ), |
310 | 310 | array( |
311 | 311 | 'name' => 'edd-deactivate', |
312 | - 'value' => __('Deactivate License', 'gravityview'), |
|
313 | - 'data-pending_text' => __('Deactivating license…', 'gravityview'), |
|
312 | + 'value' => __( 'Deactivate License', 'gravityview' ), |
|
313 | + 'data-pending_text' => __( 'Deactivating license…', 'gravityview' ), |
|
314 | 314 | 'data-edd_action' => 'deactivate_license', |
315 | 315 | 'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ), |
316 | 316 | ), |
317 | 317 | array( |
318 | 318 | 'name' => 'edd-check', |
319 | - 'value' => __('Check License', 'gravityview'), |
|
320 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
319 | + 'value' => __( 'Check License', 'gravityview' ), |
|
320 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
321 | 321 | 'title' => 'Check the license before saving it', |
322 | 322 | 'data-edd_action' => 'check_license', |
323 | 323 | 'class' => 'button-secondary', |
@@ -327,17 +327,17 @@ discard block |
||
327 | 327 | |
328 | 328 | $class = 'button gv-edd-action'; |
329 | 329 | |
330 | - $class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
330 | + $class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
331 | 331 | |
332 | 332 | $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
333 | 333 | |
334 | 334 | $submit = '<div class="gv-edd-button-wrapper">'; |
335 | 335 | foreach ( $fields as $field ) { |
336 | - $field['type'] = 'button'; |
|
337 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
338 | - $field['style'] = 'margin-left: 10px;'; |
|
339 | - if( $disabled_attribute ) { |
|
340 | - $field['disabled'] = $disabled_attribute; |
|
336 | + $field[ 'type' ] = 'button'; |
|
337 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
338 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
339 | + if ( $disabled_attribute ) { |
|
340 | + $field[ 'disabled' ] = $disabled_attribute; |
|
341 | 341 | } |
342 | 342 | $submit .= $this->Addon->settings_submit( $field, $echo ); |
343 | 343 | } |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function setup_edd() { |
358 | 358 | |
359 | - if( !class_exists('EDD_SL_Plugin_Updater') ) { |
|
360 | - require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php'); |
|
359 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
360 | + require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' ); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | // setup the updater |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | 'beta' => $this->Addon->get_app_setting( 'beta' ), |
396 | 396 | ); |
397 | 397 | |
398 | - if( !empty( $action ) ) { |
|
399 | - $settings['edd_action'] = esc_attr( $action ); |
|
398 | + if ( ! empty( $action ) ) { |
|
399 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | $settings = array_map( 'urlencode', $settings ); |
@@ -410,14 +410,14 @@ discard block |
||
410 | 410 | */ |
411 | 411 | private function _license_get_remote_response( $data, $license = '' ) { |
412 | 412 | |
413 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
413 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
414 | 414 | |
415 | 415 | $url = add_query_arg( $api_params, self::url ); |
416 | 416 | |
417 | 417 | $response = wp_remote_get( $url, array( |
418 | 418 | 'timeout' => 15, |
419 | 419 | 'sslverify' => false, |
420 | - )); |
|
420 | + ) ); |
|
421 | 421 | |
422 | 422 | if ( is_wp_error( $response ) ) { |
423 | 423 | |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | */ |
456 | 456 | function get_license_message( $license_data ) { |
457 | 457 | |
458 | - if( empty( $license_data ) ) { |
|
458 | + if ( empty( $license_data ) ) { |
|
459 | 459 | $message = ''; |
460 | 460 | } else { |
461 | 461 | |
462 | - if( ! empty( $license_data->error ) ) { |
|
462 | + if ( ! empty( $license_data->error ) ) { |
|
463 | 463 | $class = 'error'; |
464 | 464 | $string_key = $license_data->error; |
465 | 465 | } else { |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $string_key = $license_data->license; |
468 | 468 | } |
469 | 469 | |
470 | - $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) ); |
|
470 | + $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) ); |
|
471 | 471 | |
472 | 472 | $message = $this->generate_license_box( $message, $class ); |
473 | 473 | } |
@@ -504,18 +504,18 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function license_details( $response = array() ) { |
506 | 506 | |
507 | - $response = (array) $response; |
|
507 | + $response = (array)$response; |
|
508 | 508 | |
509 | 509 | $return = ''; |
510 | 510 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
511 | 511 | |
512 | - if( ! empty( $response['license_key'] ) ) { |
|
512 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
513 | 513 | |
514 | 514 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
515 | 515 | |
516 | 516 | if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
517 | - $return .= $this->strings( $response['license'], $response ); |
|
518 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
517 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
518 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
519 | 519 | |
520 | 520 | $response_keys = array( |
521 | 521 | 'license_name' => '', |
@@ -530,19 +530,19 @@ discard block |
||
530 | 530 | // Make sure all the keys are set |
531 | 531 | $response = wp_parse_args( $response, $response_keys ); |
532 | 532 | |
533 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
534 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
533 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
534 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
535 | 535 | $details = array( |
536 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
537 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
538 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
539 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
540 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
536 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
537 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
538 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
539 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
540 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
541 | 541 | ); |
542 | 542 | |
543 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
544 | - unset( $details['upgrade'] ); |
|
545 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
543 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
544 | + unset( $details[ 'upgrade' ] ); |
|
545 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -565,11 +565,11 @@ discard block |
||
565 | 565 | |
566 | 566 | $output = ''; |
567 | 567 | |
568 | - if( ! empty( $upgrades ) ) { |
|
568 | + if ( ! empty( $upgrades ) ) { |
|
569 | 569 | |
570 | 570 | $locale_parts = explode( '_', get_locale() ); |
571 | 571 | |
572 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
572 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
573 | 573 | |
574 | 574 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
575 | 575 | |
@@ -577,14 +577,14 @@ discard block |
||
577 | 577 | |
578 | 578 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
579 | 579 | |
580 | - $upgrade = (object) $upgrade; |
|
580 | + $upgrade = (object)$upgrade; |
|
581 | 581 | |
582 | 582 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
583 | 583 | |
584 | - if( $is_english && isset( $upgrade->description ) ) { |
|
584 | + if ( $is_english && isset( $upgrade->description ) ) { |
|
585 | 585 | $message = esc_html( $upgrade->description ); |
586 | 586 | } else { |
587 | - switch( $upgrade->price_id ) { |
|
587 | + switch ( $upgrade->price_id ) { |
|
588 | 588 | // Interstellar |
589 | 589 | case 1: |
590 | 590 | default: |
@@ -622,16 +622,16 @@ discard block |
||
622 | 622 | */ |
623 | 623 | public function license_call( $array = array() ) { |
624 | 624 | |
625 | - $is_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); |
|
626 | - $data = empty( $array ) ? $_POST['data'] : $array; |
|
625 | + $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
626 | + $data = empty( $array ) ? $_POST[ 'data' ] : $array; |
|
627 | 627 | $has_cap = GVCommon::has_cap( 'gravityview_edit_settings' ); |
628 | 628 | |
629 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
630 | - die( - 1 ); |
|
629 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
630 | + die( -1 ); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | // If the user isn't allowed to edit settings, show an error message |
634 | - if( ! $has_cap && empty( $data['all_caps'] ) ) { |
|
634 | + if ( ! $has_cap && empty( $data[ 'all_caps' ] ) ) { |
|
635 | 635 | $license_data = new stdClass(); |
636 | 636 | $license_data->error = 'capability'; |
637 | 637 | $license_data->message = $this->get_license_message( $license_data ); |
@@ -655,11 +655,11 @@ discard block |
||
655 | 655 | |
656 | 656 | $json = json_encode( $license_data ); |
657 | 657 | |
658 | - $update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) ); |
|
658 | + $update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) ); |
|
659 | 659 | |
660 | - $is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
660 | + $is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
661 | 661 | |
662 | - if( $is_check_action_button ) { |
|
662 | + if ( $is_check_action_button ) { |
|
663 | 663 | delete_transient( self::status_transient_key ); |
664 | 664 | } |
665 | 665 | // Failed is the response from trying to de-activate a license and it didn't work. |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | // most likely a mistake. |
669 | 669 | else if ( $license_data->license !== 'failed' && $update_license ) { |
670 | 670 | |
671 | - if ( ! empty( $data['field_id'] ) ) { |
|
671 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
672 | 672 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
673 | 673 | } |
674 | 674 | |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | if ( $is_ajax ) { |
680 | 680 | exit( $json ); |
681 | 681 | } else { // Non-ajax call |
682 | - return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
|
682 | + return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json; |
|
683 | 683 | } |
684 | 684 | } |
685 | 685 | |
@@ -693,9 +693,9 @@ discard block |
||
693 | 693 | // Update option with passed data license |
694 | 694 | $settings = $this->Addon->get_app_settings(); |
695 | 695 | |
696 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
697 | - $settings['license_key_status'] = $license_data->license; |
|
698 | - $settings['license_key_response'] = (array)$license_data; |
|
696 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
697 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
698 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
699 | 699 | |
700 | 700 | $this->Addon->update_app_settings( $settings ); |
701 | 701 | } |
@@ -710,9 +710,9 @@ discard block |
||
710 | 710 | |
711 | 711 | $license_data = is_array( $license_data ) ? (object)$license_data : $license_data; |
712 | 712 | |
713 | - if( ! empty( $license_data->renewal_url ) ) { |
|
713 | + if ( ! empty( $license_data->renewal_url ) ) { |
|
714 | 714 | $renew_license_url = $license_data->renewal_url; |
715 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
715 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
716 | 716 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
717 | 717 | } else { |
718 | 718 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -734,31 +734,31 @@ discard block |
||
734 | 734 | |
735 | 735 | |
736 | 736 | $strings = array( |
737 | - 'status' => esc_html__('Status', 'gravityview'), |
|
738 | - 'error' => esc_html__('There was an error processing the request.', 'gravityview'), |
|
739 | - 'failed' => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'), |
|
740 | - 'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
741 | - 'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
742 | - 'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
743 | - 'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'), |
|
744 | - 'valid' => esc_html__('The license key is valid and active.', 'gravityview'), |
|
745 | - 'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'), |
|
746 | - 'missing' => esc_html__('Invalid license key.', 'gravityview'), |
|
747 | - 'revoked' => esc_html__('This license key has been revoked.', 'gravityview'), |
|
748 | - 'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
737 | + 'status' => esc_html__( 'Status', 'gravityview' ), |
|
738 | + 'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ), |
|
739 | + 'failed' => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ), |
|
740 | + 'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
741 | + 'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
742 | + 'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
743 | + 'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ), |
|
744 | + 'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ), |
|
745 | + 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
|
746 | + 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
|
747 | + 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
|
748 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
749 | 749 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
750 | 750 | |
751 | - 'verifying_license' => esc_html__('Verifying license…', 'gravityview'), |
|
752 | - 'activate_license' => esc_html__('Activate License', 'gravityview'), |
|
753 | - 'deactivate_license' => esc_html__('Deactivate License', 'gravityview'), |
|
754 | - 'check_license' => esc_html__('Verify License', 'gravityview'), |
|
751 | + 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
|
752 | + 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
|
753 | + 'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ), |
|
754 | + 'check_license' => esc_html__( 'Verify License', 'gravityview' ), |
|
755 | 755 | ); |
756 | 756 | |
757 | - if( empty( $status ) ) { |
|
757 | + if ( empty( $status ) ) { |
|
758 | 758 | return $strings; |
759 | 759 | } |
760 | 760 | |
761 | - if( isset( $strings[ $status ] ) ) { |
|
761 | + if ( isset( $strings[ $status ] ) ) { |
|
762 | 762 | return $strings[ $status ]; |
763 | 763 | } |
764 | 764 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
50 | 50 | |
51 | 51 | /** @var GF_Field $field */ |
52 | - foreach( $fields as &$field ) { |
|
52 | + foreach ( $fields as &$field ) { |
|
53 | 53 | if ( 'hidden' === $field->type ) { |
54 | 54 | |
55 | 55 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', true, $field ); |
62 | 62 | |
63 | - if( ! $reveal_hidden_field ) { |
|
63 | + if ( ! $reveal_hidden_field ) { |
|
64 | 64 | continue; |
65 | 65 | } |
66 | 66 |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | |
360 | 360 | /** |
361 | 361 | * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic |
362 | - * @since 1.22.2 |
|
363 | - * @param bool $unset_hidden_field_values Default: true |
|
364 | - * @param GravityView_Edit_Entry_Render $this This object |
|
362 | + * @since 1.22.2 |
|
363 | + * @param bool $unset_hidden_field_values Default: true |
|
364 | + * @param GravityView_Edit_Entry_Render $this This object |
|
365 | 365 | */ |
366 | 366 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
367 | 367 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | - if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
372 | + if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
373 | 373 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
374 | 374 | $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
375 | 375 | } else { |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
1290 | 1290 | if( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
1291 | - $field->adminOnly = NULL; |
|
1291 | + $field->adminOnly = NULL; |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | switch( RGFormsModel::get_input_type( $field ) ) { |
@@ -1771,8 +1771,8 @@ discard block |
||
1771 | 1771 | * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
1772 | 1772 | * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
1773 | 1773 | * @since 1.9.1 |
1774 | - * @since 1.22.6 Deprecated |
|
1775 | - * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
1774 | + * @since 1.22.6 Deprecated |
|
1775 | + * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
1776 | 1776 | * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
1777 | 1777 | * @param array $form GF Form array |
1778 | 1778 | * @param int $view_id View ID |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | unset( $fields[ $k ] ); |
1799 | 1799 | } |
1800 | 1800 | } else{ |
1801 | - if( 'administrative' === $field->visibility ) { |
|
1801 | + if( 'administrative' === $field->visibility ) { |
|
1802 | 1802 | unset( $fields[ $k ] ); |
1803 | 1803 | } |
1804 | 1804 | } |
@@ -1808,25 +1808,25 @@ discard block |
||
1808 | 1808 | |
1809 | 1809 | foreach( $fields as &$field ) { |
1810 | 1810 | |
1811 | - // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
1812 | - if( ! isset( $field->visibility ) ) { |
|
1811 | + // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
1812 | + if( ! isset( $field->visibility ) ) { |
|
1813 | 1813 | |
1814 | - $field->adminOnly = false; |
|
1814 | + $field->adminOnly = false; |
|
1815 | 1815 | |
1816 | - } else { |
|
1816 | + } else { |
|
1817 | 1817 | |
1818 | - /** |
|
1819 | - * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
1820 | - * @since 1.22.6 |
|
1821 | - * |
|
1822 | - * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
1823 | - * @param GF_Field $field Form field being modified |
|
1824 | - * @param int $view_id Current View ID |
|
1825 | - */ |
|
1826 | - $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
1818 | + /** |
|
1819 | + * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
1820 | + * @since 1.22.6 |
|
1821 | + * |
|
1822 | + * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
1823 | + * @param GF_Field $field Form field being modified |
|
1824 | + * @param int $view_id Current View ID |
|
1825 | + */ |
|
1826 | + $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
1827 | 1827 | |
1828 | - $field->visibility = $visibility; |
|
1829 | - } |
|
1828 | + $field->visibility = $visibility; |
|
1829 | + } |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | return $fields; |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | function load() { |
107 | 107 | |
108 | 108 | /** @define "GRAVITYVIEW_DIR" "../../../" */ |
109 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
109 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
110 | 110 | |
111 | 111 | // Don't display an embedded form when editing an entry |
112 | 112 | add_action( 'wp_head', array( $this, 'prevent_render_form' ) ); |
113 | 113 | add_action( 'wp_footer', array( $this, 'prevent_render_form' ) ); |
114 | 114 | |
115 | 115 | // Stop Gravity Forms processing what is ours! |
116 | - add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 ); |
|
116 | + add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 ); |
|
117 | 117 | |
118 | - add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') ); |
|
118 | + add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) ); |
|
119 | 119 | |
120 | 120 | add_action( 'gravityview_edit_entry', array( $this, 'init' ) ); |
121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 ); |
127 | 127 | |
128 | 128 | // Add fields expected by GFFormDisplay::validate() |
129 | - add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') ); |
|
129 | + add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) ); |
|
130 | 130 | |
131 | 131 | // Fix multiselect value for GF 2.2 |
132 | 132 | add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 ); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function prevent_render_form() { |
146 | - if( $this->is_edit_entry() ) { |
|
147 | - if( 'wp_head' === current_filter() ) { |
|
146 | + if ( $this->is_edit_entry() ) { |
|
147 | + if ( 'wp_head' === current_filter() ) { |
|
148 | 148 | add_filter( 'gform_shortcode_form', '__return_empty_string' ); |
149 | 149 | } else { |
150 | 150 | remove_filter( 'gform_shortcode_form', '__return_empty_string' ); |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function prevent_maybe_process_form() { |
161 | 161 | |
162 | - if( ! empty( $_POST ) ) { |
|
162 | + if ( ! empty( $_POST ) ) { |
|
163 | 163 | do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
164 | 164 | } |
165 | 165 | |
166 | - if( $this->is_edit_entry_submission() ) { |
|
167 | - remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
168 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
166 | + if ( $this->is_edit_entry_submission() ) { |
|
167 | + remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
168 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function is_edit_entry() { |
177 | 177 | |
178 | - $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] ); |
|
178 | + $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] ); |
|
179 | 179 | |
180 | 180 | return ( $is_edit_entry || $this->is_edit_entry_submission() ); |
181 | 181 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return boolean |
187 | 187 | */ |
188 | 188 | public function is_edit_entry_submission() { |
189 | - return !empty( $_POST[ self::$nonce_field ] ); |
|
189 | + return ! empty( $_POST[ self::$nonce_field ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | |
198 | 198 | |
199 | 199 | $entries = $gravityview_view->getEntries(); |
200 | - self::$original_entry = $entries[0]; |
|
201 | - $this->entry = $entries[0]; |
|
200 | + self::$original_entry = $entries[ 0 ]; |
|
201 | + $this->entry = $entries[ 0 ]; |
|
202 | 202 | |
203 | 203 | self::$original_form = $gravityview_view->getForm(); |
204 | 204 | $this->form = $gravityview_view->getForm(); |
205 | 205 | $this->form_id = $gravityview_view->getFormId(); |
206 | 206 | $this->view_id = $gravityview_view->getViewId(); |
207 | 207 | |
208 | - self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] ); |
|
208 | + self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] ); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | |
227 | 227 | // Multiple Views embedded, don't proceed if nonce fails |
228 | 228 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $gv_data->has_multiple_views(); |
229 | - if( $multiple_views && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) { |
|
230 | - do_action('gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' ); |
|
229 | + if ( $multiple_views && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) { |
|
230 | + do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' ); |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Sorry, you're not allowed here. |
235 | - if( false === $this->user_can_edit_entry( true ) ) { |
|
236 | - do_action('gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry ); |
|
235 | + if ( false === $this->user_can_edit_entry( true ) ) { |
|
236 | + do_action( 'gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry ); |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | private function print_scripts() { |
254 | 254 | $gravityview_view = GravityView_View::getInstance(); |
255 | 255 | |
256 | - wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
256 | + wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
257 | 257 | |
258 | - GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false); |
|
258 | + GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false ); |
|
259 | 259 | |
260 | 260 | // Sack is required for images |
261 | 261 | wp_print_scripts( array( 'sack', 'gform_gravityforms' ) ); |
@@ -267,32 +267,32 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function process_save() { |
269 | 269 | |
270 | - if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) { |
|
270 | + if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // Make sure the entry, view, and form IDs are all correct |
275 | 275 | $valid = $this->verify_nonce(); |
276 | 276 | |
277 | - if( !$valid ) { |
|
278 | - do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' ); |
|
277 | + if ( ! $valid ) { |
|
278 | + do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' ); |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
282 | - if( $this->entry['id'] !== $_POST['lid'] ) { |
|
283 | - do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' ); |
|
282 | + if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) { |
|
283 | + do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' ); |
|
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - do_action('gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
287 | + do_action( 'gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
288 | 288 | |
289 | 289 | $this->process_save_process_files( $this->form_id ); |
290 | 290 | |
291 | 291 | $this->validate(); |
292 | 292 | |
293 | - if( $this->is_valid ) { |
|
293 | + if ( $this->is_valid ) { |
|
294 | 294 | |
295 | - do_action('gravityview_log_debug', __METHOD__ . ': Submission is valid.' ); |
|
295 | + do_action( 'gravityview_log_debug', __METHOD__ . ': Submission is valid.' ); |
|
296 | 296 | |
297 | 297 | /** |
298 | 298 | * @hack This step is needed to fix field visibility, to add the calculation fields |
@@ -302,22 +302,22 @@ discard block |
||
302 | 302 | /** |
303 | 303 | * @hack to avoid the capability validation of the method save_lead for GF 1.9+ |
304 | 304 | */ |
305 | - unset( $_GET['page'] ); |
|
305 | + unset( $_GET[ 'page' ] ); |
|
306 | 306 | |
307 | - $date_created = $this->entry['date_created']; |
|
307 | + $date_created = $this->entry[ 'date_created' ]; |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead() |
311 | 311 | * @since 1.17.2 |
312 | 312 | */ |
313 | - unset( $this->entry['date_created'] ); |
|
313 | + unset( $this->entry[ 'date_created' ] ); |
|
314 | 314 | |
315 | 315 | GFFormsModel::save_lead( $form, $this->entry ); |
316 | 316 | |
317 | 317 | // Delete the values for hidden inputs |
318 | 318 | $this->unset_hidden_field_values(); |
319 | 319 | |
320 | - $this->entry['date_created'] = $date_created; |
|
320 | + $this->entry[ 'date_created' ] = $date_created; |
|
321 | 321 | |
322 | 322 | // Process calculation fields |
323 | 323 | $this->update_calculation_fields(); |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | * @param string $entry_id Numeric ID of the entry that was updated |
338 | 338 | * @param GravityView_Edit_Entry_Render $this This object |
339 | 339 | */ |
340 | - do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this ); |
|
340 | + do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this ); |
|
341 | 341 | |
342 | 342 | } else { |
343 | - do_action('gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry ); |
|
343 | + do_action( 'gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry ); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | } // process_save |
@@ -365,16 +365,16 @@ discard block |
||
365 | 365 | */ |
366 | 366 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
367 | 367 | |
368 | - if( ! $unset_hidden_field_values ) { |
|
368 | + if ( ! $unset_hidden_field_values ) { |
|
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | 372 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
373 | 373 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
374 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
|
374 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) ); |
|
375 | 375 | } else { |
376 | 376 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
377 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
|
377 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) ); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | foreach ( $this->entry as $input_id => $field_value ) { |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | /** No file is being uploaded. */ |
458 | - if ( empty( $_FILES[ $input_name ]['name'] ) ) { |
|
458 | + if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
459 | 459 | /** So return the original upload */ |
460 | 460 | return $entry[ $input_id ]; |
461 | 461 | } |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | * @return mixed |
474 | 474 | */ |
475 | 475 | public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) { |
476 | - if( ! $this->is_edit_entry() ) { |
|
476 | + if ( ! $this->is_edit_entry() ) { |
|
477 | 477 | return $plupload_init; |
478 | 478 | } |
479 | 479 | |
480 | - $plupload_init['gf_vars']['max_files'] = 0; |
|
480 | + $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0; |
|
481 | 481 | |
482 | 482 | return $plupload_init; |
483 | 483 | } |
@@ -492,22 +492,22 @@ discard block |
||
492 | 492 | $form = $this->form; |
493 | 493 | |
494 | 494 | /** @var GF_Field $field */ |
495 | - foreach( $form['fields'] as $k => &$field ) { |
|
495 | + foreach ( $form[ 'fields' ] as $k => &$field ) { |
|
496 | 496 | |
497 | 497 | /** |
498 | 498 | * Remove the fields with calculation formulas before save to avoid conflicts with GF logic |
499 | 499 | * @since 1.16.3 |
500 | 500 | * @var GF_Field $field |
501 | 501 | */ |
502 | - if( $field->has_calculation() ) { |
|
503 | - unset( $form['fields'][ $k ] ); |
|
502 | + if ( $field->has_calculation() ) { |
|
503 | + unset( $form[ 'fields' ][ $k ] ); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | $field->adminOnly = false; |
507 | 507 | |
508 | - if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
509 | - foreach( $field->inputs as $key => $input ) { |
|
510 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
508 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
509 | + foreach ( $field->inputs as $key => $input ) { |
|
510 | + $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ]; |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
@@ -521,21 +521,21 @@ discard block |
||
521 | 521 | $update = false; |
522 | 522 | |
523 | 523 | // get the most up to date entry values |
524 | - $entry = GFAPI::get_entry( $this->entry['id'] ); |
|
524 | + $entry = GFAPI::get_entry( $this->entry[ 'id' ] ); |
|
525 | 525 | |
526 | - if( !empty( $this->fields_with_calculation ) ) { |
|
526 | + if ( ! empty( $this->fields_with_calculation ) ) { |
|
527 | 527 | $update = true; |
528 | 528 | foreach ( $this->fields_with_calculation as $calc_field ) { |
529 | 529 | $inputs = $calc_field->get_entry_inputs(); |
530 | 530 | if ( is_array( $inputs ) ) { |
531 | 531 | foreach ( $inputs as $input ) { |
532 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
532 | + $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
533 | 533 | list( $prefix, $field_id, $input_id ) = rgexplode( '_', $input_name, 3 ); |
534 | 534 | |
535 | 535 | switch ( $input_id ) { |
536 | 536 | case 1: |
537 | 537 | /** Never void the labels. */ |
538 | - $value = $entry[ $input['id'] ]; |
|
538 | + $value = $entry[ $input[ 'id' ] ]; |
|
539 | 539 | break; |
540 | 540 | case 2: |
541 | 541 | /** Always recalcualte the final price. */ |
@@ -543,25 +543,25 @@ discard block |
||
543 | 543 | break; |
544 | 544 | case 3: |
545 | 545 | /** Fetch the quantity form the request. */ |
546 | - $value = rgpost( $input_name, $entry[ $input['id'] ] ); |
|
546 | + $value = rgpost( $input_name, $entry[ $input[ 'id' ] ] ); |
|
547 | 547 | break; |
548 | 548 | } |
549 | 549 | |
550 | - $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry['id'], $entry ); |
|
550 | + $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry[ 'id' ], $entry ); |
|
551 | 551 | } |
552 | 552 | } else { |
553 | - $input_name = 'input_' . str_replace( '.', '_', $calc_field->id); |
|
554 | - $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
553 | + $input_name = 'input_' . str_replace( '.', '_', $calc_field->id ); |
|
554 | + $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry ); |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | 558 | } |
559 | 559 | |
560 | - if( $update ) { |
|
560 | + if ( $update ) { |
|
561 | 561 | |
562 | 562 | $return_entry = GFAPI::update_entry( $entry ); |
563 | 563 | |
564 | - if( is_wp_error( $return_entry ) ) { |
|
564 | + if ( is_wp_error( $return_entry ) ) { |
|
565 | 565 | do_action( 'gravityview_log_error', 'Updating the entry calculation fields failed', $return_entry ); |
566 | 566 | } else { |
567 | 567 | do_action( 'gravityview_log_debug', 'Updating the entry calculation fields succeeded' ); |
@@ -592,19 +592,19 @@ discard block |
||
592 | 592 | |
593 | 593 | $input_name = 'input_' . $field_id; |
594 | 594 | |
595 | - if ( !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
595 | + if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
596 | 596 | |
597 | 597 | // We have a new image |
598 | 598 | |
599 | - $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
|
599 | + $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] ); |
|
600 | 600 | |
601 | 601 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
602 | 602 | $ary = stripslashes_deep( $ary ); |
603 | 603 | $img_url = rgar( $ary, 0 ); |
604 | 604 | |
605 | - $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
|
606 | - $img_caption = count( $ary ) > 2 ? $ary[2] : ''; |
|
607 | - $img_description = count( $ary ) > 3 ? $ary[3] : ''; |
|
605 | + $img_title = count( $ary ) > 1 ? $ary[ 1 ] : ''; |
|
606 | + $img_caption = count( $ary ) > 2 ? $ary[ 2 ] : ''; |
|
607 | + $img_description = count( $ary ) > 3 ? $ary[ 3 ] : ''; |
|
608 | 608 | |
609 | 609 | $image_meta = array( |
610 | 610 | 'post_excerpt' => $img_caption, |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | //adding title only if it is not empty. It will default to the file name if it is not in the array |
615 | 615 | if ( ! empty( $img_title ) ) { |
616 | - $image_meta['post_title'] = $img_title; |
|
616 | + $image_meta[ 'post_title' ] = $img_title; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | /** |
@@ -627,11 +627,11 @@ discard block |
||
627 | 627 | set_post_thumbnail( $post_id, $media_id ); |
628 | 628 | } |
629 | 629 | |
630 | - } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) { |
|
630 | + } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) { |
|
631 | 631 | |
632 | 632 | $img_url = rgpost( $input_name ); |
633 | - $img_title = rgpost( $input_name . '_1' ); |
|
634 | - $img_caption = rgpost( $input_name . '_4' ); |
|
633 | + $img_title = rgpost( $input_name . '_1' ); |
|
634 | + $img_caption = rgpost( $input_name . '_4' ); |
|
635 | 635 | $img_description = rgpost( $input_name . '_7' ); |
636 | 636 | |
637 | 637 | $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : ''; |
@@ -670,16 +670,16 @@ discard block |
||
670 | 670 | */ |
671 | 671 | private function maybe_update_post_fields( $form ) { |
672 | 672 | |
673 | - if( empty( $this->entry['post_id'] ) ) { |
|
673 | + if ( empty( $this->entry[ 'post_id' ] ) ) { |
|
674 | 674 | do_action( 'gravityview_log_debug', __METHOD__ . ': This entry has no post fields. Continuing...' ); |
675 | 675 | return; |
676 | 676 | } |
677 | 677 | |
678 | - $post_id = $this->entry['post_id']; |
|
678 | + $post_id = $this->entry[ 'post_id' ]; |
|
679 | 679 | |
680 | 680 | // Security check |
681 | - if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
682 | - do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id ); |
|
681 | + if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
682 | + do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id ); |
|
683 | 683 | return; |
684 | 684 | } |
685 | 685 | |
@@ -691,25 +691,25 @@ discard block |
||
691 | 691 | |
692 | 692 | $field = RGFormsModel::get_field( $form, $field_id ); |
693 | 693 | |
694 | - if( ! $field ) { |
|
694 | + if ( ! $field ) { |
|
695 | 695 | continue; |
696 | 696 | } |
697 | 697 | |
698 | - if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
698 | + if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
699 | 699 | |
700 | 700 | // Get the value of the field, including $_POSTed value |
701 | 701 | $value = RGFormsModel::get_field_value( $field ); |
702 | 702 | |
703 | 703 | // Use temporary entry variable, to make values available to fill_post_template() and update_post_image() |
704 | 704 | $entry_tmp = $this->entry; |
705 | - $entry_tmp["{$field_id}"] = $value; |
|
705 | + $entry_tmp[ "{$field_id}" ] = $value; |
|
706 | 706 | |
707 | - switch( $field->type ) { |
|
707 | + switch ( $field->type ) { |
|
708 | 708 | |
709 | 709 | case 'post_title': |
710 | 710 | $post_title = $value; |
711 | - if( rgar( $form, 'postTitleTemplateEnabled' ) ) { |
|
712 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
711 | + if ( rgar( $form, 'postTitleTemplateEnabled' ) ) { |
|
712 | + $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp ); |
|
713 | 713 | } |
714 | 714 | $updated_post->post_title = $post_title; |
715 | 715 | $updated_post->post_name = $post_title; |
@@ -718,8 +718,8 @@ discard block |
||
718 | 718 | |
719 | 719 | case 'post_content': |
720 | 720 | $post_content = $value; |
721 | - if( rgar( $form, 'postContentTemplateEnabled' ) ) { |
|
722 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
721 | + if ( rgar( $form, 'postContentTemplateEnabled' ) ) { |
|
722 | + $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true ); |
|
723 | 723 | } |
724 | 724 | $updated_post->post_content = $post_content; |
725 | 725 | unset( $post_content ); |
@@ -737,12 +737,12 @@ discard block |
||
737 | 737 | $value = $value[ $field_id ]; |
738 | 738 | } |
739 | 739 | |
740 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
740 | + if ( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
741 | 741 | $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
742 | 742 | } |
743 | 743 | |
744 | 744 | if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) { |
745 | - $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value ); |
|
745 | + $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value ); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | } |
756 | 756 | |
757 | 757 | // update entry after |
758 | - $this->entry["{$field_id}"] = $value; |
|
758 | + $this->entry[ "{$field_id}" ] = $value; |
|
759 | 759 | |
760 | 760 | $update_entry = true; |
761 | 761 | |
@@ -764,25 +764,25 @@ discard block |
||
764 | 764 | |
765 | 765 | } |
766 | 766 | |
767 | - if( $update_entry ) { |
|
767 | + if ( $update_entry ) { |
|
768 | 768 | |
769 | 769 | $return_entry = GFAPI::update_entry( $this->entry ); |
770 | 770 | |
771 | - if( is_wp_error( $return_entry ) ) { |
|
771 | + if ( is_wp_error( $return_entry ) ) { |
|
772 | 772 | do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ); |
773 | 773 | } else { |
774 | - do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' ); |
|
774 | + do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' ); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | } |
778 | 778 | |
779 | 779 | $return_post = wp_update_post( $updated_post, true ); |
780 | 780 | |
781 | - if( is_wp_error( $return_post ) ) { |
|
781 | + if ( is_wp_error( $return_post ) ) { |
|
782 | 782 | $return_post->add_data( $updated_post, '$updated_post' ); |
783 | 783 | do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) ); |
784 | 784 | } else { |
785 | - do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post ); |
|
785 | + do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post ); |
|
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $input_type = RGFormsModel::get_input_type( $field ); |
801 | 801 | |
802 | 802 | // Only certain custom field types are supported |
803 | - switch( $input_type ) { |
|
803 | + switch ( $input_type ) { |
|
804 | 804 | case 'fileupload': |
805 | 805 | case 'list': |
806 | 806 | case 'multiselect': |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false ); |
838 | 838 | |
839 | 839 | // replace conditional shortcodes |
840 | - if( $do_shortcode ) { |
|
840 | + if ( $do_shortcode ) { |
|
841 | 841 | $output = do_shortcode( $output ); |
842 | 842 | } |
843 | 843 | |
@@ -856,19 +856,19 @@ discard block |
||
856 | 856 | */ |
857 | 857 | private function after_update() { |
858 | 858 | |
859 | - do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry ); |
|
860 | - do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry ); |
|
859 | + do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
860 | + do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
861 | 861 | |
862 | 862 | // Re-define the entry now that we've updated it. |
863 | - $entry = RGFormsModel::get_lead( $this->entry['id'] ); |
|
863 | + $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] ); |
|
864 | 864 | |
865 | 865 | $entry = GFFormsModel::set_entry_meta( $entry, $this->form ); |
866 | 866 | |
867 | 867 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) { |
868 | 868 | // We need to clear the cache because Gravity Forms caches the field values, which |
869 | 869 | // we have just updated. |
870 | - foreach ($this->form['fields'] as $key => $field) { |
|
871 | - GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id ); |
|
870 | + foreach ( $this->form[ 'fields' ] as $key => $field ) { |
|
871 | + GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id ); |
|
872 | 872 | } |
873 | 873 | } |
874 | 874 | |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | |
888 | 888 | <div class="gv-edit-entry-wrapper"><?php |
889 | 889 | |
890 | - $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this ); |
|
890 | + $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this ); |
|
891 | 891 | |
892 | 892 | /** |
893 | 893 | * Fixes weird wpautop() issue |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | * @param string $edit_entry_title Modify the "Edit Entry" title |
904 | 904 | * @param GravityView_Edit_Entry_Render $this This object |
905 | 905 | */ |
906 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
906 | + $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this ); |
|
907 | 907 | |
908 | 908 | echo esc_attr( $edit_entry_title ); |
909 | 909 | ?></span> |
@@ -949,20 +949,20 @@ discard block |
||
949 | 949 | */ |
950 | 950 | private function maybe_print_message() { |
951 | 951 | |
952 | - if( rgpost('action') === 'update' ) { |
|
952 | + if ( rgpost( 'action' ) === 'update' ) { |
|
953 | 953 | |
954 | 954 | $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) ); |
955 | 955 | |
956 | - if( ! $this->is_valid ){ |
|
956 | + if ( ! $this->is_valid ) { |
|
957 | 957 | |
958 | 958 | // Keeping this compatible with Gravity Forms. |
959 | - $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
|
960 | - $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form); |
|
959 | + $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>"; |
|
960 | + $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form ); |
|
961 | 961 | |
962 | - echo GVCommon::generate_notice( $message , 'gv-error' ); |
|
962 | + echo GVCommon::generate_notice( $message, 'gv-error' ); |
|
963 | 963 | |
964 | 964 | } else { |
965 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' ); |
|
965 | + $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' ); |
|
966 | 966 | |
967 | 967 | /** |
968 | 968 | * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link) |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | * @param array $entry Gravity Forms entry array |
973 | 973 | * @param string $back_link URL to return to the original entry. @since 1.6 |
974 | 974 | */ |
975 | - $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link ); |
|
975 | + $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link ); |
|
976 | 976 | |
977 | 977 | echo GVCommon::generate_notice( $message ); |
978 | 978 | } |
@@ -996,21 +996,21 @@ discard block |
||
996 | 996 | */ |
997 | 997 | do_action( 'gravityview/edit-entry/render/before', $this ); |
998 | 998 | |
999 | - add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 ); |
|
1000 | - add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') ); |
|
999 | + add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 ); |
|
1000 | + add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
|
1001 | 1001 | add_filter( 'gform_disable_view_counter', '__return_true' ); |
1002 | 1002 | |
1003 | 1003 | add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 ); |
1004 | 1004 | add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 ); |
1005 | 1005 | |
1006 | 1006 | // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin. |
1007 | - unset( $_GET['page'] ); |
|
1007 | + unset( $_GET[ 'page' ] ); |
|
1008 | 1008 | |
1009 | 1009 | // TODO: Verify multiple-page forms |
1010 | 1010 | |
1011 | 1011 | ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic |
1012 | 1012 | |
1013 | - $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry ); |
|
1013 | + $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry ); |
|
1014 | 1014 | |
1015 | 1015 | ob_get_clean(); |
1016 | 1016 | |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | * @return string |
1037 | 1037 | */ |
1038 | 1038 | public function render_form_buttons() { |
1039 | - return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this ); |
|
1039 | + return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this ); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | |
@@ -1056,10 +1056,10 @@ discard block |
||
1056 | 1056 | public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) { |
1057 | 1057 | |
1058 | 1058 | // In case we have validated the form, use it to inject the validation results into the form render |
1059 | - if( isset( $this->form_after_validation ) ) { |
|
1059 | + if ( isset( $this->form_after_validation ) ) { |
|
1060 | 1060 | $form = $this->form_after_validation; |
1061 | 1061 | } else { |
1062 | - $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1062 | + $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | $form = $this->filter_conditional_logic( $form ); |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | $form = $this->prefill_conditional_logic( $form ); |
1068 | 1068 | |
1069 | 1069 | // for now we don't support Save and Continue feature. |
1070 | - if( ! self::$supports_save_and_continue ) { |
|
1071 | - unset( $form['save'] ); |
|
1070 | + if ( ! self::$supports_save_and_continue ) { |
|
1071 | + unset( $form[ 'save' ] ); |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | return $form; |
@@ -1089,29 +1089,29 @@ discard block |
||
1089 | 1089 | */ |
1090 | 1090 | public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) { |
1091 | 1091 | |
1092 | - if( GFCommon::is_post_field( $field ) ) { |
|
1092 | + if ( GFCommon::is_post_field( $field ) ) { |
|
1093 | 1093 | |
1094 | 1094 | $message = null; |
1095 | 1095 | |
1096 | 1096 | // First, make sure they have the capability to edit the post. |
1097 | - if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
1097 | + if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) { |
|
1098 | 1098 | |
1099 | 1099 | /** |
1100 | 1100 | * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
1101 | 1101 | * @param string $message The existing "You don't have permission..." text |
1102 | 1102 | */ |
1103 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
1103 | + $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don’t have permission to edit this post.', 'gravityview' ) ); |
|
1104 | 1104 | |
1105 | - } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
1105 | + } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) { |
|
1106 | 1106 | /** |
1107 | 1107 | * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
1108 | 1108 | * @param string $message The existing "This field is not editable; the post no longer exists." text |
1109 | 1109 | */ |
1110 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
1110 | + $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | - if( $message ) { |
|
1114 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1113 | + if ( $message ) { |
|
1114 | + $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1115 | 1115 | } |
1116 | 1116 | } |
1117 | 1117 | |
@@ -1136,8 +1136,8 @@ discard block |
||
1136 | 1136 | |
1137 | 1137 | // If the form has been submitted, then we don't need to pre-fill the values, |
1138 | 1138 | // Except for fileupload type and when a field input is overridden- run always!! |
1139 | - if( |
|
1140 | - ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1139 | + if ( |
|
1140 | + ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1141 | 1141 | && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) |
1142 | 1142 | && ! GFCommon::is_product_field( $field->type ) |
1143 | 1143 | || ! empty( $field_content ) |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | $return = null; |
1158 | 1158 | |
1159 | 1159 | /** @var GravityView_Field $gv_field */ |
1160 | - if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1160 | + if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1161 | 1161 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
1162 | 1162 | } else { |
1163 | 1163 | $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | // If there was output, it's an error |
1167 | 1167 | $warnings = ob_get_clean(); |
1168 | 1168 | |
1169 | - if( !empty( $warnings ) ) { |
|
1169 | + if ( ! empty( $warnings ) ) { |
|
1170 | 1170 | do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value ); |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field ); |
1192 | 1192 | |
1193 | 1193 | // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs) |
1194 | - if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1194 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1195 | 1195 | |
1196 | 1196 | $field_value = array(); |
1197 | 1197 | |
@@ -1200,10 +1200,10 @@ discard block |
||
1200 | 1200 | |
1201 | 1201 | foreach ( (array)$field->inputs as $input ) { |
1202 | 1202 | |
1203 | - $input_id = strval( $input['id'] ); |
|
1203 | + $input_id = strval( $input[ 'id' ] ); |
|
1204 | 1204 | |
1205 | 1205 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
1206 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1206 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1207 | 1207 | $allow_pre_populated = false; |
1208 | 1208 | } |
1209 | 1209 | |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | $pre_value = $field->get_value_submission( array(), false ); |
1213 | 1213 | |
1214 | - $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1214 | + $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1215 | 1215 | |
1216 | 1216 | } else { |
1217 | 1217 | |
@@ -1222,13 +1222,13 @@ discard block |
||
1222 | 1222 | |
1223 | 1223 | // saved field entry value (if empty, fallback to the pre-populated value, if exists) |
1224 | 1224 | // or pre-populated value if not empty and set to override saved value |
1225 | - $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1225 | + $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1226 | 1226 | |
1227 | 1227 | // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs. |
1228 | - if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
|
1228 | + if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) { |
|
1229 | 1229 | $categories = array(); |
1230 | 1230 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
1231 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
1231 | + $categories[ ] = GFCommon::format_post_category( $cat_string, true ); |
|
1232 | 1232 | } |
1233 | 1233 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
1234 | 1234 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | * @param GF_Field $field Gravity Forms field object |
1257 | 1257 | * @param GravityView_Edit_Entry_Render $this Current object |
1258 | 1258 | */ |
1259 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
1259 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this ); |
|
1260 | 1260 | |
1261 | 1261 | return $field_value; |
1262 | 1262 | } |
@@ -1273,12 +1273,12 @@ discard block |
||
1273 | 1273 | */ |
1274 | 1274 | public function gform_pre_validation( $form ) { |
1275 | 1275 | |
1276 | - if( ! $this->verify_nonce() ) { |
|
1276 | + if ( ! $this->verify_nonce() ) { |
|
1277 | 1277 | return $form; |
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | // Fix PHP warning regarding undefined index. |
1281 | - foreach ( $form['fields'] as &$field) { |
|
1281 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
1282 | 1282 | |
1283 | 1283 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
1284 | 1284 | // expects certain field array items to be set. |
@@ -1287,11 +1287,11 @@ discard block |
||
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
1290 | - if( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
|
1290 | + if ( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
|
1291 | 1291 | $field->adminOnly = NULL; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - switch( RGFormsModel::get_input_type( $field ) ) { |
|
1294 | + switch ( RGFormsModel::get_input_type( $field ) ) { |
|
1295 | 1295 | |
1296 | 1296 | /** |
1297 | 1297 | * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend. |
@@ -1305,37 +1305,37 @@ discard block |
||
1305 | 1305 | // Set the previous value |
1306 | 1306 | $entry = $this->get_entry(); |
1307 | 1307 | |
1308 | - $input_name = 'input_'.$field->id; |
|
1309 | - $form_id = $form['id']; |
|
1308 | + $input_name = 'input_' . $field->id; |
|
1309 | + $form_id = $form[ 'id' ]; |
|
1310 | 1310 | |
1311 | 1311 | $value = NULL; |
1312 | 1312 | |
1313 | 1313 | // Use the previous entry value as the default. |
1314 | - if( isset( $entry[ $field->id ] ) ) { |
|
1314 | + if ( isset( $entry[ $field->id ] ) ) { |
|
1315 | 1315 | $value = $entry[ $field->id ]; |
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | // If this is a single upload file |
1319 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
1320 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
1321 | - $value = $file_path['url']; |
|
1319 | + if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
1320 | + $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] ); |
|
1321 | + $value = $file_path[ 'url' ]; |
|
1322 | 1322 | |
1323 | 1323 | } else { |
1324 | 1324 | |
1325 | 1325 | // Fix PHP warning on line 1498 of form_display.php for post_image fields |
1326 | 1326 | // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
1327 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
1327 | + $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' ); |
|
1328 | 1328 | |
1329 | 1329 | } |
1330 | 1330 | |
1331 | - if( rgar($field, "multipleFiles") ) { |
|
1331 | + if ( rgar( $field, "multipleFiles" ) ) { |
|
1332 | 1332 | |
1333 | 1333 | // If there are fresh uploads, process and merge them. |
1334 | 1334 | // Otherwise, use the passed values, which should be json-encoded array of URLs |
1335 | - if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) { |
|
1335 | + if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
1336 | 1336 | $value = empty( $value ) ? '[]' : $value; |
1337 | 1337 | $value = stripslashes_deep( $value ); |
1338 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array()); |
|
1338 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() ); |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | } else { |
@@ -1353,8 +1353,8 @@ discard block |
||
1353 | 1353 | |
1354 | 1354 | case 'number': |
1355 | 1355 | // Fix "undefined index" issue at line 1286 in form_display.php |
1356 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
1357 | - $_POST['input_'.$field->id ] = NULL; |
|
1356 | + if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) { |
|
1357 | + $_POST[ 'input_' . $field->id ] = NULL; |
|
1358 | 1358 | } |
1359 | 1359 | break; |
1360 | 1360 | } |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * You can enter whatever you want! |
1397 | 1397 | * We try validating, and customize the results using `self::custom_validation()` |
1398 | 1398 | */ |
1399 | - add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4); |
|
1399 | + add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 ); |
|
1400 | 1400 | |
1401 | 1401 | // Needed by the validate funtion |
1402 | 1402 | $failed_validation_page = NULL; |
@@ -1404,14 +1404,14 @@ discard block |
||
1404 | 1404 | |
1405 | 1405 | // Prevent entry limit from running when editing an entry, also |
1406 | 1406 | // prevent form scheduling from preventing editing |
1407 | - unset( $this->form['limitEntries'], $this->form['scheduleForm'] ); |
|
1407 | + unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] ); |
|
1408 | 1408 | |
1409 | 1409 | // Hide fields depending on Edit Entry settings |
1410 | - $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1410 | + $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1411 | 1411 | |
1412 | 1412 | $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page ); |
1413 | 1413 | |
1414 | - remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1414 | + remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1415 | 1415 | remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'user_registration_validation' ), 10 ); |
1416 | 1416 | } |
1417 | 1417 | |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | $user_registration = GF_User_Registration::get_instance(); |
1429 | 1429 | |
1430 | 1430 | $entry = $this->get_entry(); |
1431 | - $form = $validation_results['form']; |
|
1431 | + $form = $validation_results[ 'form' ]; |
|
1432 | 1432 | |
1433 | 1433 | if ( ! $feed = $user_registration->get_single_submission_feed( $entry, $form ) ) { |
1434 | 1434 | return $validation_results; |
@@ -1444,18 +1444,18 @@ discard block |
||
1444 | 1444 | if ( $user_email != $value && email_exists( $value ) ) { |
1445 | 1445 | $email_field->failed_validation = 1; |
1446 | 1446 | $email_field->validation_message = __( 'This email is already in use', 'gravityview' ); |
1447 | - $validation_results['is_valid'] = false; |
|
1447 | + $validation_results[ 'is_valid' ] = false; |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | $value = RGFormsModel::get_field_value( $username_field ); |
1451 | 1451 | if ( $username != $value ) { |
1452 | 1452 | $username_field->failed_validation = 1; |
1453 | 1453 | $username_field->validation_message = __( 'Usernames cannot be changed', 'gravityview' ); |
1454 | - $validation_results['is_valid'] = false; |
|
1454 | + $validation_results[ 'is_valid' ] = false; |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
1458 | - $this->form_after_validation = $validation_results['form']; |
|
1458 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
1459 | 1459 | |
1460 | 1460 | return $validation_results; |
1461 | 1461 | } |
@@ -1473,13 +1473,13 @@ discard block |
||
1473 | 1473 | */ |
1474 | 1474 | public function custom_validation( $validation_results ) { |
1475 | 1475 | |
1476 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results ); |
|
1476 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results ); |
|
1477 | 1477 | |
1478 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
1478 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
1479 | 1479 | |
1480 | 1480 | $gv_valid = true; |
1481 | 1481 | |
1482 | - foreach ( $validation_results['form']['fields'] as $key => &$field ) { |
|
1482 | + foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) { |
|
1483 | 1483 | |
1484 | 1484 | $value = RGFormsModel::get_field_value( $field ); |
1485 | 1485 | $field_type = RGFormsModel::get_input_type( $field ); |
@@ -1492,35 +1492,35 @@ discard block |
||
1492 | 1492 | case 'post_image': |
1493 | 1493 | |
1494 | 1494 | // in case nothing is uploaded but there are already files saved |
1495 | - if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) { |
|
1495 | + if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) { |
|
1496 | 1496 | $field->failed_validation = false; |
1497 | 1497 | unset( $field->validation_message ); |
1498 | 1498 | } |
1499 | 1499 | |
1500 | 1500 | // validate if multi file upload reached max number of files [maxFiles] => 2 |
1501 | - if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) { |
|
1501 | + if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) { |
|
1502 | 1502 | |
1503 | 1503 | $input_name = 'input_' . $field->id; |
1504 | 1504 | //uploaded |
1505 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
1505 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array(); |
|
1506 | 1506 | |
1507 | 1507 | //existent |
1508 | 1508 | $entry = $this->get_entry(); |
1509 | 1509 | $value = NULL; |
1510 | - if( isset( $entry[ $field->id ] ) ) { |
|
1510 | + if ( isset( $entry[ $field->id ] ) ) { |
|
1511 | 1511 | $value = json_decode( $entry[ $field->id ], true ); |
1512 | 1512 | } |
1513 | 1513 | |
1514 | 1514 | // count uploaded files and existent entry files |
1515 | 1515 | $count_files = count( $file_names ) + count( $value ); |
1516 | 1516 | |
1517 | - if( $count_files > $field->maxFiles ) { |
|
1517 | + if ( $count_files > $field->maxFiles ) { |
|
1518 | 1518 | $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
1519 | 1519 | $field->failed_validation = 1; |
1520 | 1520 | $gv_valid = false; |
1521 | 1521 | |
1522 | 1522 | // in case of error make sure the newest upload files are removed from the upload input |
1523 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
1523 | + GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null; |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | } |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | // This field has failed validation. |
1534 | - if( !empty( $field->failed_validation ) ) { |
|
1534 | + if ( ! empty( $field->failed_validation ) ) { |
|
1535 | 1535 | |
1536 | 1536 | do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) ); |
1537 | 1537 | |
@@ -1549,32 +1549,32 @@ discard block |
||
1549 | 1549 | } |
1550 | 1550 | |
1551 | 1551 | // You can't continue inside a switch, so we do it after. |
1552 | - if( empty( $field->failed_validation ) ) { |
|
1552 | + if ( empty( $field->failed_validation ) ) { |
|
1553 | 1553 | continue; |
1554 | 1554 | } |
1555 | 1555 | |
1556 | 1556 | // checks if the No Duplicates option is not validating entry against itself, since |
1557 | 1557 | // we're editing a stored entry, it would also assume it's a duplicate. |
1558 | - if( !empty( $field->noDuplicates ) ) { |
|
1558 | + if ( ! empty( $field->noDuplicates ) ) { |
|
1559 | 1559 | |
1560 | 1560 | $entry = $this->get_entry(); |
1561 | 1561 | |
1562 | 1562 | // If the value of the entry is the same as the stored value |
1563 | 1563 | // Then we can assume it's not a duplicate, it's the same. |
1564 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1564 | + if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1565 | 1565 | //if value submitted was not changed, then don't validate |
1566 | 1566 | $field->failed_validation = false; |
1567 | 1567 | |
1568 | 1568 | unset( $field->validation_message ); |
1569 | 1569 | |
1570 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry ); |
|
1570 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry ); |
|
1571 | 1571 | |
1572 | 1572 | continue; |
1573 | 1573 | } |
1574 | 1574 | } |
1575 | 1575 | |
1576 | 1576 | // if here then probably we are facing the validation 'At least one field must be filled out' |
1577 | - if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1577 | + if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1578 | 1578 | unset( $field->validation_message ); |
1579 | 1579 | $field->validation_message = false; |
1580 | 1580 | continue; |
@@ -1586,12 +1586,12 @@ discard block |
||
1586 | 1586 | |
1587 | 1587 | } |
1588 | 1588 | |
1589 | - $validation_results['is_valid'] = $gv_valid; |
|
1589 | + $validation_results[ 'is_valid' ] = $gv_valid; |
|
1590 | 1590 | |
1591 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results ); |
|
1591 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results ); |
|
1592 | 1592 | |
1593 | 1593 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
1594 | - $this->form_after_validation = $validation_results['form']; |
|
1594 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
1595 | 1595 | |
1596 | 1596 | return $validation_results; |
1597 | 1597 | } |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | */ |
1605 | 1605 | public function get_entry() { |
1606 | 1606 | |
1607 | - if( empty( $this->entry ) ) { |
|
1607 | + if ( empty( $this->entry ) ) { |
|
1608 | 1608 | // Get the database value of the entry that's being edited |
1609 | 1609 | $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() ); |
1610 | 1610 | } |
@@ -1639,10 +1639,10 @@ discard block |
||
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | // If edit tab not yet configured, show all fields |
1642 | - $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL; |
|
1642 | + $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL; |
|
1643 | 1643 | |
1644 | 1644 | // Hide fields depending on admin settings |
1645 | - $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
|
1645 | + $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields ); |
|
1646 | 1646 | |
1647 | 1647 | // If Edit Entry fields are configured, remove hidden/administrative field settings. Otherwise, don't. |
1648 | 1648 | $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | */ |
1675 | 1675 | private function filter_fields( $fields, $configured_fields ) { |
1676 | 1676 | |
1677 | - if( empty( $fields ) || !is_array( $fields ) ) { |
|
1677 | + if ( empty( $fields ) || ! is_array( $fields ) ) { |
|
1678 | 1678 | return $fields; |
1679 | 1679 | } |
1680 | 1680 | |
@@ -1687,18 +1687,18 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | // Remove the fields that have calculation properties and keep them to be used later |
1689 | 1689 | // @since 1.16.2 |
1690 | - if( $field->has_calculation() ) { |
|
1691 | - $this->fields_with_calculation[] = $field; |
|
1690 | + if ( $field->has_calculation() ) { |
|
1691 | + $this->fields_with_calculation[ ] = $field; |
|
1692 | 1692 | // don't remove the calculation fields on form render. |
1693 | 1693 | } |
1694 | 1694 | |
1695 | - if( in_array( $field->type, $field_type_blacklist ) ) { |
|
1695 | + if ( in_array( $field->type, $field_type_blacklist ) ) { |
|
1696 | 1696 | unset( $fields[ $key ] ); |
1697 | 1697 | } |
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | // The Edit tab has not been configured, so we return all fields by default. |
1701 | - if( empty( $configured_fields ) ) { |
|
1701 | + if ( empty( $configured_fields ) ) { |
|
1702 | 1702 | return $fields; |
1703 | 1703 | } |
1704 | 1704 | |
@@ -1708,8 +1708,8 @@ discard block |
||
1708 | 1708 | /** @var GF_Field $field */ |
1709 | 1709 | foreach ( $fields as $field ) { |
1710 | 1710 | |
1711 | - if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
1712 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
1711 | + if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
1712 | + $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field ); |
|
1713 | 1713 | break; |
1714 | 1714 | } |
1715 | 1715 | |
@@ -1732,14 +1732,14 @@ discard block |
||
1732 | 1732 | |
1733 | 1733 | $return_field = $field; |
1734 | 1734 | |
1735 | - if( empty( $field_setting['show_label'] ) ) { |
|
1735 | + if ( empty( $field_setting[ 'show_label' ] ) ) { |
|
1736 | 1736 | $return_field->label = ''; |
1737 | - } elseif ( !empty( $field_setting['custom_label'] ) ) { |
|
1738 | - $return_field->label = $field_setting['custom_label']; |
|
1737 | + } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) { |
|
1738 | + $return_field->label = $field_setting[ 'custom_label' ]; |
|
1739 | 1739 | } |
1740 | 1740 | |
1741 | - if( !empty( $field_setting['custom_class'] ) ) { |
|
1742 | - $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] ); |
|
1741 | + if ( ! empty( $field_setting[ 'custom_class' ] ) ) { |
|
1742 | + $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] ); |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | /** |
@@ -1790,15 +1790,15 @@ discard block |
||
1790 | 1790 | */ |
1791 | 1791 | $use_gf_visibility_setting = apply_filters( 'gravityview/edit_entry/use_gf_visibility_setting', empty( $edit_fields ), $form, $view_id ); |
1792 | 1792 | |
1793 | - if( $use_gf_adminonly_setting && $use_gf_visibility_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
1794 | - foreach( $fields as $k => $field ) { |
|
1793 | + if ( $use_gf_adminonly_setting && $use_gf_visibility_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) { |
|
1794 | + foreach ( $fields as $k => $field ) { |
|
1795 | 1795 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
1796 | - if( ! isset( $field->visibility ) ) { |
|
1797 | - if( $field->adminOnly ) { |
|
1796 | + if ( ! isset( $field->visibility ) ) { |
|
1797 | + if ( $field->adminOnly ) { |
|
1798 | 1798 | unset( $fields[ $k ] ); |
1799 | 1799 | } |
1800 | - } else{ |
|
1801 | - if( 'administrative' === $field->visibility ) { |
|
1800 | + } else { |
|
1801 | + if ( 'administrative' === $field->visibility ) { |
|
1802 | 1802 | unset( $fields[ $k ] ); |
1803 | 1803 | } |
1804 | 1804 | } |
@@ -1806,10 +1806,10 @@ discard block |
||
1806 | 1806 | return $fields; |
1807 | 1807 | } |
1808 | 1808 | |
1809 | - foreach( $fields as &$field ) { |
|
1809 | + foreach ( $fields as &$field ) { |
|
1810 | 1810 | |
1811 | 1811 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
1812 | - if( ! isset( $field->visibility ) ) { |
|
1812 | + if ( ! isset( $field->visibility ) ) { |
|
1813 | 1813 | |
1814 | 1814 | $field->adminOnly = false; |
1815 | 1815 | |
@@ -1849,22 +1849,22 @@ discard block |
||
1849 | 1849 | */ |
1850 | 1850 | function prefill_conditional_logic( $form ) { |
1851 | 1851 | |
1852 | - if( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
1852 | + if ( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
1853 | 1853 | return $form; |
1854 | 1854 | } |
1855 | 1855 | |
1856 | 1856 | // Have Conditional Logic pre-fill fields as if the data were default values |
1857 | 1857 | /** @var GF_Field $field */ |
1858 | - foreach ( $form['fields'] as &$field ) { |
|
1858 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
1859 | 1859 | |
1860 | - if( 'checkbox' === $field->type ) { |
|
1860 | + if ( 'checkbox' === $field->type ) { |
|
1861 | 1861 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
1862 | - $input_id = $input['id']; |
|
1862 | + $input_id = $input[ 'id' ]; |
|
1863 | 1863 | $choice = $field->choices[ $key ]; |
1864 | 1864 | $value = rgar( $this->entry, $input_id ); |
1865 | 1865 | $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
1866 | - if( $match ) { |
|
1867 | - $field->choices[ $key ]['isSelected'] = true; |
|
1866 | + if ( $match ) { |
|
1867 | + $field->choices[ $key ][ 'isSelected' ] = true; |
|
1868 | 1868 | } |
1869 | 1869 | } |
1870 | 1870 | } else { |
@@ -1872,15 +1872,15 @@ discard block |
||
1872 | 1872 | // We need to run through each field to set the default values |
1873 | 1873 | foreach ( $this->entry as $field_id => $field_value ) { |
1874 | 1874 | |
1875 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
1875 | + if ( floatval( $field_id ) === floatval( $field->id ) ) { |
|
1876 | 1876 | |
1877 | - if( 'list' === $field->type ) { |
|
1877 | + if ( 'list' === $field->type ) { |
|
1878 | 1878 | $list_rows = maybe_unserialize( $field_value ); |
1879 | 1879 | |
1880 | 1880 | $list_field_value = array(); |
1881 | - foreach ( (array) $list_rows as $row ) { |
|
1882 | - foreach ( (array) $row as $column ) { |
|
1883 | - $list_field_value[] = $column; |
|
1881 | + foreach ( (array)$list_rows as $row ) { |
|
1882 | + foreach ( (array)$row as $column ) { |
|
1883 | + $list_field_value[ ] = $column; |
|
1884 | 1884 | } |
1885 | 1885 | } |
1886 | 1886 | |
@@ -1915,16 +1915,16 @@ discard block |
||
1915 | 1915 | */ |
1916 | 1916 | $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form ); |
1917 | 1917 | |
1918 | - if( $use_conditional_logic ) { |
|
1918 | + if ( $use_conditional_logic ) { |
|
1919 | 1919 | return $form; |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - foreach( $form['fields'] as &$field ) { |
|
1922 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
1923 | 1923 | /* @var GF_Field $field */ |
1924 | 1924 | $field->conditionalLogic = null; |
1925 | 1925 | } |
1926 | 1926 | |
1927 | - unset( $form['button']['conditionalLogic'] ); |
|
1927 | + unset( $form[ 'button' ][ 'conditionalLogic' ] ); |
|
1928 | 1928 | |
1929 | 1929 | return $form; |
1930 | 1930 | |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | */ |
1942 | 1942 | public function manage_conditional_logic( $has_conditional_logic, $form ) { |
1943 | 1943 | |
1944 | - if( ! $this->is_edit_entry() ) { |
|
1944 | + if ( ! $this->is_edit_entry() ) { |
|
1945 | 1945 | return $has_conditional_logic; |
1946 | 1946 | } |
1947 | 1947 | |
@@ -1973,44 +1973,44 @@ discard block |
||
1973 | 1973 | * 2. There are two entries embedded using oEmbed |
1974 | 1974 | * 3. One of the entries has just been saved |
1975 | 1975 | */ |
1976 | - if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) { |
|
1976 | + if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) { |
|
1977 | 1977 | |
1978 | 1978 | $error = true; |
1979 | 1979 | |
1980 | 1980 | } |
1981 | 1981 | |
1982 | - if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) { |
|
1982 | + if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) { |
|
1983 | 1983 | |
1984 | 1984 | $error = true; |
1985 | 1985 | |
1986 | - } elseif( ! $this->verify_nonce() ) { |
|
1986 | + } elseif ( ! $this->verify_nonce() ) { |
|
1987 | 1987 | |
1988 | 1988 | /** |
1989 | 1989 | * If the Entry is embedded, there may be two entries on the same page. |
1990 | 1990 | * If that's the case, and one is being edited, the other should fail gracefully and not display an error. |
1991 | 1991 | */ |
1992 | - if( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
1992 | + if ( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
1993 | 1993 | $error = true; |
1994 | 1994 | } else { |
1995 | - $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview'); |
|
1995 | + $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' ); |
|
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | } |
1999 | 1999 | |
2000 | - if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
2001 | - $error = __( 'You do not have permission to edit this entry.', 'gravityview'); |
|
2000 | + if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
2001 | + $error = __( 'You do not have permission to edit this entry.', 'gravityview' ); |
|
2002 | 2002 | } |
2003 | 2003 | |
2004 | - if( $this->entry['status'] === 'trash' ) { |
|
2005 | - $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
2004 | + if ( $this->entry[ 'status' ] === 'trash' ) { |
|
2005 | + $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | // No errors; everything's fine here! |
2009 | - if( empty( $error ) ) { |
|
2009 | + if ( empty( $error ) ) { |
|
2010 | 2010 | return true; |
2011 | 2011 | } |
2012 | 2012 | |
2013 | - if( $echo && $error !== true ) { |
|
2013 | + if ( $echo && $error !== true ) { |
|
2014 | 2014 | |
2015 | 2015 | $error = esc_html( $error ); |
2016 | 2016 | |
@@ -2018,13 +2018,13 @@ discard block |
||
2018 | 2018 | * @since 1.9 |
2019 | 2019 | */ |
2020 | 2020 | if ( ! empty( $this->entry ) ) { |
2021 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2021 | + $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | - echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
|
2024 | + echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' ); |
|
2025 | 2025 | } |
2026 | 2026 | |
2027 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error ); |
|
2027 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error ); |
|
2028 | 2028 | |
2029 | 2029 | return false; |
2030 | 2030 | } |
@@ -2041,20 +2041,20 @@ discard block |
||
2041 | 2041 | |
2042 | 2042 | $error = NULL; |
2043 | 2043 | |
2044 | - if( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2045 | - $error = __( 'You do not have permission to edit this field.', 'gravityview'); |
|
2044 | + if ( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2045 | + $error = __( 'You do not have permission to edit this field.', 'gravityview' ); |
|
2046 | 2046 | } |
2047 | 2047 | |
2048 | 2048 | // No errors; everything's fine here! |
2049 | - if( empty( $error ) ) { |
|
2049 | + if ( empty( $error ) ) { |
|
2050 | 2050 | return true; |
2051 | 2051 | } |
2052 | 2052 | |
2053 | - if( $echo ) { |
|
2054 | - echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error'); |
|
2053 | + if ( $echo ) { |
|
2054 | + echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' ); |
|
2055 | 2055 | } |
2056 | 2056 | |
2057 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error ); |
|
2057 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error ); |
|
2058 | 2058 | |
2059 | 2059 | return false; |
2060 | 2060 | |
@@ -2072,15 +2072,15 @@ discard block |
||
2072 | 2072 | private function check_user_cap_edit_field( $field ) { |
2073 | 2073 | |
2074 | 2074 | // If they can edit any entries (as defined in Gravity Forms), we're good. |
2075 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2075 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2076 | 2076 | return true; |
2077 | 2077 | } |
2078 | 2078 | |
2079 | - $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false; |
|
2079 | + $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false; |
|
2080 | 2080 | |
2081 | 2081 | // If the field has custom editing capaibilities set, check those |
2082 | - if( $field_cap ) { |
|
2083 | - return GVCommon::has_cap( $field['allow_edit_cap'] ); |
|
2082 | + if ( $field_cap ) { |
|
2083 | + return GVCommon::has_cap( $field[ 'allow_edit_cap' ] ); |
|
2084 | 2084 | } |
2085 | 2085 | |
2086 | 2086 | return false; |
@@ -2094,17 +2094,17 @@ discard block |
||
2094 | 2094 | public function verify_nonce() { |
2095 | 2095 | |
2096 | 2096 | // Verify form submitted for editing single |
2097 | - if( $this->is_edit_entry_submission() ) { |
|
2097 | + if ( $this->is_edit_entry_submission() ) { |
|
2098 | 2098 | $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field ); |
2099 | 2099 | } |
2100 | 2100 | |
2101 | 2101 | // Verify |
2102 | - else if( ! $this->is_edit_entry() ) { |
|
2102 | + else if ( ! $this->is_edit_entry() ) { |
|
2103 | 2103 | $valid = false; |
2104 | 2104 | } |
2105 | 2105 | |
2106 | 2106 | else { |
2107 | - $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
|
2107 | + $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ); |
|
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | /** |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | |
954 | 954 | $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) ); |
955 | 955 | |
956 | - if( ! $this->is_valid ){ |
|
956 | + if( ! $this->is_valid ) { |
|
957 | 957 | |
958 | 958 | // Keeping this compatible with Gravity Forms. |
959 | 959 | $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | if( $field->adminOnly ) { |
1798 | 1798 | unset( $fields[ $k ] ); |
1799 | 1799 | } |
1800 | - } else{ |
|
1800 | + } else { |
|
1801 | 1801 | if( 'administrative' === $field->visibility ) { |
1802 | 1802 | unset( $fields[ $k ] ); |
1803 | 1803 | } |
@@ -2101,9 +2101,7 @@ discard block |
||
2101 | 2101 | // Verify |
2102 | 2102 | else if( ! $this->is_edit_entry() ) { |
2103 | 2103 | $valid = false; |
2104 | - } |
|
2105 | - |
|
2106 | - else { |
|
2104 | + } else { |
|
2107 | 2105 | $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
2108 | 2106 | } |
2109 | 2107 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $table_name = GFFormsModel::get_lead_meta_table_name(); |
67 | 67 | } |
68 | 68 | |
69 | - $sql = "UPDATE {$table_name} SET `meta_value` = %s WHERE `meta_key` = 'is_approved' AND `meta_value` = %s"; |
|
69 | + $sql = "update {$table_name} SET `meta_value` = %s WHERE `meta_key` = 'is_approved' AND `meta_value` = %s"; |
|
70 | 70 | |
71 | 71 | $approved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::APPROVED, 'Approved' ) ); |
72 | 72 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
@@ -53,30 +53,30 @@ discard block |
||
53 | 53 | public function widget( $args, $instance ) { |
54 | 54 | |
55 | 55 | // Don't show unless a View ID has been set. |
56 | - if( empty( $instance['view_id'] ) ) { |
|
56 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
57 | 57 | |
58 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
58 | + do_action( 'gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class( $this ) ), $instance ); |
|
59 | 59 | |
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** This filter is documented in wp-includes/default-widgets.php */ |
64 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
64 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
65 | 65 | |
66 | - echo $args['before_widget']; |
|
66 | + echo $args[ 'before_widget' ]; |
|
67 | 67 | |
68 | 68 | if ( $title ) { |
69 | - echo $args['before_title'] . $title . $args['after_title']; |
|
69 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // @todo Add to the widget configuration form |
73 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
73 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
74 | 74 | |
75 | - $instance['context'] = 'wp_widget'; |
|
75 | + $instance[ 'context' ] = 'wp_widget'; |
|
76 | 76 | |
77 | 77 | // form |
78 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
79 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
78 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
79 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
80 | 80 | |
81 | 81 | // We don't want to overwrite existing context, etc. |
82 | 82 | $previous_view = GravityView_View::getInstance(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | new GravityView_View( $previous_view ); |
94 | 94 | |
95 | - echo $args['after_widget']; |
|
95 | + echo $args[ 'after_widget' ]; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | |
103 | 103 | $instance = $old_instance; |
104 | 104 | |
105 | - if( $this->is_preview() ) { |
|
105 | + if ( $this->is_preview() ) { |
|
106 | 106 | //Oh! Sorry but still not fully compatible with customizer |
107 | 107 | return $instance; |
108 | 108 | } |
109 | 109 | |
110 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
110 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
111 | 111 | |
112 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
113 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
114 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
115 | - $instance['post_id'] = $new_instance['post_id']; |
|
116 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
117 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
112 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
113 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
114 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
115 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
116 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
117 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
118 | 118 | |
119 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance['post_id'], $instance['view_id'], true ); |
|
119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance[ 'post_id' ], $instance[ 'view_id' ], true ); |
|
120 | 120 | |
121 | 121 | //check if post_id is a valid post with embedded View |
122 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
122 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
123 | 123 | |
124 | 124 | // Share that the widget isn't brand new |
125 | - $instance['updated'] = 1; |
|
125 | + $instance[ 'updated' ] = 1; |
|
126 | 126 | |
127 | 127 | return $instance; |
128 | 128 | } |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | public function form( $instance ) { |
134 | 134 | |
135 | 135 | // @todo Make compatible with Customizer |
136 | - if( $this->is_preview() ) { |
|
136 | + if ( $this->is_preview() ) { |
|
137 | 137 | |
138 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
138 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
139 | 139 | |
140 | 140 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
141 | 141 | |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
145 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
146 | 146 | |
147 | - $title = $instance['title']; |
|
148 | - $view_id = $instance['view_id']; |
|
149 | - $post_id = $instance['post_id']; |
|
150 | - $search_fields = $instance['search_fields']; |
|
151 | - $search_clear = $instance['search_clear']; |
|
152 | - $search_mode = $instance['search_mode']; |
|
147 | + $title = $instance[ 'title' ]; |
|
148 | + $view_id = $instance[ 'view_id' ]; |
|
149 | + $post_id = $instance[ 'post_id' ]; |
|
150 | + $search_fields = $instance[ 'search_fields' ]; |
|
151 | + $search_clear = $instance[ 'search_clear' ]; |
|
152 | + $search_mode = $instance[ 'search_mode' ]; |
|
153 | 153 | |
154 | 154 | $views = GVCommon::get_all_views(); |
155 | 155 | |
156 | 156 | // If there are no views set up yet, we get outta here. |
157 | - if( empty( $views ) ) { ?> |
|
157 | + if ( empty( $views ) ) { ?> |
|
158 | 158 | <div id="select_gravityview_view"> |
159 | 159 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
160 | 160 | </div> |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | } |
163 | 163 | ?> |
164 | 164 | |
165 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
165 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
166 | 166 | |
167 | 167 | <?php |
168 | 168 | /** |
169 | 169 | * Display errors generated for invalid embed IDs |
170 | 170 | * @see GravityView_View_Data::is_valid_embed_id |
171 | 171 | */ |
172 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
172 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
173 | 173 | ?> |
174 | 174 | <div class="error inline hide-on-view-change"> |
175 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
175 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
176 | 176 | </div> |
177 | 177 | <?php |
178 | 178 | unset ( $error ); |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | <p> |
183 | 183 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
184 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
184 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
185 | 185 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
186 | 186 | <?php |
187 | - foreach( $views as $view_option ) { |
|
188 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
189 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
187 | + foreach ( $views as $view_option ) { |
|
188 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
189 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | </select> |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * Display errors generated for invalid embed IDs |
199 | 199 | * @see GravityView_View_Data::is_valid_embed_id |
200 | 200 | */ |
201 | - if( !empty( $instance['error_post_id'] ) ) { |
|
201 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
202 | 202 | ?> |
203 | 203 | <div class="error inline"> |
204 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
204 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
205 | 205 | </div> |
206 | 206 | <?php |
207 | 207 | unset ( $error ); |
@@ -209,40 +209,40 @@ discard block |
||
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <p> |
212 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
212 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
214 | 214 | <span class="howto"><?php |
215 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
215 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
217 | 217 | ?></span> |
218 | 218 | </p> |
219 | 219 | |
220 | 220 | <p> |
221 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
223 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
221 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
223 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
224 | 224 | </p> |
225 | 225 | |
226 | 226 | <p> |
227 | 227 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
228 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
229 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
228 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
229 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
230 | 230 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
231 | 231 | </label> |
232 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
233 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
232 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
233 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
234 | 234 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
235 | 235 | </label> |
236 | - <span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
236 | + <span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
237 | 237 | </p> |
238 | 238 | |
239 | 239 | <hr /> |
240 | 240 | |
241 | 241 | <?php // @todo: move style to CSS ?> |
242 | 242 | <div style="margin-bottom: 1em;"> |
243 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
245 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
243 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
245 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
246 | 246 | </div> |
247 | 247 | |
248 | 248 | </div> |