@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | private function add_hooks() { |
42 | 42 | add_action( 'wp', array( $this, 'process_delete' ), 10000 ); |
43 | 43 | |
44 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 ); |
|
44 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
45 | 45 | |
46 | 46 | add_action( 'gravityview_before', array( $this, 'display_message' ) ); |
47 | 47 | |
48 | 48 | // For the Delete Entry Link, you don't want visible to all users. |
49 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 ); |
|
49 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
50 | 50 | |
51 | 51 | // Modify the field options based on the name of the field type |
52 | 52 | add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // add template path to check for field |
55 | 55 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
56 | 56 | |
57 | - add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 3 ); |
|
57 | + add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 3 ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | static function getInstance() { |
67 | 67 | |
68 | - if( empty( self::$instance ) ) { |
|
68 | + if ( empty( self::$instance ) ) { |
|
69 | 69 | self::$instance = new self; |
70 | 70 | } |
71 | 71 | |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
102 | 102 | |
103 | 103 | // Always a link, never a filter |
104 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
104 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
105 | 105 | |
106 | 106 | // Delete Entry link should only appear to visitors capable of editing entries |
107 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
107 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
108 | 108 | |
109 | - $add_option['delete_link'] = array( |
|
109 | + $add_option[ 'delete_link' ] = array( |
|
110 | 110 | 'type' => 'text', |
111 | 111 | 'label' => __( 'Delete Link Text', 'gravityview' ), |
112 | 112 | 'desc' => NULL, |
113 | - 'value' => __('Delete Entry', 'gravityview'), |
|
113 | + 'value' => __( 'Delete Entry', 'gravityview' ), |
|
114 | 114 | 'merge_tags' => true, |
115 | 115 | ); |
116 | 116 | |
117 | - $field_options['allow_edit_cap'] = array( |
|
117 | + $field_options[ 'allow_edit_cap' ] = array( |
|
118 | 118 | 'type' => 'select', |
119 | 119 | 'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ), |
120 | 120 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
140 | 140 | |
141 | - $entry_default_fields['delete_link'] = array( |
|
142 | - 'label' => __('Delete Entry', 'gravityview'), |
|
141 | + $entry_default_fields[ 'delete_link' ] = array( |
|
142 | + 'label' => __( 'Delete Entry', 'gravityview' ), |
|
143 | 143 | 'type' => 'delete_link', |
144 | - 'desc' => __('A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview'), |
|
144 | + 'desc' => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ), |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | return $entry_default_fields; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function add_available_field( $available_fields = array() ) { |
156 | 156 | |
157 | - $available_fields['delete_link'] = array( |
|
157 | + $available_fields[ 'delete_link' ] = array( |
|
158 | 158 | 'label_text' => __( 'Delete Entry', 'gravityview' ), |
159 | 159 | 'field_id' => 'delete_link', |
160 | 160 | 'label_type' => 'field', |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | $caps = $visibility_caps; |
183 | 183 | |
184 | 184 | // If we're configuring fields in the edit context, we want a limited selection |
185 | - if( $field_id === 'delete_link' ) { |
|
185 | + if ( $field_id === 'delete_link' ) { |
|
186 | 186 | |
187 | 187 | // Remove other built-in caps. |
188 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
188 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
189 | 189 | |
190 | - $caps['read'] = _x('Entry Creator', 'User capability', 'gravityview'); |
|
190 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return $caps; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param [type] $entry [description] |
201 | 201 | */ |
202 | 202 | function set_entry( $entry = null ) { |
203 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
203 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | |
231 | 231 | $base = GravityView_API::directory_link( $post_id, true ); |
232 | 232 | |
233 | - if( empty( $base ) ) { |
|
234 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: '.$post_id ); |
|
233 | + if ( empty( $base ) ) { |
|
234 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: ' . $post_id ); |
|
235 | 235 | return NULL; |
236 | 236 | } |
237 | 237 | |
238 | 238 | // Use the slug instead of the ID for consistent security |
239 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
239 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
240 | 240 | |
241 | 241 | $view_id = empty( $view_id ) ? gravityview_get_view_id() : $view_id; |
242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | 'view_id' => $view_id, |
248 | 248 | ), $base ); |
249 | 249 | |
250 | - $url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' ); |
|
250 | + $url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' ); |
|
251 | 251 | |
252 | 252 | return $url; |
253 | 253 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function add_delete_button( $form = array(), $entry = array(), $view_id = NULL ) { |
265 | 265 | |
266 | 266 | // Only show the link to those who are allowed to see it. |
267 | - if( !self::check_user_cap_delete_entry( $entry ) ) { |
|
267 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true ); |
276 | 276 | |
277 | 277 | // If the button is hidden by the filter, don't show. |
278 | - if( !$show_delete_button ) { |
|
278 | + if ( ! $show_delete_button ) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
@@ -305,24 +305,24 @@ discard block |
||
305 | 305 | function process_delete() { |
306 | 306 | |
307 | 307 | // If the form is submitted |
308 | - if( RGForms::get("action") === "delete") { |
|
308 | + if ( RGForms::get( "action" ) === "delete" ) { |
|
309 | 309 | |
310 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
310 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
311 | 311 | |
312 | 312 | // Make sure it's a valid request |
313 | 313 | check_admin_referer( $nonce_key, 'delete' ); |
314 | 314 | |
315 | 315 | // Get the entry slug |
316 | - $entry_slug = esc_attr( $_GET['entry_id'] ); |
|
316 | + $entry_slug = esc_attr( $_GET[ 'entry_id' ] ); |
|
317 | 317 | |
318 | 318 | // See if there's an entry there |
319 | 319 | $entry = gravityview_get_entry( $entry_slug ); |
320 | 320 | |
321 | - if( $entry ) { |
|
321 | + if ( $entry ) { |
|
322 | 322 | |
323 | 323 | $has_permission = $this->user_can_delete_entry( $entry ); |
324 | 324 | |
325 | - if( is_wp_error( $has_permission ) ) { |
|
325 | + if ( is_wp_error( $has_permission ) ) { |
|
326 | 326 | |
327 | 327 | $messages = array( |
328 | 328 | 'message' => urlencode( $has_permission->get_error_message() ), |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | } else { |
333 | 333 | |
334 | 334 | // Delete the entry |
335 | - $delete_response = $this->delete_or_trash_entry( $entry['id'] ); |
|
335 | + $delete_response = $this->delete_or_trash_entry( $entry[ 'id' ] ); |
|
336 | 336 | |
337 | - if( is_wp_error( $delete_response ) ) { |
|
337 | + if ( is_wp_error( $delete_response ) ) { |
|
338 | 338 | |
339 | 339 | $messages = array( |
340 | 340 | 'message' => urlencode( $delete_response->get_error_message() ), |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | |
354 | 354 | } else { |
355 | 355 | |
356 | - do_action('gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug '. $entry_slug ); |
|
356 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug ' . $entry_slug ); |
|
357 | 357 | |
358 | 358 | $messages = array( |
359 | - 'message' => urlencode( __('The entry does not exist.', 'gravityview') ), |
|
359 | + 'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ), |
|
360 | 360 | 'status' => 'error', |
361 | 361 | ); |
362 | 362 | } |
@@ -398,14 +398,14 @@ discard block |
||
398 | 398 | |
399 | 399 | $mode = $this->get_delete_mode(); |
400 | 400 | |
401 | - if( 'delete' === $mode ) { |
|
401 | + if ( 'delete' === $mode ) { |
|
402 | 402 | |
403 | 403 | do_action( 'gravityview_log_debug', __METHOD__ . ' Starting delete entry: ', $entry_id ); |
404 | 404 | |
405 | 405 | // Delete the entry |
406 | 406 | $delete_response = GFAPI::delete_entry( $entry_id ); |
407 | 407 | |
408 | - if( ! is_wp_error( $delete_response ) ) { |
|
408 | + if ( ! is_wp_error( $delete_response ) ) { |
|
409 | 409 | $delete_response = 'deleted'; |
410 | 410 | } |
411 | 411 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | $trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' ); |
419 | 419 | new GravityView_Cache; |
420 | 420 | |
421 | - if( ! $trashed ) { |
|
422 | - $delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) ); |
|
421 | + if ( ! $trashed ) { |
|
422 | + $delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) ); |
|
423 | 423 | } else { |
424 | 424 | $delete_response = 'trashed'; |
425 | 425 | } |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | public function verify_nonce() { |
440 | 440 | |
441 | 441 | // No delete entry request was made |
442 | - if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
442 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
443 | 443 | return false; |
444 | 444 | } |
445 | 445 | |
446 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
446 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
447 | 447 | |
448 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
448 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
449 | 449 | |
450 | 450 | /** |
451 | 451 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | */ |
468 | 468 | public static function get_confirm_dialog() { |
469 | 469 | |
470 | - $confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview'); |
|
470 | + $confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' ); |
|
471 | 471 | |
472 | 472 | /** |
473 | 473 | * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | */ |
476 | 476 | $confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm ); |
477 | 477 | |
478 | - return 'return window.confirm(\''. esc_js( $confirm ) .'\');'; |
|
478 | + return 'return window.confirm(\'' . esc_js( $confirm ) . '\');'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -493,16 +493,16 @@ discard block |
||
493 | 493 | |
494 | 494 | $error = NULL; |
495 | 495 | |
496 | - if( ! $this->verify_nonce() ) { |
|
497 | - $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview'); |
|
496 | + if ( ! $this->verify_nonce() ) { |
|
497 | + $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' ); |
|
498 | 498 | } |
499 | 499 | |
500 | - if( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
501 | - $error = __( 'You do not have permission to delete this entry.', 'gravityview'); |
|
500 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
501 | + $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
|
502 | 502 | } |
503 | 503 | |
504 | - if( $entry['status'] === 'trash' ) { |
|
505 | - if( 'trash' === $this->get_delete_mode() ) { |
|
504 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
505 | + if ( 'trash' === $this->get_delete_mode() ) { |
|
506 | 506 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
507 | 507 | } else { |
508 | 508 | $error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' ); |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | } |
511 | 511 | |
512 | 512 | // No errors; everything's fine here! |
513 | - if( empty( $error ) ) { |
|
513 | + if ( empty( $error ) ) { |
|
514 | 514 | return true; |
515 | 515 | } |
516 | 516 | |
517 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
517 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
518 | 518 | |
519 | 519 | return new WP_Error( 'gravityview-delete-entry-permissions', $error ); |
520 | 520 | } |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | |
537 | 537 | $current_user = wp_get_current_user(); |
538 | 538 | |
539 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL; |
|
539 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL; |
|
540 | 540 | |
541 | 541 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
542 | - if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
542 | + if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
543 | 543 | |
544 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
544 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
545 | 545 | |
546 | 546 | return true; |
547 | 547 | } |
548 | 548 | |
549 | 549 | |
550 | 550 | // If field options are passed, check if current user can view the link |
551 | - if( !empty( $field ) ) { |
|
551 | + if ( ! empty( $field ) ) { |
|
552 | 552 | |
553 | 553 | // If capability is not defined, something is not right! |
554 | - if( empty( $field['allow_edit_cap'] ) ) { |
|
554 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
555 | 555 | |
556 | 556 | do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Cannot read delete entry field caps', $field ); |
557 | 557 | |
558 | 558 | return false; |
559 | 559 | } |
560 | 560 | |
561 | - if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
561 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
562 | 562 | |
563 | 563 | // Do not return true if cap is read, as we need to check if the current user created the entry |
564 | - if( $field['allow_edit_cap'] !== 'read' ) { |
|
564 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
565 | 565 | return true; |
566 | 566 | } |
567 | 567 | |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | |
575 | 575 | } |
576 | 576 | |
577 | - if( !isset( $entry['created_by'] ) ) { |
|
577 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
578 | 578 | |
579 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.'); |
|
579 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.' ); |
|
580 | 580 | |
581 | 581 | return false; |
582 | 582 | } |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | $view_id = empty( $view_id ) ? $gravityview_view->getViewId() : $view_id; |
585 | 585 | |
586 | 586 | // Only checks user_delete view option if view is already set |
587 | - if( $view_id ) { |
|
587 | + if ( $view_id ) { |
|
588 | 588 | |
589 | 589 | $current_view = gravityview_get_current_view_data( $view_id ); |
590 | 590 | |
591 | - $user_delete = isset( $current_view['atts']['user_delete'] ) ? $current_view['atts']['user_delete'] : false; |
|
591 | + $user_delete = isset( $current_view[ 'atts' ][ 'user_delete' ] ) ? $current_view[ 'atts' ][ 'user_delete' ] : false; |
|
592 | 592 | |
593 | - if( empty( $user_delete ) ) { |
|
593 | + if ( empty( $user_delete ) ) { |
|
594 | 594 | |
595 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
595 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
596 | 596 | |
597 | 597 | return false; |
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
601 | 601 | // If the logged-in user is the same as the user who created the entry, we're good. |
602 | - if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
602 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
603 | 603 | |
604 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
604 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
605 | 605 | |
606 | 606 | return true; |
607 | 607 | } |
@@ -624,31 +624,31 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function display_message( $current_view_id = 0 ) { |
626 | 626 | |
627 | - if( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
627 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
628 | 628 | return; |
629 | 629 | } |
630 | 630 | |
631 | 631 | // Entry wasn't deleted from current View |
632 | - if( intval( $_GET['gvid'] ) !== intval( $current_view_id ) ) { |
|
632 | + if ( intval( $_GET[ 'gvid' ] ) !== intval( $current_view_id ) ) { |
|
633 | 633 | return; |
634 | 634 | } |
635 | 635 | |
636 | - $status = esc_attr( $_GET['status'] ); |
|
637 | - $message_from_url = rgget('message'); |
|
636 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
637 | + $message_from_url = rgget( 'message' ); |
|
638 | 638 | $message_from_url = urldecode( stripslashes_deep( $message_from_url ) ); |
639 | 639 | $class = ''; |
640 | 640 | |
641 | 641 | switch ( $status ) { |
642 | 642 | case 'error': |
643 | 643 | $class = ' gv-error error'; |
644 | - $error_message = __('There was an error deleting the entry: %s', 'gravityview'); |
|
644 | + $error_message = __( 'There was an error deleting the entry: %s', 'gravityview' ); |
|
645 | 645 | $message = sprintf( $error_message, $message_from_url ); |
646 | 646 | break; |
647 | 647 | case 'trashed': |
648 | - $message = __('The entry was successfully moved to the trash.', 'gravityview'); |
|
648 | + $message = __( 'The entry was successfully moved to the trash.', 'gravityview' ); |
|
649 | 649 | break; |
650 | 650 | default: |
651 | - $message = __('The entry was successfully deleted.', 'gravityview'); |
|
651 | + $message = __( 'The entry was successfully deleted.', 'gravityview' ); |
|
652 | 652 | break; |
653 | 653 | } |
654 | 654 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url ); |
663 | 663 | |
664 | 664 | // DISPLAY ERROR/SUCCESS MESSAGE |
665 | - echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>'; |
|
665 | + echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>'; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $redux_settings = $this->get_redux_settings(); |
52 | 52 | |
53 | 53 | // No need to process |
54 | - if( false === $redux_settings ) { |
|
54 | + if ( false === $redux_settings ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
58 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
59 | 59 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
60 | 60 | } |
61 | 61 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
70 | 70 | |
71 | 71 | // And now remove the previous option, so this is a one-time thing. |
72 | - delete_option('gravityview_settings'); |
|
73 | - delete_option('gravityview_settings-transients'); |
|
72 | + delete_option( 'gravityview_settings' ); |
|
73 | + delete_option( 'gravityview_settings-transients' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | |
87 | 87 | $data = array( |
88 | 88 | 'edd_action' => 'check_license', |
89 | - 'license' => rgget('license_key', $redux_settings ), |
|
89 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
90 | 90 | 'update' => false, |
91 | 91 | 'format' => 'object', |
92 | 92 | ); |
93 | 93 | |
94 | 94 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
95 | 95 | |
96 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | - $redux_settings['license_key_status'] = $license_call->license; |
|
98 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
96 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
98 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $redux_settings; |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | function get_redux_settings() { |
110 | 110 | |
111 | 111 | // Previous settings set by Redux |
112 | - $redux_option = get_option('gravityview_settings'); |
|
112 | + $redux_option = get_option( 'gravityview_settings' ); |
|
113 | 113 | |
114 | 114 | // No Redux settings? Don't proceed. |
115 | - if( false === $redux_option ) { |
|
115 | + if ( false === $redux_option ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -122,21 +122,21 @@ discard block |
||
122 | 122 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
123 | 123 | ); |
124 | 124 | |
125 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
125 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
126 | 126 | |
127 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
127 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
128 | 128 | |
129 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
129 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
130 | 130 | |
131 | 131 | // This contains the last response for license validation |
132 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
132 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
133 | 133 | |
134 | - $saved_license = rgget('license', $saved_values ); |
|
134 | + $saved_license = rgget( 'license', $saved_values ); |
|
135 | 135 | |
136 | 136 | // Only use the last-saved values if they are for the same license |
137 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
139 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
137 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
139 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | /** ---- Migrate from old search widget to new search widget ---- */ |
149 | 149 | function update_search_on_views() { |
150 | 150 | |
151 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
152 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
151 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
152 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Loop through all the views |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | $views = get_posts( $query_args ); |
163 | 163 | |
164 | - foreach( $views as $view ) { |
|
164 | + foreach ( $views as $view ) { |
|
165 | 165 | |
166 | 166 | $widgets = get_post_meta( $view->ID, '_gravityview_directory_widgets', true ); |
167 | 167 | $search_fields = null; |
168 | 168 | |
169 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
169 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
170 | 170 | |
171 | 171 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
172 | 172 | |
173 | - foreach( $widgets as $area => $ws ) { |
|
174 | - foreach( $ws as $k => $widget ) { |
|
175 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
173 | + foreach ( $widgets as $area => $ws ) { |
|
174 | + foreach ( $ws as $k => $widget ) { |
|
175 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
176 | 176 | |
177 | - if( is_null( $search_fields ) ) { |
|
177 | + if ( is_null( $search_fields ) ) { |
|
178 | 178 | $search_fields = $this->get_search_fields( $view->ID ); |
179 | 179 | } |
180 | 180 | |
@@ -182,24 +182,24 @@ discard block |
||
182 | 182 | // [search_free] => 1 |
183 | 183 | // [search_date] => 1 |
184 | 184 | $search_generic = array(); |
185 | - if( !empty( $widget['search_free'] ) ) { |
|
186 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
185 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
186 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
187 | 187 | } |
188 | - if( !empty( $widget['search_date'] ) ) { |
|
189 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
188 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
189 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $search_config = array_merge( $search_generic, $search_fields ); |
193 | 193 | |
194 | 194 | // don't throw '[]' when json_encode an empty array |
195 | - if( empty( $search_config ) ) { |
|
195 | + if ( empty( $search_config ) ) { |
|
196 | 196 | $search_config = ''; |
197 | 197 | } else { |
198 | 198 | $search_config = json_encode( $search_config ); |
199 | 199 | } |
200 | 200 | |
201 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
202 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
201 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
202 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
203 | 203 | |
204 | 204 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
205 | 205 | } |
@@ -227,26 +227,26 @@ discard block |
||
227 | 227 | // check view fields' settings |
228 | 228 | $fields = get_post_meta( $view_id, '_gravityview_directory_fields', true ); |
229 | 229 | |
230 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
230 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
231 | 231 | |
232 | - foreach( $fields as $t => $fs ) { |
|
232 | + foreach ( $fields as $t => $fs ) { |
|
233 | 233 | |
234 | - foreach( $fs as $k => $field ) { |
|
234 | + foreach ( $fs as $k => $field ) { |
|
235 | 235 | // is field a search_filter ? |
236 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
236 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
237 | 237 | |
238 | 238 | // get field type & calculate the input type (by default) |
239 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
239 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
240 | 240 | |
241 | - if( empty( $form_field['type'] ) ) { |
|
241 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // depending on the field type assign a group of possible search field types |
246 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
246 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
247 | 247 | |
248 | 248 | // add field to config |
249 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
249 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | } |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | |
31 | 31 | $label = ''; |
32 | 32 | |
33 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
33 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
34 | 34 | |
35 | - $label = $field['label']; |
|
35 | + $label = $field[ 'label' ]; |
|
36 | 36 | |
37 | 37 | // Support Gravity Forms 1.9+ |
38 | - if( class_exists( 'GF_Field' ) ) { |
|
38 | + if ( class_exists( 'GF_Field' ) ) { |
|
39 | 39 | |
40 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
40 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
41 | 41 | |
42 | - if( $field_object ) { |
|
42 | + if ( $field_object ) { |
|
43 | 43 | |
44 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
44 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
45 | 45 | |
46 | 46 | // This is a complex field, with labels on a per-input basis |
47 | - if( $input ) { |
|
47 | + if ( $input ) { |
|
48 | 48 | |
49 | 49 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
50 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
50 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
51 | 51 | |
52 | 52 | } else { |
53 | 53 | |
54 | 54 | // This is a field with one label |
55 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
55 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
64 | - if ( !empty( $field['custom_label'] ) ) { |
|
64 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
65 | 65 | |
66 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
66 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param array $entry GF Entry array |
100 | 100 | * @return string Text with variables maybe replaced |
101 | 101 | */ |
102 | - public static function replace_variables($text, $form, $entry ) { |
|
102 | + public static function replace_variables( $text, $form, $entry ) { |
|
103 | 103 | return GravityView_Merge_Tags::replace_variables( $text, $form, $entry ); |
104 | 104 | } |
105 | 105 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | |
118 | 118 | $width = NULL; |
119 | 119 | |
120 | - if( !empty( $field['width'] ) ) { |
|
121 | - $width = absint( $field['width'] ); |
|
120 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
121 | + $width = absint( $field[ 'width' ] ); |
|
122 | 122 | |
123 | 123 | // If using percentages, limit to 100% |
124 | - if( '%d%%' === $format && $width > 100 ) { |
|
124 | + if ( '%d%%' === $format && $width > 100 ) { |
|
125 | 125 | $width = 100; |
126 | 126 | } |
127 | 127 | |
@@ -144,39 +144,39 @@ discard block |
||
144 | 144 | |
145 | 145 | $classes = array(); |
146 | 146 | |
147 | - if( !empty( $field['custom_class'] ) ) { |
|
147 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field[ 'custom_class' ]; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if ( ! empty( $entry ) ) { |
|
152 | 152 | |
153 | 153 | // We want the merge tag to be formatted as a class. The merge tag may be |
154 | 154 | // replaced by a multiple-word value that should be output as a single class. |
155 | 155 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
156 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
157 | 157 | |
158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
159 | 159 | |
160 | 160 | // And then we want life to return to normal |
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
161 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
165 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | - if(!empty($field['id'])) { |
|
170 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
171 | - $form_id = '-'.$form['id']; |
|
169 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
170 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
171 | + $form_id = '-' . $form[ 'id' ]; |
|
172 | 172 | } else { |
173 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
173 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
174 | 174 | } |
175 | 175 | |
176 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
176 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
177 | 177 | } |
178 | 178 | |
179 | - return esc_attr(implode(' ', $classes)); |
|
179 | + return esc_attr( implode( ' ', $classes ) ); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
195 | 195 | $gravityview_view = GravityView_View::getInstance(); |
196 | - $id = $field['id']; |
|
196 | + $id = $field[ 'id' ]; |
|
197 | 197 | |
198 | 198 | if ( ! empty( $id ) ) { |
199 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
200 | - $form_id = '-' . $form['id']; |
|
199 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
200 | + $form_id = '-' . $form[ 'id' ]; |
|
201 | 201 | } else { |
202 | 202 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
203 | 203 | } |
204 | 204 | |
205 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
205 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return esc_attr( $id ); |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
221 | 221 | |
222 | - if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
222 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
223 | 223 | return NULL; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $gravityview_view = GravityView_View::getInstance(); |
227 | 227 | |
228 | - if( class_exists( 'GFCache' ) ) { |
|
228 | + if ( class_exists( 'GFCache' ) ) { |
|
229 | 229 | /** |
230 | 230 | * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run. |
231 | 231 | * |
@@ -240,46 +240,46 @@ discard block |
||
240 | 240 | * @param boolean false Tell Gravity Forms not to store this as a transient |
241 | 241 | * @param int 0 Time to store the value. 0 is maximum amount of time possible. |
242 | 242 | */ |
243 | - GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 ); |
|
243 | + GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry[ "id" ] . "_" . $field_settings[ "id" ], false, false, 0 ); |
|
244 | 244 | } |
245 | 245 | |
246 | - $field_id = $field_settings['id']; |
|
246 | + $field_id = $field_settings[ 'id' ]; |
|
247 | 247 | |
248 | 248 | $form = $gravityview_view->getForm(); |
249 | 249 | |
250 | 250 | $field = gravityview_get_field( $form, $field_id ); |
251 | 251 | |
252 | - $field_type = RGFormsModel::get_input_type($field); |
|
252 | + $field_type = RGFormsModel::get_input_type( $field ); |
|
253 | 253 | |
254 | - if( $field_type ) { |
|
255 | - $field_type = $field['type']; |
|
256 | - $value = RGFormsModel::get_lead_field_value($entry, $field); |
|
254 | + if ( $field_type ) { |
|
255 | + $field_type = $field[ 'type' ]; |
|
256 | + $value = RGFormsModel::get_lead_field_value( $entry, $field ); |
|
257 | 257 | } else { |
258 | 258 | // For non-integer field types (`id`, `date_created`, etc.) |
259 | 259 | $field_type = $field_id; |
260 | - $field['type'] = $field_id; |
|
261 | - $value = isset($entry[$field_type]) ? $entry[$field_type] : NULL; |
|
260 | + $field[ 'type' ] = $field_id; |
|
261 | + $value = isset( $entry[ $field_type ] ) ? $entry[ $field_type ] : NULL; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Prevent any PHP warnings that may be generated |
265 | 265 | ob_start(); |
266 | 266 | |
267 | - $display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format); |
|
267 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
268 | 268 | |
269 | - if( $errors = ob_get_clean() ) { |
|
269 | + if ( $errors = ob_get_clean() ) { |
|
270 | 270 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
271 | 271 | } |
272 | 272 | |
273 | - $display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form); |
|
273 | + $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
|
274 | 274 | |
275 | 275 | // prevent the use of merge_tags for non-admin fields |
276 | - if( !empty( $field['adminOnly'] ) ) { |
|
276 | + if ( ! empty( $field[ 'adminOnly' ] ) ) { |
|
277 | 277 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
278 | 278 | } |
279 | 279 | |
280 | 280 | // Check whether the field exists in /includes/fields/{$field_type}.php |
281 | 281 | // This can be overridden by user template files. |
282 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
282 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
283 | 283 | |
284 | 284 | // Set the field data to be available in the templates |
285 | 285 | $gravityview_view->setCurrentField( array( |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | 'entry' => $entry, |
294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
295 | 295 | 'field_path' => $field_path, /** {@since 1.16} */ |
296 | - )); |
|
296 | + ) ); |
|
297 | 297 | |
298 | - if( ! empty( $field_path ) ) { |
|
298 | + if ( ! empty( $field_path ) ) { |
|
299 | 299 | |
300 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
300 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
301 | 301 | |
302 | 302 | ob_start(); |
303 | 303 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | } |
314 | 314 | |
315 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
315 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
316 | 316 | |
317 | 317 | /** |
318 | 318 | * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link` |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
331 | 331 | * |
332 | 332 | */ |
333 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
333 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
334 | 334 | |
335 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
335 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
336 | 336 | |
337 | 337 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
338 | 338 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param array $field_settings Settings for the particular GV field |
347 | 347 | * @param array $field Current field being displayed |
348 | 348 | */ |
349 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
349 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
373 | 373 | |
374 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
374 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
375 | 375 | |
376 | 376 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
377 | 377 | |
@@ -399,19 +399,19 @@ discard block |
||
399 | 399 | * @param boolean $wpautop Apply wpautop() to the output? |
400 | 400 | * @return string HTML of "no results" text |
401 | 401 | */ |
402 | - public static function no_results($wpautop = true) { |
|
402 | + public static function no_results( $wpautop = true ) { |
|
403 | 403 | $gravityview_view = GravityView_View::getInstance(); |
404 | 404 | |
405 | 405 | $is_search = false; |
406 | 406 | |
407 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
407 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
408 | 408 | $is_search = true; |
409 | 409 | } |
410 | 410 | |
411 | - if($is_search) { |
|
412 | - $output = __('This search returned no results.', 'gravityview'); |
|
411 | + if ( $is_search ) { |
|
412 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
413 | 413 | } else { |
414 | - $output = __('No entries match your request.', 'gravityview'); |
|
414 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | * @param string $output The existing "No Entries" text |
420 | 420 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
421 | 421 | */ |
422 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
422 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
423 | 423 | |
424 | - return $wpautop ? wpautop($output) : $output; |
|
424 | + return $wpautop ? wpautop( $output ) : $output; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
@@ -438,37 +438,37 @@ discard block |
||
438 | 438 | |
439 | 439 | $gravityview_view = GravityView_View::getInstance(); |
440 | 440 | |
441 | - if( empty( $post_id ) ) { |
|
441 | + if ( empty( $post_id ) ) { |
|
442 | 442 | |
443 | 443 | $post_id = false; |
444 | 444 | |
445 | 445 | // DataTables passes the Post ID |
446 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
446 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
447 | 447 | |
448 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
448 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
449 | 449 | |
450 | 450 | } else { |
451 | 451 | |
452 | 452 | // The Post ID has been passed via the shortcode |
453 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
453 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
454 | 454 | |
455 | 455 | $post_id = $gravityview_view->getPostId(); |
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | 459 | // This is a GravityView post type |
460 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
460 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
461 | 461 | |
462 | 462 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
463 | 463 | |
464 | 464 | } else { |
465 | 465 | |
466 | 466 | // This is an embedded GravityView; use the embedded post's ID as the base. |
467 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
467 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
468 | 468 | |
469 | 469 | $post_id = $post->ID; |
470 | 470 | |
471 | - } elseif( $gravityview_view->getViewId() ) { |
|
471 | + } elseif ( $gravityview_view->getViewId() ) { |
|
472 | 472 | |
473 | 473 | // The GravityView has been embedded in a widget or in a template, and |
474 | 474 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -483,36 +483,36 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | // No post ID, get outta here. |
486 | - if( empty( $post_id ) ) { |
|
486 | + if ( empty( $post_id ) ) { |
|
487 | 487 | return NULL; |
488 | 488 | } |
489 | 489 | |
490 | 490 | // If we've saved the permalink in memory, use it |
491 | 491 | // @since 1.3 |
492 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
492 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
493 | 493 | |
494 | - if( empty( $link ) ) { |
|
494 | + if ( empty( $link ) ) { |
|
495 | 495 | |
496 | 496 | $link = get_permalink( $post_id ); |
497 | 497 | |
498 | 498 | // If not yet saved, cache the permalink. |
499 | 499 | // @since 1.3 |
500 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
500 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
501 | 501 | |
502 | 502 | } |
503 | 503 | |
504 | 504 | // Deal with returning to proper pagination for embedded views |
505 | - if( $link && $add_query_args ) { |
|
505 | + if ( $link && $add_query_args ) { |
|
506 | 506 | |
507 | 507 | $args = array(); |
508 | 508 | |
509 | - if( $pagenum = rgget('pagenum') ) { |
|
510 | - $args['pagenum'] = intval( $pagenum ); |
|
509 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
510 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
511 | 511 | } |
512 | 512 | |
513 | - if( $sort = rgget('sort') ) { |
|
514 | - $args['sort'] = $sort; |
|
515 | - $args['dir'] = rgget('dir'); |
|
513 | + if ( $sort = rgget( 'sort' ) ) { |
|
514 | + $args[ 'sort' ] = $sort; |
|
515 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | $link = add_query_arg( $args, $link ); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
536 | 536 | |
537 | 537 | // Generate an unique hash to use as the default value |
538 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
538 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
547 | 547 | |
548 | 548 | // Make sure we have something - use the original ID as backup. |
549 | - if( empty( $slug ) ) { |
|
549 | + if ( empty( $slug ) ) { |
|
550 | 550 | $slug = $id; |
551 | 551 | } |
552 | 552 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
576 | 576 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
577 | 577 | */ |
578 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
578 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
579 | 579 | |
580 | 580 | // If we're using custom slug... |
581 | 581 | if ( $custom ) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | // If it does have a hash set, and the hash is expected, use it. |
590 | 590 | // This check allows users to change the hash structure using the |
591 | 591 | // gravityview_entry_hash filter and have the old hashes expire. |
592 | - if( empty( $value ) || $value !== $hash ) { |
|
592 | + if ( empty( $value ) || $value !== $hash ) { |
|
593 | 593 | |
594 | 594 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
595 | 595 | |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | * @param boolean $custom Should we process the custom entry slug? |
618 | 618 | */ |
619 | 619 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
620 | - if( $custom ) { |
|
620 | + if ( $custom ) { |
|
621 | 621 | // create the gravityview_unique_id and save it |
622 | 622 | |
623 | 623 | // Get the entry hash |
624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
624 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
625 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | } |
@@ -639,14 +639,14 @@ discard block |
||
639 | 639 | */ |
640 | 640 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
641 | 641 | |
642 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
642 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
643 | 643 | $entry = GVCommon::get_entry( $entry ); |
644 | - } else if( empty( $entry ) ) { |
|
644 | + } else if ( empty( $entry ) ) { |
|
645 | 645 | $entry = GravityView_frontend::getInstance()->getEntry(); |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Second parameter used to be passed as $field; this makes sure it's not an array |
649 | - if( !is_numeric( $post_id ) ) { |
|
649 | + if ( ! is_numeric( $post_id ) ) { |
|
650 | 650 | $post_id = NULL; |
651 | 651 | } |
652 | 652 | |
@@ -654,19 +654,19 @@ discard block |
||
654 | 654 | $directory_link = self::directory_link( $post_id, false ); |
655 | 655 | |
656 | 656 | // No post ID? Get outta here. |
657 | - if( empty( $directory_link ) ) { |
|
657 | + if ( empty( $directory_link ) ) { |
|
658 | 658 | return ''; |
659 | 659 | } |
660 | 660 | |
661 | 661 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
662 | 662 | |
663 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
663 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
664 | 664 | |
665 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
665 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
666 | 666 | |
667 | 667 | $args = array(); |
668 | 668 | |
669 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
669 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
670 | 670 | |
671 | 671 | } else { |
672 | 672 | |
@@ -676,18 +676,18 @@ discard block |
||
676 | 676 | /** |
677 | 677 | * @since 1.7.3 |
678 | 678 | */ |
679 | - if( $add_directory_args ) { |
|
679 | + if ( $add_directory_args ) { |
|
680 | 680 | |
681 | - if( !empty( $_GET['pagenum'] ) ) { |
|
682 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
681 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
682 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
686 | 686 | * @since 1.7 |
687 | 687 | */ |
688 | - if( $sort = rgget('sort') ) { |
|
689 | - $args['sort'] = $sort; |
|
690 | - $args['dir'] = rgget('dir'); |
|
688 | + if ( $sort = rgget( 'sort' ) ) { |
|
689 | + $args[ 'sort' ] = $sort; |
|
690 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | } |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
698 | 698 | * @see GravityView_frontend::get_context_view_id() |
699 | 699 | */ |
700 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
701 | - $args['gvid'] = gravityview_get_view_id(); |
|
700 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
701 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | return add_query_arg( $args, $directory_link ); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | } |
717 | 717 | |
718 | 718 | function gv_class( $field, $form = NULL, $entry = array() ) { |
719 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
719 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | |
739 | 739 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
740 | 740 | |
741 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
741 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
742 | 742 | $default_css_class .= ' hidden'; |
743 | 743 | } |
744 | 744 | |
745 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
745 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
746 | 746 | |
747 | 747 | /** |
748 | 748 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | $css_class = gravityview_sanitize_html_class( $css_class ); |
755 | 755 | |
756 | - if( $echo ) { |
|
756 | + if ( $echo ) { |
|
757 | 757 | echo $css_class; |
758 | 758 | } |
759 | 759 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | $value = GravityView_API::field_value( $entry, $field ); |
766 | 766 | |
767 | - if( $value === '') { |
|
767 | + if ( $value === '' ) { |
|
768 | 768 | /** |
769 | 769 | * @filter `gravityview_empty_value` What to display when a field is empty |
770 | 770 | * @param string $value (empty string) |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | return GravityView_API::entry_link( $entry, $post_id ); |
784 | 784 | } |
785 | 785 | |
786 | -function gv_no_results($wpautop = true) { |
|
786 | +function gv_no_results( $wpautop = true ) { |
|
787 | 787 | return GravityView_API::no_results( $wpautop ); |
788 | 788 | } |
789 | 789 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | |
797 | 797 | $href = gv_directory_link(); |
798 | 798 | |
799 | - if( empty( $href ) ) { return NULL; } |
|
799 | + if ( empty( $href ) ) { return NULL; } |
|
800 | 800 | |
801 | 801 | // calculate link label |
802 | 802 | $gravityview_view = GravityView_View::getInstance(); |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
814 | 814 | 'data-viewid' => $gravityview_view->getViewId() |
815 | - )); |
|
815 | + ) ); |
|
816 | 816 | |
817 | 817 | return $link; |
818 | 818 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | */ |
832 | 832 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
833 | 833 | |
834 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
834 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
835 | 835 | |
836 | 836 | // For the complete field value as generated by Gravity Forms |
837 | 837 | return $display_value; |
@@ -861,16 +861,16 @@ discard block |
||
861 | 861 | |
862 | 862 | $terms = explode( ', ', $value ); |
863 | 863 | |
864 | - foreach ($terms as $term_name ) { |
|
864 | + foreach ( $terms as $term_name ) { |
|
865 | 865 | |
866 | 866 | // If we're processing a category, |
867 | - if( $taxonomy === 'category' ) { |
|
867 | + if ( $taxonomy === 'category' ) { |
|
868 | 868 | |
869 | 869 | // Use rgexplode to prevent errors if : doesn't exist |
870 | 870 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
871 | 871 | |
872 | 872 | // The explode was succesful; we have the category ID |
873 | - if( !empty( $term_id )) { |
|
873 | + if ( ! empty( $term_id ) ) { |
|
874 | 874 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
875 | 875 | } else { |
876 | 876 | // We have to fall back to the name |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | } |
884 | 884 | |
885 | 885 | // There's still a tag/category here. |
886 | - if( $term ) { |
|
886 | + if ( $term ) { |
|
887 | 887 | |
888 | 888 | $term_link = get_term_link( $term, $taxonomy ); |
889 | 889 | |
@@ -892,11 +892,11 @@ discard block |
||
892 | 892 | continue; |
893 | 893 | } |
894 | 894 | |
895 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
895 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | - return implode(', ', $output ); |
|
899 | + return implode( ', ', $output ); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | /** |
@@ -910,8 +910,8 @@ discard block |
||
910 | 910 | |
911 | 911 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
912 | 912 | |
913 | - if( empty( $link ) ) { |
|
914 | - return strip_tags( $output); |
|
913 | + if ( empty( $link ) ) { |
|
914 | + return strip_tags( $output ); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | return $output; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $fe = GravityView_frontend::getInstance(); |
931 | 931 | |
932 | 932 | // Solve problem when loading content via admin-ajax.php |
933 | - if( ! $fe->getGvOutputData() ) { |
|
933 | + if ( ! $fe->getGvOutputData() ) { |
|
934 | 934 | |
935 | 935 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
936 | 936 | |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | // Make 100% sure that we're dealing with a properly called situation |
941 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
941 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
942 | 942 | |
943 | 943 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
944 | 944 | |
@@ -958,10 +958,10 @@ discard block |
||
958 | 958 | |
959 | 959 | $fe = GravityView_frontend::getInstance(); |
960 | 960 | |
961 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
961 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
962 | 962 | |
963 | 963 | // If not set, grab the current view ID |
964 | - if( empty( $view_id ) ) { |
|
964 | + if ( empty( $view_id ) ) { |
|
965 | 965 | $view_id = $fe->get_context_view_id(); |
966 | 966 | } |
967 | 967 | |
@@ -1026,11 +1026,11 @@ discard block |
||
1026 | 1026 | */ |
1027 | 1027 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1028 | 1028 | |
1029 | - if( $is_edit_entry ) { |
|
1029 | + if ( $is_edit_entry ) { |
|
1030 | 1030 | $context = 'edit'; |
1031 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1031 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1032 | 1032 | $context = 'single'; |
1033 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1033 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1034 | 1034 | $context = GravityView_View::getInstance()->getContext(); |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1058,12 +1058,12 @@ discard block |
||
1058 | 1058 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1059 | 1059 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1060 | 1060 | |
1061 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1062 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1061 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1062 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1066 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1065 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1066 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1141,12 +1141,12 @@ discard block |
||
1141 | 1141 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1142 | 1142 | |
1143 | 1143 | // Required fields. |
1144 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1144 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1145 | 1145 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1146 | 1146 | return ''; |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1149 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * Create the content variables for replacing. |
@@ -1162,37 +1162,37 @@ discard block |
||
1162 | 1162 | 'field_id' => '', |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1165 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1166 | 1166 | |
1167 | 1167 | // If the value is empty and we're hiding empty, return empty. |
1168 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1168 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1169 | 1169 | return ''; |
1170 | 1170 | } |
1171 | 1171 | |
1172 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1173 | - $context['value'] = wpautop( $context['value'] ); |
|
1172 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1173 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | // Get width setting, if exists |
1177 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1177 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1178 | 1178 | |
1179 | 1179 | // If replacing with CSS inline formatting, let's do it. |
1180 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1180 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1181 | 1181 | |
1182 | 1182 | // Grab the Class using `gv_class` |
1183 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1184 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1183 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1184 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1185 | 1185 | |
1186 | 1186 | // Get field label if needed |
1187 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1188 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1187 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1188 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Default Label value |
1192 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1192 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1193 | 1193 | |
1194 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1195 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1194 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1195 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | /** |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | * @param string $markup The HTML for the markup |
1202 | 1202 | * @param array $args All args for the field output |
1203 | 1203 | */ |
1204 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1204 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1205 | 1205 | |
1206 | 1206 | /** |
1207 | 1207 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | foreach ( $context as $tag => $value ) { |
1225 | 1225 | |
1226 | 1226 | // If the tag doesn't exist just skip it |
1227 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1227 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1228 | 1228 | continue; |
1229 | 1229 | } |
1230 | 1230 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | static function getInstance() { |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | |
48 | 48 | self::$instance->initialize(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // Catch either |
95 | 95 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
96 | 96 | |
97 | - return '#'.$match_regex.'#i'; |
|
97 | + return '#' . $match_regex . '#i'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | $post_id = url_to_postid( $url ); |
115 | 115 | |
116 | - if( empty( $post_id ) ) { |
|
116 | + if ( empty( $post_id ) ) { |
|
117 | 117 | |
118 | 118 | $args = array( |
119 | 119 | 'post_status' => 'publish', |
120 | 120 | 'name' => $slug, |
121 | - 'post_type' => array('any', 'gravityview'), |
|
121 | + 'post_type' => array( 'any', 'gravityview' ), |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | $posts = get_posts( $args ); |
125 | 125 | |
126 | - if( !empty( $posts ) ) { |
|
127 | - $post_id = $posts[0]->ID; |
|
126 | + if ( ! empty( $posts ) ) { |
|
127 | + $post_id = $posts[ 0 ]->ID; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
158 | 158 | |
159 | 159 | // If not using permalinks, re-assign values for matching groups |
160 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
161 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
162 | - $matches['slug'] = $matches['slug2']; |
|
163 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
164 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
160 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
161 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
162 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
163 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
164 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // No Entry was found |
168 | - if( empty( $matches['entry_slug'] ) ) { |
|
168 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
169 | 169 | |
170 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
170 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
171 | 171 | |
172 | 172 | return ''; |
173 | 173 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | // Setup the data used |
178 | 178 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
179 | 179 | |
180 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
180 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
181 | 181 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
182 | 182 | } else { |
183 | 183 | |
184 | - if( $this->is_full_oembed_preview ) { |
|
184 | + if ( $this->is_full_oembed_preview ) { |
|
185 | 185 | $return .= $this->generate_preview_notice(); |
186 | 186 | } |
187 | 187 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | private function generate_preview_notice() { |
201 | 201 | $floaty = GravityView_Admin::get_floaty(); |
202 | 202 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
203 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
204 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
203 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
204 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
216 | 216 | |
217 | - $this->entry_id = $matches['entry_slug']; |
|
217 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
218 | 218 | |
219 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
219 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
220 | 220 | |
221 | 221 | // The URL didn't have the View Custom Post Type structure. |
222 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
222 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
223 | 223 | |
224 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
224 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
225 | 225 | |
226 | 226 | $this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
235 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
235 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | // Floaty the astronaut |
251 | 251 | $image = GravityView_Admin::get_floaty(); |
252 | 252 | |
253 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
253 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
254 | 254 | |
255 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
255 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
256 | 256 | |
257 | 257 | return ' |
258 | 258 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
259 | - <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
259 | + <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
260 | 260 | <p style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;"> |
261 | - '.$embed_text.' |
|
261 | + '.$embed_text . ' |
|
262 | 262 | </p> |
263 | 263 | <br style="clear: both;"> |
264 | 264 | </div>'; |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
314 | 314 | |
315 | 315 | // If it's already been parsed, don't re-output it. |
316 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
316 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
317 | 317 | return $this->output[ $this->entry_id ]; |
318 | 318 | } |
319 | 319 | |
320 | 320 | $entry_output = $this->generate_entry_output(); |
321 | 321 | |
322 | 322 | // Wrap a container div around the output to allow for custom styling |
323 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
323 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @var string $url The original URL that was matched by the regex. \n |
334 | 334 | * @var array $rawattr The original unmodified attributes. |
335 | 335 | */ |
336 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
336 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
337 | 337 | |
338 | 338 | unset( $entry_output ); |
339 | 339 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
19 | +if ( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
21 | 21 | } |
22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | 'atts' => NULL, |
158 | 158 | ) ); |
159 | 159 | |
160 | - foreach ($atts as $key => $value) { |
|
161 | - if( is_null( $value ) ) { |
|
160 | + foreach ( $atts as $key => $value ) { |
|
161 | + if ( is_null( $value ) ) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | $this->{$key} = $value; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | static function getInstance( $passed_post = NULL ) { |
191 | 191 | |
192 | - if( empty( self::$instance ) ) { |
|
192 | + if ( empty( self::$instance ) ) { |
|
193 | 193 | self::$instance = new self( $passed_post ); |
194 | 194 | } |
195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function getCurrentField( $key = NULL ) { |
204 | 204 | |
205 | - if( !empty( $key ) ) { |
|
206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
205 | + if ( ! empty( $key ) ) { |
|
206 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
207 | 207 | return $this->_current_field[ $key ]; |
208 | 208 | } |
209 | 209 | return NULL; |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | |
215 | 215 | public function setCurrentFieldSetting( $key, $value ) { |
216 | 216 | |
217 | - if( !empty( $this->_current_field ) ) { |
|
218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
217 | + if ( ! empty( $this->_current_field ) ) { |
|
218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | 223 | public function getCurrentFieldSetting( $key ) { |
224 | - $settings = $this->getCurrentField('field_settings'); |
|
224 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
225 | 225 | |
226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
226 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
227 | 227 | return $settings[ $key ]; |
228 | 228 | } |
229 | 229 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getAtts( $key = NULL ) { |
256 | 256 | |
257 | - if( !empty( $key ) ) { |
|
258 | - if( isset( $this->atts[ $key ] ) ) { |
|
257 | + if ( ! empty( $key ) ) { |
|
258 | + if ( isset( $this->atts[ $key ] ) ) { |
|
259 | 259 | return $this->atts[ $key ]; |
260 | 260 | } |
261 | 261 | return NULL; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
323 | 323 | |
324 | - if( $fields && !empty( $key ) ) { |
|
324 | + if ( $fields && ! empty( $key ) ) { |
|
325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
326 | 326 | } |
327 | 327 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function getField( $key ) { |
343 | 343 | |
344 | - if( !empty( $key ) ) { |
|
345 | - if( isset( $this->fields[ $key ] ) ) { |
|
344 | + if ( ! empty( $key ) ) { |
|
345 | + if ( isset( $this->fields[ $key ] ) ) { |
|
346 | 346 | return $this->fields[ $key ]; |
347 | 347 | } |
348 | 348 | } |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | public function getPaginationCounts() { |
443 | 443 | |
444 | 444 | $paging = $this->getPaging(); |
445 | - $offset = $paging['offset']; |
|
446 | - $page_size = $paging['page_size']; |
|
445 | + $offset = $paging[ 'offset' ]; |
|
446 | + $page_size = $paging[ 'page_size' ]; |
|
447 | 447 | $total = $this->getTotalEntries(); |
448 | 448 | |
449 | 449 | if ( empty( $total ) ) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
466 | 466 | |
467 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
467 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -548,16 +548,16 @@ discard block |
||
548 | 548 | */ |
549 | 549 | public function getCurrentEntry() { |
550 | 550 | |
551 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
551 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
552 | 552 | $entries = $this->getEntries(); |
553 | - $entry = $entries[0]; |
|
553 | + $entry = $entries[ 0 ]; |
|
554 | 554 | } else { |
555 | 555 | $entry = $this->_current_entry; |
556 | 556 | } |
557 | 557 | |
558 | 558 | /** @since 1.16 Fixes DataTables empty entry issue */ |
559 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
560 | - $entry = $this->_current_field['entry']; |
|
559 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
560 | + $entry = $this->_current_field[ 'entry' ]; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $entry; |
@@ -591,8 +591,8 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function renderZone( $zone = '', $atts = array() ) { |
593 | 593 | |
594 | - if( empty( $zone ) ) { |
|
595 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
594 | + if ( empty( $zone ) ) { |
|
595 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
596 | 596 | return NULL; |
597 | 597 | } |
598 | 598 | |
@@ -601,33 +601,33 @@ discard block |
||
601 | 601 | 'context' => $this->getContext(), |
602 | 602 | 'entry' => $this->getCurrentEntry(), |
603 | 603 | 'form' => $this->getForm(), |
604 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
604 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
605 | 605 | ); |
606 | 606 | |
607 | 607 | $final_atts = wp_parse_args( $atts, $defaults ); |
608 | 608 | |
609 | 609 | $output = ''; |
610 | 610 | |
611 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
611 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
612 | 612 | |
613 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
613 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
614 | 614 | |
615 | 615 | // Backward compatibility |
616 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
616 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
617 | 617 | /** |
618 | 618 | * Modify the fields displayed in the table |
619 | 619 | * @var array |
620 | 620 | */ |
621 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
621 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
622 | 622 | } |
623 | 623 | |
624 | - if( empty( $fields ) ) { |
|
624 | + if ( empty( $fields ) ) { |
|
625 | 625 | return NULL; |
626 | 626 | } |
627 | 627 | |
628 | 628 | $field_output = ''; |
629 | 629 | foreach ( $fields as $field ) { |
630 | - $final_atts['field'] = $field; |
|
630 | + $final_atts[ 'field' ] = $field; |
|
631 | 631 | |
632 | 632 | $field_output .= gravityview_field_output( $final_atts ); |
633 | 633 | } |
@@ -638,17 +638,17 @@ discard block |
||
638 | 638 | * @since 1.7.6 |
639 | 639 | * @param boolean $hide_empty_zone Default: false |
640 | 640 | */ |
641 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
641 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
642 | 642 | return NULL; |
643 | 643 | } |
644 | 644 | |
645 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
646 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
645 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
646 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | $output .= $field_output; |
650 | 650 | |
651 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
651 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
652 | 652 | $output .= '</div>'; |
653 | 653 | } |
654 | 654 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | */ |
669 | 669 | function locate_template( $template_names, $load = false, $require_once = true ) { |
670 | 670 | |
671 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
671 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
672 | 672 | |
673 | 673 | $located = $this->located_templates[ $template_names ]; |
674 | 674 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | // Set $load to always false so we handle it here. |
678 | 678 | $located = parent::locate_template( $template_names, false, $require_once ); |
679 | 679 | |
680 | - if( is_string( $template_names ) ) { |
|
680 | + if ( is_string( $template_names ) ) { |
|
681 | 681 | $this->located_templates[ $template_names ] = $located; |
682 | 682 | } |
683 | 683 | } |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | * @return mixed|null The stored data. |
696 | 696 | */ |
697 | 697 | public function __get( $name ) { |
698 | - if( isset( $this->{$name} ) ) { |
|
698 | + if ( isset( $this->{$name} ) ) { |
|
699 | 699 | return $this->{$name}; |
700 | 700 | } else { |
701 | 701 | return NULL; |
@@ -724,15 +724,15 @@ discard block |
||
724 | 724 | $additional = array(); |
725 | 725 | |
726 | 726 | // form-19-table-body.php |
727 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
727 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
728 | 728 | |
729 | 729 | // view-3-table-body.php |
730 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
730 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
731 | 731 | |
732 | - if( $this->getPostId() ) { |
|
732 | + if ( $this->getPostId() ) { |
|
733 | 733 | |
734 | 734 | // page-19-table-body.php |
735 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
735 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | // Combine with existing table-body.php and table.php |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | |
755 | 755 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
756 | 756 | |
757 | - if( !empty( $template_file) ) { |
|
757 | + if ( ! empty( $template_file ) ) { |
|
758 | 758 | |
759 | 759 | if ( $require_once ) { |
760 | 760 | require_once( $template_file ); |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function render_widget_hooks( $view_id ) { |
773 | 773 | |
774 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
774 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
775 | 775 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
776 | 776 | return; |
777 | 777 | } |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | $view_data = gravityview_get_current_view_data( $view_id ); |
780 | 780 | |
781 | 781 | // get View widget configuration |
782 | - $widgets = (array)$view_data['widgets']; |
|
782 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
783 | 783 | |
784 | - switch( current_filter() ) { |
|
784 | + switch ( current_filter() ) { |
|
785 | 785 | default: |
786 | 786 | case 'gravityview_before': |
787 | 787 | $zone = 'header'; |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | * Filter widgets not in the current zone |
796 | 796 | * @since 1.16 |
797 | 797 | */ |
798 | - foreach( $widgets as $key => $widget ) { |
|
798 | + foreach ( $widgets as $key => $widget ) { |
|
799 | 799 | // The widget isn't in the current zone |
800 | - if( false === strpos( $key, $zone ) ) { |
|
800 | + if ( false === strpos( $key, $zone ) ) { |
|
801 | 801 | unset( $widgets[ $key ] ); |
802 | 802 | } |
803 | 803 | } |
@@ -812,8 +812,8 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | // Prevent being called twice |
815 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
816 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
815 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
816 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
817 | 817 | return; |
818 | 818 | } |
819 | 819 | |
@@ -826,17 +826,17 @@ discard block |
||
826 | 826 | ?> |
827 | 827 | <div class="gv-grid"> |
828 | 828 | <?php |
829 | - foreach( $rows as $row ) { |
|
830 | - foreach( $row as $col => $areas ) { |
|
831 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
829 | + foreach ( $rows as $row ) { |
|
830 | + foreach ( $row as $col => $areas ) { |
|
831 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
832 | 832 | ?> |
833 | 833 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
834 | 834 | <?php |
835 | - if( !empty( $areas ) ) { |
|
836 | - foreach( $areas as $area ) { |
|
837 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
838 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
839 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
835 | + if ( ! empty( $areas ) ) { |
|
836 | + foreach ( $areas as $area ) { |
|
837 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
838 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
839 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
@@ -852,8 +852,8 @@ discard block |
||
852 | 852 | * Prevent widgets from being called twice. |
853 | 853 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
854 | 854 | */ |
855 | - if( did_action( 'loop_start' ) ) { |
|
856 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
855 | + if ( did_action( 'loop_start' ) ) { |
|
856 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
51 | 51 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
52 | 52 | |
53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
53 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
54 | 54 | |
55 | 55 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
56 | 56 | |
57 | 57 | //Hooks for no-conflict functionality |
58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
58 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
59 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
60 | 60 | |
61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
61 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
62 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
63 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
64 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | public function backend_actions() { |
75 | 75 | |
76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ |
77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
78 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
80 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
81 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
82 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
83 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
87 | 87 | * |
88 | 88 | * Nice place to insert extensions' backend stuff |
89 | 89 | */ |
90 | - do_action('gravityview_include_backend_actions'); |
|
90 | + do_action( 'gravityview_include_backend_actions' ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | |
104 | 104 | $actions = array(); |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
106 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
110 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return array_merge( $actions, $links ); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function post_updated_messages( $messages, $bulk_counts = NULL ) { |
132 | 132 | global $post; |
133 | 133 | |
134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
134 | + $post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
135 | 135 | |
136 | 136 | // By default, there will only be one item being modified. |
137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
138 | 138 | // of modified items that will override this array. |
139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
139 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
140 | 140 | |
141 | 141 | |
142 | 142 | // If we're starting fresh, a new form was created. |
@@ -145,53 +145,53 @@ discard block |
||
145 | 145 | |
146 | 146 | $new_form_text = ''; |
147 | 147 | |
148 | - if( !empty( $start_fresh ) ) { |
|
148 | + if ( ! empty( $start_fresh ) ) { |
|
149 | 149 | |
150 | 150 | // Get the form that was created |
151 | 151 | $connected_form = gravityview_get_form_id( $post_id ); |
152 | 152 | |
153 | - if( !empty( $connected_form ) ) { |
|
153 | + if ( ! empty( $connected_form ) ) { |
|
154 | 154 | $form = gravityview_get_form( $connected_form ); |
155 | - $form_name = esc_attr( $form['title'] ); |
|
155 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
156 | 156 | $image = self::get_floaty(); |
157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
158 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
157 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
158 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
159 | 159 | |
160 | 160 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
161 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
161 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
162 | 162 | $new_form_text = wpautop( $new_form_text ); |
163 | 163 | |
164 | 164 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $messages['gravityview'] = array( |
|
168 | + $messages[ 'gravityview' ] = array( |
|
169 | 169 | 0 => '', // Unused. Messages start at index 1. |
170 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
170 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
171 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | 3 => __( 'View deleted.', 'gravityview' ), |
173 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
173 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
174 | 174 | /* translators: %s: date and time of the revision */ |
175 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
176 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
176 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
177 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
178 | 178 | 8 => __( 'View submitted.', 'gravityview' ), |
179 | 179 | 9 => sprintf( |
180 | 180 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
181 | 181 | // translators: Publish box date format, see http://php.net/date |
182 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
182 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
183 | 183 | ) . $new_form_text, |
184 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
184 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * These apply to `bulk_post_updated_messages` |
188 | 188 | * @file wp-admin/edit.php |
189 | 189 | */ |
190 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
191 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
192 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
193 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
194 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
190 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
191 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
192 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
193 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
194 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | return $messages; |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | function no_conflict_scripts() { |
205 | 205 | global $wp_scripts; |
206 | 206 | |
207 | - if( ! gravityview_is_admin_page() ) { |
|
207 | + if ( ! gravityview_is_admin_page() ) { |
|
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
211 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
211 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
212 | 212 | |
213 | - if( empty( $no_conflict_mode ) ) { |
|
213 | + if ( empty( $no_conflict_mode ) ) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
@@ -260,24 +260,24 @@ discard block |
||
260 | 260 | function no_conflict_styles() { |
261 | 261 | global $wp_styles; |
262 | 262 | |
263 | - if( ! gravityview_is_admin_page() ) { |
|
263 | + if ( ! gravityview_is_admin_page() ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Dequeue other jQuery styles even if no-conflict is off. |
268 | 268 | // Terrible-looking tabs help no one. |
269 | - if( !empty( $wp_styles->registered ) ) { |
|
270 | - foreach ($wp_styles->registered as $key => $style) { |
|
271 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
269 | + if ( ! empty( $wp_styles->registered ) ) { |
|
270 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
271 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
272 | 272 | wp_dequeue_style( $key ); |
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
277 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
278 | 278 | |
279 | 279 | // If no conflict is off, jQuery will suffice. |
280 | - if( empty( $no_conflict_mode ) ) { |
|
280 | + if ( empty( $no_conflict_mode ) ) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
306 | 306 | */ |
307 | - do_action('gravityview_remove_conflicts_after'); |
|
307 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | |
327 | 327 | //reset queue |
328 | 328 | $queue = array(); |
329 | - foreach( $wp_objects->queue as $object ) { |
|
330 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | - $queue[] = $object; |
|
329 | + foreach ( $wp_objects->queue as $object ) { |
|
330 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | + $queue[ ] = $object; |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | $wp_objects->queue = $queue; |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | |
338 | 338 | //unregistering scripts |
339 | 339 | $registered = array(); |
340 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
341 | - if( in_array( $handle, $required_objects ) ){ |
|
340 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
341 | + if ( in_array( $handle, $required_objects ) ) { |
|
342 | 342 | $registered[ $handle ] = $script_registration; |
343 | 343 | } |
344 | 344 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param [type] $registered [description] |
352 | 352 | * @param [type] $scripts [description] |
353 | 353 | */ |
354 | - private function add_script_dependencies($registered, $scripts) { |
|
354 | + private function add_script_dependencies( $registered, $scripts ) { |
|
355 | 355 | |
356 | 356 | //gets all dependent scripts linked to the $scripts array passed |
357 | 357 | do { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
361 | 361 | foreach ( $deps as $dep ) { |
362 | 362 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
363 | - $dependents[] = $dep; |
|
363 | + $dependents[ ] = $dep; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -424,29 +424,29 @@ discard block |
||
424 | 424 | static function is_admin_page( $hook = '', $page = NULL ) { |
425 | 425 | global $current_screen, $plugin_page, $pagenow, $post; |
426 | 426 | |
427 | - if( ! is_admin() ) { return false; } |
|
427 | + if ( ! is_admin() ) { return false; } |
|
428 | 428 | |
429 | 429 | $is_page = false; |
430 | 430 | |
431 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
431 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
432 | 432 | |
433 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
433 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
434 | 434 | |
435 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
435 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
436 | 436 | |
437 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
438 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
439 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
437 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
438 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
439 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
440 | 440 | } else { |
441 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
441 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
442 | 442 | } |
443 | 443 | |
444 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
444 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
445 | 445 | |
446 | 446 | // $_GET `post_type` variable |
447 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
447 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
448 | 448 | $is_page = 'single'; |
449 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
449 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
450 | 450 | $is_page = 'settings'; |
451 | 451 | } else { |
452 | 452 | $is_page = 'views'; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
462 | 462 | |
463 | 463 | // If the current page is the same as the compared page |
464 | - if( !empty( $page ) ) { |
|
464 | + if ( ! empty( $page ) ) { |
|
465 | 465 | return $is_page === $page; |
466 | 466 | } |
467 | 467 | |
@@ -482,6 +482,6 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
484 | 484 | */ |
485 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
485 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
486 | 486 | return GravityView_Admin::is_admin_page( $hook, $page ); |
487 | 487 | } |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | function __construct() { |
16 | 16 | |
17 | 17 | // Only run on Admin |
18 | - if ( !is_admin() ) { |
|
18 | + if ( ! is_admin() ) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // If the Duplicate Post plugin is active, don't run. |
23 | - if( defined('DUPLICATE_POST_CURRENT_VERSION') ) { |
|
23 | + if ( defined( 'DUPLICATE_POST_CURRENT_VERSION' ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | global $post; |
61 | 61 | |
62 | 62 | // We only want to add Clone links to the Edit View metabox |
63 | - if( !$this->is_all_views_page() ) { |
|
63 | + if ( ! $this->is_all_views_page() ) { |
|
64 | 64 | |
65 | - if( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) { |
|
66 | - $links[] = '<span>' . $duplicate_links['edit_as_new_draft'] . '</span>'; |
|
65 | + if ( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) { |
|
66 | + $links[ ] = '<span>' . $duplicate_links[ 'edit_as_new_draft' ] . '</span>'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param string|null If string, the status to set for the new View. If empty, use existing View status. |
120 | 120 | * @param WP_Post $post View being cloned |
121 | 121 | */ |
122 | - $new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post ); |
|
122 | + $new_view_status = apply_filters( 'gravityview/duplicate-view/status', $status, $post ); |
|
123 | 123 | |
124 | 124 | $new_view = array( |
125 | 125 | 'menu_order' => $post->menu_order, |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param boolean $copy_date Whether the copy the date from the existing View. Default: `false` |
143 | 143 | * @param WP_Post $post View being cloned |
144 | 144 | */ |
145 | - $copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post ); |
|
145 | + $copy_date = apply_filters( 'gravityview/duplicate-view/copy-date', false, $post ); |
|
146 | 146 | |
147 | 147 | if ( $copy_date ) { |
148 | - $new_view['post_date'] = $new_post_date = $post->post_date; |
|
149 | - $new_view['post_date_gmt'] = get_gmt_from_date( $new_post_date ); |
|
148 | + $new_view[ 'post_date' ] = $new_post_date = $post->post_date; |
|
149 | + $new_view[ 'post_date_gmt' ] = get_gmt_from_date( $new_post_date ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param array $new_view Array of settings to be passed to wp_insert_post() |
156 | 156 | * @param WP_Post $post View being cloned |
157 | 157 | */ |
158 | - $new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post ); |
|
158 | + $new_view = apply_filters( 'gravityview/duplicate-view/new-view', $new_view, $post ); |
|
159 | 159 | |
160 | 160 | // Magic happens here. |
161 | 161 | $new_view_id = wp_insert_post( $new_view ); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | $clone_text = __( 'Clone', 'gravityview' ); |
238 | 238 | $clone_title = __( 'Clone this View', 'gravityview' ); |
239 | 239 | |
240 | - $actions['clone'] = gravityview_get_link( $clone_link, $clone_text, 'title='.$clone_title ); |
|
240 | + $actions[ 'clone' ] = gravityview_get_link( $clone_link, $clone_text, 'title=' . $clone_title ); |
|
241 | 241 | |
242 | 242 | $clone_draft_link = $this->get_clone_view_link( $post->ID ); |
243 | 243 | $clone_draft_text = $this->is_all_views_page() ? __( 'New Draft', 'gravityview' ) : __( 'Clone View', 'gravityview' ); |
244 | 244 | $clone_draft_title = __( 'Copy as a new draft View', 'gravityview' ); |
245 | 245 | |
246 | - $actions['edit_as_new_draft'] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title='.$clone_draft_title ); |
|
246 | + $actions[ 'edit_as_new_draft' ] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title=' . $clone_draft_title ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $actions; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | // Verify the View exists |
270 | - if ( !$view = get_post( $id ) ) { |
|
270 | + if ( ! $view = get_post( $id ) ) { |
|
271 | 271 | return ''; |
272 | 272 | } |
273 | 273 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $post_type_object = get_post_type_object( $view->post_type ); |
283 | 283 | |
284 | 284 | /** If there's no gravityview post type for some reason, abort! */ |
285 | - if ( !$post_type_object ) { |
|
285 | + if ( ! $post_type_object ) { |
|
286 | 286 | do_action( 'gravityview_log_error', __METHOD__ . ' No gravityview post type exists when trying to clone the View.', $view ); |
287 | 287 | return ''; |
288 | 288 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param int $view_id View ID |
295 | 295 | * @param string $context How to display the link. If "display", the URL is run through esc_html(). Default: `display` |
296 | 296 | */ |
297 | - $clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php". $action ), $view->ID, $context ); |
|
297 | + $clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php" . $action ), $view->ID, $context ); |
|
298 | 298 | |
299 | 299 | return $clone_view_link; |
300 | 300 | } |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function save_as_new_view( $status = '' ) { |
323 | 323 | |
324 | - if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) ) ) { |
|
324 | + if ( ! ( isset( $_GET[ 'post' ] ) || isset( $_POST[ 'post' ] ) ) ) { |
|
325 | 325 | wp_die( __( 'No post to duplicate has been supplied!', 'gravityview' ) ); |
326 | 326 | } |
327 | 327 | |
328 | 328 | // Get the original post |
329 | - $id = ( isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post'] ); |
|
329 | + $id = ( isset( $_GET[ 'post' ] ) ? $_GET[ 'post' ] : $_POST[ 'post' ] ); |
|
330 | 330 | |
331 | - if( ! $this->current_user_can_copy( $id ) ) { |
|
331 | + if ( ! $this->current_user_can_copy( $id ) ) { |
|
332 | 332 | wp_die( __( 'You don\'t have permission to copy this View.', 'gravityview' ) ); |
333 | 333 | } |
334 | 334 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param bool $esc_html Pass return value through `esc_html()` |
42 | 42 | * @return string Text with variables maybe replaced |
43 | 43 | */ |
44 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
44 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @internal Reported to GF Support on 12/3 |
66 | 66 | */ |
67 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
68 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
69 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
67 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
68 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
69 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
70 | 70 | |
71 | 71 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
72 | 72 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
89 | + public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @see GFCommon::replace_variables_prepopulate() |
95 | 95 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
96 | 96 | */ |
97 | - if( false === $form ) { |
|
97 | + if ( false === $form ) { |
|
98 | 98 | return $text; |
99 | 99 | } |
100 | 100 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
127 | 127 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
128 | 128 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
129 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
129 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
130 | 130 | ); |
131 | 131 | |
132 | 132 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
190 | 190 | |
191 | 191 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
192 | - if( empty( $matches ) ) { |
|
192 | + if ( empty( $matches ) ) { |
|
193 | 193 | return $text; |
194 | 194 | } |
195 | 195 | |
196 | 196 | foreach ( $matches as $match ) { |
197 | 197 | |
198 | - $full_tag = $match[0]; |
|
199 | - $property = $match[1]; |
|
198 | + $full_tag = $match[ 0 ]; |
|
199 | + $property = $match[ 1 ]; |
|
200 | 200 | |
201 | 201 | $value = stripslashes_deep( rgget( $property ) ); |
202 | 202 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @since 1.15 |
221 | 221 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
222 | 222 | */ |
223 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
223 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
224 | 224 | |
225 | 225 | $value = $esc_html ? esc_html( $value ) : $value; |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param[in] array $form Gravity Forms form array |
232 | 232 | * @param[in] array $entry Entry array |
233 | 233 | */ |
234 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
234 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
235 | 235 | |
236 | 236 | $text = str_replace( $full_tag, $value, $text ); |
237 | 237 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * @since 1.0 |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // Add help page to GravityView menu |
54 | 54 | add_submenu_page( |
55 | 55 | 'edit.php?post_type=gravityview', |
56 | - __('GravityView: Getting Started', 'gravityview'), |
|
57 | - __('Getting Started', 'gravityview'), |
|
56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
57 | + __( 'Getting Started', 'gravityview' ), |
|
58 | 58 | $this->minimum_capability, |
59 | 59 | 'gv-getting-started', |
60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return boolean $is_page True: yep; false: nope |
89 | 89 | */ |
90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
91 | 91 | global $plugin_page; |
92 | 92 | |
93 | - if($is_page) { return $is_page; } |
|
93 | + if ( $is_page ) { return $is_page; } |
|
94 | 94 | |
95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
110 | 110 | |
111 | - if( !$this->is_dashboard_page() ) { return; } |
|
111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
112 | 112 | |
113 | 113 | ?> |
114 | 114 | <style type="text/css" media="screen"> |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | // Don't fetch -beta, etc. |
142 | 142 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
143 | 143 | |
144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
144 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
145 | 145 | ?> |
146 | 146 | |
147 | 147 | <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
148 | 148 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
149 | 149 | |
150 | 150 | <h2 class="nav-tab-wrapper clear"> |
151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
152 | 152 | <?php _e( "Getting Started", 'gravityview' ); ?> |
153 | 153 | </a> |
154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
155 | 155 | <?php _e( "List of Changes", 'gravityview' ); ?> |
156 | 156 | </a> |
157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
158 | 158 | <?php _e( 'Credits', 'gravityview' ); ?> |
159 | 159 | </a> |
160 | 160 | </h2> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | <h2>Create a View</h2> |
191 | 191 | |
192 | 192 | <ol class="ol-decimal"> |
193 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
193 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
194 | 194 | <li>If you want to <strong>create a new form</strong>, click the "Start Fresh" button</li> |
195 | 195 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
196 | 196 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | </ul> |
526 | 526 | |
527 | 527 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
528 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
528 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
529 | 529 | </div> |
530 | 530 | </div> |
531 | 531 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | global $plugin_page; |
566 | 566 | |
567 | 567 | // Bail if we're just editing the plugin |
568 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
568 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
569 | 569 | |
570 | 570 | // Bail if no activation redirect |
571 | 571 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
577 | 577 | |
578 | 578 | // Don't do anything if they've already seen the new version info |
579 | - if( $upgrade === GravityView_Plugin::version ) { |
|
579 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
585 | 585 | |
586 | 586 | // Bail if activating from network, or bulk |
587 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
587 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
588 | 588 | |
589 | 589 | // First time install |
590 | - if( ! $upgrade ) { |
|
590 | + if ( ! $upgrade ) { |
|
591 | 591 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
592 | 592 | } |
593 | 593 | // Update |