@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
277 | 277 | * @access public |
278 | - * @return void|boolean |
|
278 | + * @return false|null |
|
279 | 279 | */ |
280 | 280 | public function process_bulk_action() { |
281 | 281 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
361 | 361 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
362 | 362 | * @param int $form_id The Gravity Forms Form ID |
363 | - * @return boolean|void |
|
363 | + * @return false|null |
|
364 | 364 | */ |
365 | 365 | private static function update_bulk( $entries, $approved, $form_id ) { |
366 | 366 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | * @access public |
610 | 610 | * @static |
611 | 611 | * @param mixed $form GF Form or Form ID |
612 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
612 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
613 | 613 | */ |
614 | 614 | static public function get_approved_column( $form ) { |
615 | 615 |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | /** gf_entries page - entries table screen */ |
44 | 44 | |
45 | 45 | // capture bulk actions |
46 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
46 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
47 | 47 | |
48 | 48 | // add hidden field with approve status |
49 | 49 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
50 | 50 | |
51 | 51 | // process ajax approve entry requests |
52 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
52 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
53 | 53 | |
54 | 54 | // when using the User opt-in field, check on entry submission |
55 | 55 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
56 | 56 | |
57 | 57 | // in case entry is edited (on admin or frontend) |
58 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
58 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
62 | 62 | |
63 | 63 | // adding styles and scripts |
64 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
64 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
65 | 65 | // bypass Gravity Forms no-conflict mode |
66 | 66 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
67 | 67 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
91 | 91 | * @param array $form GF Form object of current form |
92 | 92 | */ |
93 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
93 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
94 | 94 | return $filter_links; |
95 | 95 | } |
96 | 96 | |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | $approved_count = $disapproved_count = 0; |
112 | 112 | |
113 | 113 | // Only count if necessary |
114 | - if( $include_counts ) { |
|
115 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
116 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
114 | + if ( $include_counts ) { |
|
115 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
116 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
117 | 117 | } |
118 | 118 | |
119 | - $filter_links[] = array( |
|
119 | + $filter_links[ ] = array( |
|
120 | 120 | 'id' => 'gv_approved', |
121 | 121 | 'field_filters' => $field_filters_approved, |
122 | 122 | 'count' => $approved_count, |
123 | 123 | 'label' => esc_html__( 'Approved', 'gravityview' ), |
124 | 124 | ); |
125 | 125 | |
126 | - $filter_links[] = array( |
|
126 | + $filter_links[ ] = array( |
|
127 | 127 | 'id' => 'gv_disapproved', |
128 | 128 | 'field_filters' => $field_filters_disapproved, |
129 | 129 | 'count' => $disapproved_count, |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function tooltips( $tooltips ) { |
144 | 144 | |
145 | - $tooltips['form_gravityview_fields'] = array( |
|
146 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
147 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
145 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
146 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
147 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | return $tooltips; |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | |
256 | 256 | $gv_bulk_action = false; |
257 | 257 | |
258 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
259 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
258 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
259 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
260 | 260 | } else { |
261 | 261 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
262 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
262 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
266 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
266 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
267 | 267 | $gv_bulk_action = $bulk_action; |
268 | 268 | } |
269 | 269 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | // gforms_entry_list is the nonce that confirms we're on the right page |
290 | 290 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
291 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
291 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
292 | 292 | |
293 | 293 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
294 | 294 | |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | // All entries are set to be updated, not just the visible ones |
309 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
309 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
310 | 310 | |
311 | 311 | // Convert the current entry search into GF-formatted search criteria |
312 | 312 | $search = array( |
313 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
314 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
315 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
313 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
314 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
315 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
316 | 316 | ); |
317 | 317 | |
318 | 318 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } else { |
324 | 324 | |
325 | 325 | // Changed from 'lead' to 'entry' in 2.0 |
326 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
326 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
327 | 327 | |
328 | 328 | } |
329 | 329 | |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
336 | 336 | |
337 | 337 | switch ( $approved_status ) { |
338 | - case $this->bulk_action_prefixes['approve']: |
|
338 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
339 | 339 | self::update_bulk( $entries, 1, $form_id ); |
340 | 340 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
341 | 341 | break; |
342 | 342 | |
343 | - case $this->bulk_action_prefixes['unapprove']: |
|
343 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
344 | 344 | self::update_bulk( $entries, 0, $form_id ); |
345 | 345 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
346 | 346 | break; |
@@ -364,12 +364,12 @@ discard block |
||
364 | 364 | */ |
365 | 365 | private static function update_bulk( $entries, $approved, $form_id ) { |
366 | 366 | |
367 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
367 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
368 | 368 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
369 | 369 | return false; |
370 | 370 | } |
371 | 371 | |
372 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
372 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
373 | 373 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
374 | 374 | return false; |
375 | 375 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | // calculate approved field id once instead of looping through in the update_approved() method |
380 | 380 | $approved_column_id = self::get_approved_column( $form_id ); |
381 | 381 | |
382 | - foreach( $entries as $entry_id ) { |
|
382 | + foreach ( $entries as $entry_id ) { |
|
383 | 383 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
384 | 384 | } |
385 | 385 | } |
@@ -398,14 +398,14 @@ discard block |
||
398 | 398 | * @param int $approvedcolumn (default: 0) |
399 | 399 | * @return boolean True: It worked; False: it failed |
400 | 400 | */ |
401 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
401 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
402 | 402 | |
403 | - if( !class_exists( 'GFAPI' ) ) { |
|
403 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
404 | 404 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
405 | 405 | return false; |
406 | 406 | } |
407 | 407 | |
408 | - if( empty( $approvedcolumn ) ) { |
|
408 | + if ( empty( $approvedcolumn ) ) { |
|
409 | 409 | $approvedcolumn = self::get_approved_column( $form_id ); |
410 | 410 | } |
411 | 411 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | self::update_approved_meta( $entry_id, $approved, $form_id ); |
425 | 425 | |
426 | 426 | // add note to entry |
427 | - if( $result === true ) { |
|
427 | + if ( $result === true ) { |
|
428 | 428 | |
429 | 429 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
430 | 430 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | */ |
436 | 436 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
437 | 437 | |
438 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
438 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
439 | 439 | $current_user = wp_get_current_user(); |
440 | 440 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
441 | 441 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | do_action( 'gravityview_clear_form_cache', $form_id ); |
449 | 449 | |
450 | - } else if( is_wp_error( $result ) ) { |
|
450 | + } else if ( is_wp_error( $result ) ) { |
|
451 | 451 | |
452 | 452 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
453 | 453 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * @param $form array Gravity Forms form object |
469 | 469 | */ |
470 | 470 | public function after_submission( $entry, $form ) { |
471 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
471 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | |
@@ -484,18 +484,18 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
486 | 486 | |
487 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
487 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
488 | 488 | |
489 | 489 | /** |
490 | 490 | * If the form doesn't contain the approve field, don't assume anything. |
491 | 491 | */ |
492 | - if( empty( $approvedcolumn ) ) { |
|
492 | + if ( empty( $approvedcolumn ) ) { |
|
493 | 493 | return; |
494 | 494 | } |
495 | 495 | |
496 | 496 | $entry = GFAPI::get_entry( $entry_id ); |
497 | 497 | |
498 | - self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form['id'] ); |
|
498 | + self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form[ 'id' ] ); |
|
499 | 499 | |
500 | 500 | } |
501 | 501 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $is_approved = empty( $is_approved ) ? 0 : 'Approved'; |
521 | 521 | |
522 | 522 | // update entry meta |
523 | - if( function_exists('gform_update_meta') ) { |
|
523 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
524 | 524 | |
525 | 525 | gform_update_meta( $entry_id, 'is_approved', $is_approved, $form_id ); |
526 | 526 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | */ |
533 | 533 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
534 | 534 | |
535 | - if( empty( $is_approved ) ) { |
|
535 | + if ( empty( $is_approved ) ) { |
|
536 | 536 | |
537 | 537 | /** |
538 | 538 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | } else { |
556 | 556 | |
557 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
557 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
558 | 558 | |
559 | 559 | } |
560 | 560 | } |
@@ -566,21 +566,21 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function ajax_update_approved() { |
568 | 568 | |
569 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
569 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
570 | 570 | |
571 | 571 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
572 | 572 | |
573 | 573 | $result = false; |
574 | 574 | } |
575 | 575 | |
576 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
576 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
577 | 577 | |
578 | 578 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
579 | 579 | |
580 | 580 | $result = false; |
581 | 581 | } |
582 | 582 | |
583 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
583 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
584 | 584 | |
585 | 585 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
586 | 586 | |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | |
590 | 590 | else { |
591 | 591 | |
592 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
592 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
593 | 593 | |
594 | - if( is_wp_error( $result ) ) { |
|
594 | + if ( is_wp_error( $result ) ) { |
|
595 | 595 | /** @var WP_Error $result */ |
596 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
596 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
597 | 597 | $result = false; |
598 | 598 | } |
599 | 599 | |
@@ -613,29 +613,29 @@ discard block |
||
613 | 613 | */ |
614 | 614 | static public function get_approved_column( $form ) { |
615 | 615 | |
616 | - if( empty( $form ) ) { |
|
616 | + if ( empty( $form ) ) { |
|
617 | 617 | return null; |
618 | 618 | } |
619 | 619 | |
620 | - if( !is_array( $form ) ) { |
|
620 | + if ( ! is_array( $form ) ) { |
|
621 | 621 | $form = GVCommon::get_form( $form ); |
622 | 622 | } |
623 | 623 | |
624 | - foreach( $form['fields'] as $key => $field ) { |
|
624 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
625 | 625 | |
626 | - $field = (array) $field; |
|
626 | + $field = (array)$field; |
|
627 | 627 | |
628 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
629 | - if( !empty($field['inputs'][0]['id']) ) { |
|
630 | - return $field['inputs'][0]['id']; |
|
628 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
629 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
630 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | 634 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
635 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
636 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
637 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
638 | - return $input['id']; |
|
635 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
636 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
637 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
638 | + return $input[ 'id' ]; |
|
639 | 639 | } |
640 | 640 | } |
641 | 641 | } |
@@ -657,18 +657,18 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
660 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
661 | 661 | |
662 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
662 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
663 | 663 | return; |
664 | 664 | } |
665 | 665 | |
666 | - if( empty( $entry['id'] ) ) { |
|
666 | + if ( empty( $entry[ 'id' ] ) ) { |
|
667 | 667 | return; |
668 | 668 | } |
669 | 669 | |
670 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
671 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
670 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
671 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | |
@@ -681,13 +681,13 @@ discard block |
||
681 | 681 | */ |
682 | 682 | private function get_form_id() { |
683 | 683 | |
684 | - $form_id = GFForms::get('id'); |
|
684 | + $form_id = GFForms::get( 'id' ); |
|
685 | 685 | |
686 | 686 | // If there are no forms identified, use the first form. That's how GF does it. |
687 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
687 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
688 | 688 | $forms = gravityview_get_forms(); |
689 | - if( !empty( $forms ) ) { |
|
690 | - $form_id = $forms[0]['id']; |
|
689 | + if ( ! empty( $forms ) ) { |
|
690 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
691 | 691 | } |
692 | 692 | } |
693 | 693 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | |
698 | 698 | function add_scripts_and_styles( $hook ) { |
699 | 699 | |
700 | - if( ! class_exists( 'RGForms' ) ) { |
|
700 | + if ( ! class_exists( 'RGForms' ) ) { |
|
701 | 701 | |
702 | 702 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
703 | 703 | |
@@ -706,29 +706,29 @@ discard block |
||
706 | 706 | |
707 | 707 | // enqueue styles & scripts gf_entries |
708 | 708 | // But only if we're on the main Entries page, not on reports pages |
709 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
709 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
710 | 710 | return; |
711 | 711 | } |
712 | 712 | |
713 | 713 | $form_id = $this->get_form_id(); |
714 | 714 | |
715 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
715 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
716 | 716 | |
717 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
717 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
718 | 718 | |
719 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
719 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
720 | 720 | |
721 | 721 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
722 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
722 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
723 | 723 | 'form_id' => $form_id, |
724 | 724 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
725 | 725 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
726 | 726 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
727 | 727 | 'bulk_message' => $this->bulk_update_message, |
728 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
729 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
730 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
731 | - 'column_link' => esc_url( add_query_arg( array('sort' => self::get_approved_column( $form_id ) ) ) ), |
|
728 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
729 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
730 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
731 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => self::get_approved_column( $form_id ) ) ) ), |
|
732 | 732 | ) ); |
733 | 733 | |
734 | 734 | } |
@@ -748,11 +748,11 @@ discard block |
||
748 | 748 | 'GravityView' => array( |
749 | 749 | array( |
750 | 750 | 'label' => __( 'Approve', 'gravityview' ), |
751 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
751 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
752 | 752 | ), |
753 | 753 | array( |
754 | 754 | 'label' => __( 'Disapprove', 'gravityview' ), |
755 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
755 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
756 | 756 | ), |
757 | 757 | ), |
758 | 758 | ); |
@@ -769,8 +769,8 @@ discard block |
||
769 | 769 | // Sanitize the values, just to be sure. |
770 | 770 | foreach ( $bulk_actions as $key => $group ) { |
771 | 771 | foreach ( $group as $i => $action ) { |
772 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
773 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
772 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
773 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
774 | 774 | } |
775 | 775 | } |
776 | 776 | |
@@ -795,13 +795,13 @@ discard block |
||
795 | 795 | * @since 1.7.2 |
796 | 796 | * @param boolean $hide_if_no_connections |
797 | 797 | */ |
798 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
798 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
799 | 799 | |
800 | - if( $hide_if_no_connections ) { |
|
800 | + if ( $hide_if_no_connections ) { |
|
801 | 801 | |
802 | 802 | $connected_views = gravityview_get_connected_views( $form_id ); |
803 | 803 | |
804 | - if( empty( $connected_views ) ) { |
|
804 | + if ( empty( $connected_views ) ) { |
|
805 | 805 | $show_approve_column = false; |
806 | 806 | } |
807 | 807 | } |
@@ -811,18 +811,18 @@ discard block |
||
811 | 811 | * @param boolean $show_approve_column Whether the column will be shown |
812 | 812 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
813 | 813 | */ |
814 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
814 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
815 | 815 | |
816 | 816 | return $show_approve_column; |
817 | 817 | } |
818 | 818 | |
819 | 819 | function register_gform_noconflict_script( $scripts ) { |
820 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
820 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
821 | 821 | return $scripts; |
822 | 822 | } |
823 | 823 | |
824 | 824 | function register_gform_noconflict_style( $styles ) { |
825 | - $styles[] = 'gravityview_entries_list'; |
|
825 | + $styles[ ] = 'gravityview_entries_list'; |
|
826 | 826 | return $styles; |
827 | 827 | } |
828 | 828 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Sets the single entry ID and also the entry |
153 | - * @param bool|int|string $single_entry |
|
153 | + * @param boolean|string $single_entry |
|
154 | 154 | */ |
155 | 155 | public function setSingleEntry( $single_entry ) { |
156 | 156 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Set the current entry |
170 | - * @param array|int $entry Entry array or entry slug or ID |
|
170 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
171 | 171 | */ |
172 | 172 | public function setEntry( $entry ) { |
173 | 173 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * |
227 | 227 | * |
228 | - * @param null $view_id |
|
228 | + * @param string $view_id |
|
229 | 229 | */ |
230 | 230 | public function set_context_view_id( $view_id = null ) { |
231 | 231 | |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | * |
958 | 958 | * @uses gravityview_get_entries() |
959 | 959 | * @access public |
960 | - * @param array $args\n |
|
960 | + * @param array $args |
|
961 | 961 | * - $id - View id |
962 | 962 | * - $page_size - Page |
963 | 963 | * - $sort_field - form field id to sort |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | /** |
1414 | 1414 | * Checks if field (column) is sortable |
1415 | 1415 | * |
1416 | - * @param string $field Field settings |
|
1416 | + * @param string $field_id Field settings |
|
1417 | 1417 | * @param array $form Gravity Forms form array |
1418 | 1418 | * |
1419 | 1419 | * @since 1.7 |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | |
147 | 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 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | - // replaced by a multiple-word value that should be output as a single class. |
|
155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
153 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | + // replaced by a multiple-word value that should be output as a single class. |
|
155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
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 | - // And then we want life to return to normal |
|
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | - } |
|
160 | + // And then we want life to return to normal |
|
161 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | 'format' => $format, |
278 | 278 | 'entry' => $entry, |
279 | 279 | 'field_type' => $field_type, /** {@since 1.6} */ |
280 | - 'field_path' => $field_path, /** {@since 1.16} */ |
|
280 | + 'field_path' => $field_path, /** {@since 1.16} */ |
|
281 | 281 | )); |
282 | 282 | |
283 | 283 | if( ! empty( $field_path ) ) { |
@@ -594,32 +594,32 @@ discard block |
||
594 | 594 | return sanitize_title( $slug ); |
595 | 595 | } |
596 | 596 | |
597 | - /** |
|
598 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
599 | - * |
|
600 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
601 | - * |
|
602 | - * @param $entry array Gravity Forms entry object |
|
603 | - * @param $form array Gravity Forms form object |
|
604 | - */ |
|
605 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
606 | - /** |
|
607 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
608 | - * @param boolean $custom Should we process the custom entry slug? |
|
609 | - */ |
|
610 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
611 | - if( $custom ) { |
|
612 | - // create the gravityview_unique_id and save it |
|
597 | + /** |
|
598 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
599 | + * |
|
600 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
601 | + * |
|
602 | + * @param $entry array Gravity Forms entry object |
|
603 | + * @param $form array Gravity Forms form object |
|
604 | + */ |
|
605 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
606 | + /** |
|
607 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
608 | + * @param boolean $custom Should we process the custom entry slug? |
|
609 | + */ |
|
610 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
611 | + if( $custom ) { |
|
612 | + // create the gravityview_unique_id and save it |
|
613 | 613 | |
614 | - // Get the entry hash |
|
615 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
614 | + // Get the entry hash |
|
615 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
616 | 616 | |
617 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash ); |
|
617 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash ); |
|
618 | 618 | |
619 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
619 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
620 | 620 | |
621 | - } |
|
622 | - } |
|
621 | + } |
|
622 | + } |
|
623 | 623 | |
624 | 624 | |
625 | 625 | |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | |
896 | 896 | // If there was an error, continue to the next term. |
897 | 897 | if ( is_wp_error( $term_link ) ) { |
898 | - continue; |
|
898 | + continue; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -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 | |
@@ -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,17 +219,17 @@ 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 | - $field_id = $field_settings['id']; |
|
228 | + $field_id = $field_settings[ 'id' ]; |
|
229 | 229 | $form = $gravityview_view->getForm(); |
230 | 230 | $field = gravityview_get_field( $form, $field_id ); |
231 | 231 | |
232 | - if( $field && is_numeric( $field_id ) ) { |
|
232 | + if ( $field && is_numeric( $field_id ) ) { |
|
233 | 233 | // Used as file name of field template in GV. |
234 | 234 | // Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field |
235 | 235 | $field_type = $field->type; |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // If a Gravity Forms Field is found, get the field display |
243 | - if( $field ) { |
|
243 | + if ( $field ) { |
|
244 | 244 | |
245 | 245 | // Prevent any PHP warnings that may be generated |
246 | 246 | ob_start(); |
247 | 247 | |
248 | - $display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format ); |
|
248 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
249 | 249 | |
250 | 250 | if ( $errors = ob_get_clean() ) { |
251 | 251 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
255 | 255 | |
256 | 256 | // prevent the use of merge_tags for non-admin fields |
257 | - if( !empty( $field->adminOnly ) ) { |
|
257 | + if ( ! empty( $field->adminOnly ) ) { |
|
258 | 258 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
259 | 259 | } |
260 | 260 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | // Check whether the field exists in /includes/fields/{$field_type}.php |
266 | 266 | // This can be overridden by user template files. |
267 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
267 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
268 | 268 | |
269 | 269 | // Set the field data to be available in the templates |
270 | 270 | $gravityview_view->setCurrentField( array( |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | 'entry' => $entry, |
279 | 279 | 'field_type' => $field_type, /** {@since 1.6} */ |
280 | 280 | 'field_path' => $field_path, /** {@since 1.16} */ |
281 | - )); |
|
281 | + ) ); |
|
282 | 282 | |
283 | - if( ! empty( $field_path ) ) { |
|
283 | + if ( ! empty( $field_path ) ) { |
|
284 | 284 | |
285 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
285 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
286 | 286 | |
287 | 287 | ob_start(); |
288 | 288 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | // Get the field settings again so that the field template can override the settings |
301 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
301 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * @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` |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
317 | 317 | * |
318 | 318 | */ |
319 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
319 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
320 | 320 | |
321 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
321 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
322 | 322 | |
323 | 323 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
324 | 324 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $field_settings Settings for the particular GV field |
333 | 333 | * @param array $field Current field being displayed |
334 | 334 | */ |
335 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
335 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
363 | 363 | |
364 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
364 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
365 | 365 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
366 | 366 | return NULL; |
367 | 367 | } |
368 | 368 | |
369 | 369 | $href = self::entry_link( $entry ); |
370 | 370 | |
371 | - if( '' === $href ) { |
|
371 | + if ( '' === $href ) { |
|
372 | 372 | return NULL; |
373 | 373 | } |
374 | 374 | |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | * @param boolean $wpautop Apply wpautop() to the output? |
392 | 392 | * @return string HTML of "no results" text |
393 | 393 | */ |
394 | - public static function no_results($wpautop = true) { |
|
394 | + public static function no_results( $wpautop = true ) { |
|
395 | 395 | $gravityview_view = GravityView_View::getInstance(); |
396 | 396 | |
397 | 397 | $is_search = false; |
398 | 398 | |
399 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
399 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
400 | 400 | $is_search = true; |
401 | 401 | } |
402 | 402 | |
403 | - if($is_search) { |
|
404 | - $output = __('This search returned no results.', 'gravityview'); |
|
403 | + if ( $is_search ) { |
|
404 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
405 | 405 | } else { |
406 | - $output = __('No entries match your request.', 'gravityview'); |
|
406 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -411,9 +411,9 @@ discard block |
||
411 | 411 | * @param string $output The existing "No Entries" text |
412 | 412 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
413 | 413 | */ |
414 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
414 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
415 | 415 | |
416 | - return $wpautop ? wpautop($output) : $output; |
|
416 | + return $wpautop ? wpautop( $output ) : $output; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
@@ -430,37 +430,37 @@ discard block |
||
430 | 430 | |
431 | 431 | $gravityview_view = GravityView_View::getInstance(); |
432 | 432 | |
433 | - if( empty( $post_id ) ) { |
|
433 | + if ( empty( $post_id ) ) { |
|
434 | 434 | |
435 | 435 | $post_id = false; |
436 | 436 | |
437 | 437 | // DataTables passes the Post ID |
438 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
438 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
439 | 439 | |
440 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
440 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
441 | 441 | |
442 | 442 | } else { |
443 | 443 | |
444 | 444 | // The Post ID has been passed via the shortcode |
445 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
445 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
446 | 446 | |
447 | 447 | $post_id = $gravityview_view->getPostId(); |
448 | 448 | |
449 | 449 | } else { |
450 | 450 | |
451 | 451 | // This is a GravityView post type |
452 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
452 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
453 | 453 | |
454 | 454 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
455 | 455 | |
456 | 456 | } else { |
457 | 457 | |
458 | 458 | // This is an embedded GravityView; use the embedded post's ID as the base. |
459 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
459 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
460 | 460 | |
461 | 461 | $post_id = $post->ID; |
462 | 462 | |
463 | - } elseif( $gravityview_view->getViewId() ) { |
|
463 | + } elseif ( $gravityview_view->getViewId() ) { |
|
464 | 464 | |
465 | 465 | // The GravityView has been embedded in a widget or in a template, and |
466 | 466 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -475,36 +475,36 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | // No post ID, get outta here. |
478 | - if( empty( $post_id ) ) { |
|
478 | + if ( empty( $post_id ) ) { |
|
479 | 479 | return NULL; |
480 | 480 | } |
481 | 481 | |
482 | 482 | // If we've saved the permalink in memory, use it |
483 | 483 | // @since 1.3 |
484 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
484 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
485 | 485 | |
486 | - if( empty( $link ) ) { |
|
486 | + if ( empty( $link ) ) { |
|
487 | 487 | |
488 | 488 | $link = get_permalink( $post_id ); |
489 | 489 | |
490 | 490 | // If not yet saved, cache the permalink. |
491 | 491 | // @since 1.3 |
492 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
492 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | 496 | // Deal with returning to proper pagination for embedded views |
497 | - if( $link && $add_query_args ) { |
|
497 | + if ( $link && $add_query_args ) { |
|
498 | 498 | |
499 | 499 | $args = array(); |
500 | 500 | |
501 | - if( $pagenum = rgget('pagenum') ) { |
|
502 | - $args['pagenum'] = intval( $pagenum ); |
|
501 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
502 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
503 | 503 | } |
504 | 504 | |
505 | - if( $sort = rgget('sort') ) { |
|
506 | - $args['sort'] = $sort; |
|
507 | - $args['dir'] = rgget('dir'); |
|
505 | + if ( $sort = rgget( 'sort' ) ) { |
|
506 | + $args[ 'sort' ] = $sort; |
|
507 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | $link = add_query_arg( $args, $link ); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
528 | 528 | |
529 | 529 | // Generate an unique hash to use as the default value |
530 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
530 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
531 | 531 | |
532 | 532 | /** |
533 | 533 | * @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}` |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
539 | 539 | |
540 | 540 | // Make sure we have something - use the original ID as backup. |
541 | - if( empty( $slug ) ) { |
|
541 | + if ( empty( $slug ) ) { |
|
542 | 542 | $slug = $id; |
543 | 543 | } |
544 | 544 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
568 | 568 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
569 | 569 | */ |
570 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
570 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
571 | 571 | |
572 | 572 | // If we're using custom slug... |
573 | 573 | if ( $custom ) { |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | // If it does have a hash set, and the hash is expected, use it. |
582 | 582 | // This check allows users to change the hash structure using the |
583 | 583 | // gravityview_entry_hash filter and have the old hashes expire. |
584 | - if( empty( $value ) || $value !== $hash ) { |
|
585 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash ); |
|
584 | + if ( empty( $value ) || $value !== $hash ) { |
|
585 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash ); |
|
586 | 586 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
587 | 587 | } |
588 | 588 | |
@@ -608,15 +608,15 @@ discard block |
||
608 | 608 | * @param boolean $custom Should we process the custom entry slug? |
609 | 609 | */ |
610 | 610 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
611 | - if( $custom ) { |
|
611 | + if ( $custom ) { |
|
612 | 612 | // create the gravityview_unique_id and save it |
613 | 613 | |
614 | 614 | // Get the entry hash |
615 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
615 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
616 | 616 | |
617 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash ); |
|
617 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash ); |
|
618 | 618 | |
619 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
619 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
620 | 620 | |
621 | 621 | } |
622 | 622 | } |
@@ -633,14 +633,14 @@ discard block |
||
633 | 633 | */ |
634 | 634 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
635 | 635 | |
636 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
636 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
637 | 637 | $entry = GVCommon::get_entry( $entry ); |
638 | - } else if( empty( $entry ) ) { |
|
638 | + } else if ( empty( $entry ) ) { |
|
639 | 639 | $entry = GravityView_frontend::getInstance()->getEntry(); |
640 | 640 | } |
641 | 641 | |
642 | 642 | // Second parameter used to be passed as $field; this makes sure it's not an array |
643 | - if( !is_numeric( $post_id ) ) { |
|
643 | + if ( ! is_numeric( $post_id ) ) { |
|
644 | 644 | $post_id = NULL; |
645 | 645 | } |
646 | 646 | |
@@ -648,15 +648,15 @@ discard block |
||
648 | 648 | $directory_link = self::directory_link( $post_id, false ); |
649 | 649 | |
650 | 650 | // No post ID? Get outta here. |
651 | - if( empty( $directory_link ) ) { |
|
651 | + if ( empty( $directory_link ) ) { |
|
652 | 652 | return ''; |
653 | 653 | } |
654 | 654 | |
655 | 655 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
656 | 656 | |
657 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
657 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
658 | 658 | |
659 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
659 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
660 | 660 | |
661 | 661 | $args = array(); |
662 | 662 | |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | */ |
667 | 667 | $link_parts = explode( '?', $directory_link ); |
668 | 668 | |
669 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
669 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
670 | 670 | |
671 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
671 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
672 | 672 | |
673 | 673 | } else { |
674 | 674 | |
@@ -678,18 +678,18 @@ discard block |
||
678 | 678 | /** |
679 | 679 | * @since 1.7.3 |
680 | 680 | */ |
681 | - if( $add_directory_args ) { |
|
681 | + if ( $add_directory_args ) { |
|
682 | 682 | |
683 | - if( !empty( $_GET['pagenum'] ) ) { |
|
684 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
683 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
684 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
688 | 688 | * @since 1.7 |
689 | 689 | */ |
690 | - if( $sort = rgget('sort') ) { |
|
691 | - $args['sort'] = $sort; |
|
692 | - $args['dir'] = rgget('dir'); |
|
690 | + if ( $sort = rgget( 'sort' ) ) { |
|
691 | + $args[ 'sort' ] = $sort; |
|
692 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | } |
@@ -699,8 +699,8 @@ discard block |
||
699 | 699 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
700 | 700 | * @see GravityView_frontend::get_context_view_id() |
701 | 701 | */ |
702 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
703 | - $args['gvid'] = gravityview_get_view_id(); |
|
702 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
703 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | return add_query_arg( $args, $directory_link ); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | } |
719 | 719 | |
720 | 720 | function gv_class( $field, $form = NULL, $entry = array() ) { |
721 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
721 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | /** |
@@ -740,15 +740,15 @@ discard block |
||
740 | 740 | |
741 | 741 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
742 | 742 | |
743 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
743 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
744 | 744 | $default_css_class .= ' hidden'; |
745 | 745 | } |
746 | 746 | |
747 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
747 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
748 | 748 | $default_css_class .= ' gv-container-no-results'; |
749 | 749 | } |
750 | 750 | |
751 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
751 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
752 | 752 | |
753 | 753 | /** |
754 | 754 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | $css_class = gravityview_sanitize_html_class( $css_class ); |
761 | 761 | |
762 | - if( $echo ) { |
|
762 | + if ( $echo ) { |
|
763 | 763 | echo $css_class; |
764 | 764 | } |
765 | 765 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | $value = GravityView_API::field_value( $entry, $field ); |
772 | 772 | |
773 | - if( $value === '' ) { |
|
773 | + if ( $value === '' ) { |
|
774 | 774 | /** |
775 | 775 | * @filter `gravityview_empty_value` What to display when a field is empty |
776 | 776 | * @param string $value (empty string) |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | return GravityView_API::entry_link( $entry, $post_id ); |
790 | 790 | } |
791 | 791 | |
792 | -function gv_no_results($wpautop = true) { |
|
792 | +function gv_no_results( $wpautop = true ) { |
|
793 | 793 | return GravityView_API::no_results( $wpautop ); |
794 | 794 | } |
795 | 795 | |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | |
803 | 803 | $href = gv_directory_link(); |
804 | 804 | |
805 | - if( empty( $href ) ) { return NULL; } |
|
805 | + if ( empty( $href ) ) { return NULL; } |
|
806 | 806 | |
807 | 807 | // calculate link label |
808 | 808 | $gravityview_view = GravityView_View::getInstance(); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
820 | 820 | 'data-viewid' => $gravityview_view->getViewId() |
821 | - )); |
|
821 | + ) ); |
|
822 | 822 | |
823 | 823 | return $link; |
824 | 824 | } |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | */ |
838 | 838 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
839 | 839 | |
840 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
840 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
841 | 841 | |
842 | 842 | // For the complete field value as generated by Gravity Forms |
843 | 843 | return $display_value; |
@@ -867,16 +867,16 @@ discard block |
||
867 | 867 | |
868 | 868 | $terms = explode( ', ', $value ); |
869 | 869 | |
870 | - foreach ($terms as $term_name ) { |
|
870 | + foreach ( $terms as $term_name ) { |
|
871 | 871 | |
872 | 872 | // If we're processing a category, |
873 | - if( $taxonomy === 'category' ) { |
|
873 | + if ( $taxonomy === 'category' ) { |
|
874 | 874 | |
875 | 875 | // Use rgexplode to prevent errors if : doesn't exist |
876 | 876 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
877 | 877 | |
878 | 878 | // The explode was succesful; we have the category ID |
879 | - if( !empty( $term_id )) { |
|
879 | + if ( ! empty( $term_id ) ) { |
|
880 | 880 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
881 | 881 | } else { |
882 | 882 | // We have to fall back to the name |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | } |
890 | 890 | |
891 | 891 | // There's still a tag/category here. |
892 | - if( $term ) { |
|
892 | + if ( $term ) { |
|
893 | 893 | |
894 | 894 | $term_link = get_term_link( $term, $taxonomy ); |
895 | 895 | |
@@ -898,11 +898,11 @@ discard block |
||
898 | 898 | continue; |
899 | 899 | } |
900 | 900 | |
901 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
901 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
902 | 902 | } |
903 | 903 | } |
904 | 904 | |
905 | - return implode(', ', $output ); |
|
905 | + return implode( ', ', $output ); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | /** |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | |
917 | 917 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
918 | 918 | |
919 | - if( empty( $link ) ) { |
|
920 | - return strip_tags( $output); |
|
919 | + if ( empty( $link ) ) { |
|
920 | + return strip_tags( $output ); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | return $output; |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $fe = GravityView_frontend::getInstance(); |
937 | 937 | |
938 | 938 | // Solve problem when loading content via admin-ajax.php |
939 | - if( ! $fe->getGvOutputData() ) { |
|
939 | + if ( ! $fe->getGvOutputData() ) { |
|
940 | 940 | |
941 | 941 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
942 | 942 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | } |
945 | 945 | |
946 | 946 | // Make 100% sure that we're dealing with a properly called situation |
947 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
947 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
948 | 948 | |
949 | 949 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
950 | 950 | |
@@ -964,10 +964,10 @@ discard block |
||
964 | 964 | |
965 | 965 | $fe = GravityView_frontend::getInstance(); |
966 | 966 | |
967 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
967 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
968 | 968 | |
969 | 969 | // If not set, grab the current view ID |
970 | - if( empty( $view_id ) ) { |
|
970 | + if ( empty( $view_id ) ) { |
|
971 | 971 | $view_id = $fe->get_context_view_id(); |
972 | 972 | } |
973 | 973 | |
@@ -1032,11 +1032,11 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1034 | 1034 | |
1035 | - if( $is_edit_entry ) { |
|
1035 | + if ( $is_edit_entry ) { |
|
1036 | 1036 | $context = 'edit'; |
1037 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1037 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1038 | 1038 | $context = 'single'; |
1039 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1039 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1040 | 1040 | $context = GravityView_View::getInstance()->getContext(); |
1041 | 1041 | } |
1042 | 1042 | |
@@ -1064,12 +1064,12 @@ discard block |
||
1064 | 1064 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1065 | 1065 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1066 | 1066 | |
1067 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1068 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1067 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1068 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1072 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1071 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1072 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1147,12 +1147,12 @@ discard block |
||
1147 | 1147 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1148 | 1148 | |
1149 | 1149 | // Required fields. |
1150 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1150 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1151 | 1151 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1152 | 1152 | return ''; |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1155 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1156 | 1156 | |
1157 | 1157 | /** |
1158 | 1158 | * Create the content variables for replacing. |
@@ -1168,37 +1168,37 @@ discard block |
||
1168 | 1168 | 'field_id' => '', |
1169 | 1169 | ); |
1170 | 1170 | |
1171 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1171 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1172 | 1172 | |
1173 | 1173 | // If the value is empty and we're hiding empty, return empty. |
1174 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1174 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1175 | 1175 | return ''; |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1179 | - $context['value'] = wpautop( $context['value'] ); |
|
1178 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1179 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | // Get width setting, if exists |
1183 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1183 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1184 | 1184 | |
1185 | 1185 | // If replacing with CSS inline formatting, let's do it. |
1186 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1186 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1187 | 1187 | |
1188 | 1188 | // Grab the Class using `gv_class` |
1189 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1190 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1189 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1190 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1191 | 1191 | |
1192 | 1192 | // Get field label if needed |
1193 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1194 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1193 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1194 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | // Default Label value |
1198 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1198 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1199 | 1199 | |
1200 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1201 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1200 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1201 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | * @param string $markup The HTML for the markup |
1208 | 1208 | * @param array $args All args for the field output |
1209 | 1209 | */ |
1210 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1210 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1211 | 1211 | |
1212 | 1212 | /** |
1213 | 1213 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | foreach ( $context as $tag => $value ) { |
1231 | 1231 | |
1232 | 1232 | // If the tag doesn't exist just skip it |
1233 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1233 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1234 | 1234 | continue; |
1235 | 1235 | } |
1236 | 1236 |