@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | private function add_hooks() { |
40 | 40 | |
41 | 41 | // in case entry is edited (on admin or frontend) |
42 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
42 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
43 | 43 | |
44 | 44 | // when using the User opt-in field, check on entry submission |
45 | 45 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
46 | 46 | |
47 | 47 | // process ajax approve entry requests |
48 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
48 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
49 | 49 | |
50 | 50 | // autounapprove |
51 | 51 | add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 ); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
97 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
98 | 98 | |
99 | 99 | if ( ! $form ) { |
100 | - gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) ); |
|
100 | + gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) ); |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function add_approval_notification_events( $notification_events = array(), $form = array() ) { |
116 | 116 | |
117 | - $notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
118 | - $notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
119 | - $notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
120 | - $notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
117 | + $notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
118 | + $notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
119 | + $notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
120 | + $notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
121 | 121 | |
122 | 122 | return $notification_events; |
123 | 123 | } |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public static function get_entry_status( $entry, $value_or_label = 'label' ) { |
137 | 137 | |
138 | - $entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true ); |
|
138 | + $entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true ); |
|
139 | 139 | |
140 | 140 | $status = gform_get_meta( $entry_id, self::meta_key ); |
141 | 141 | |
142 | 142 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
143 | 143 | |
144 | - if( 'value' === $value_or_label ) { |
|
144 | + if ( 'value' === $value_or_label ) { |
|
145 | 145 | return $status; |
146 | 146 | } |
147 | 147 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $nonce = \GV\Utils::_POST( 'nonce' ); |
180 | 180 | |
181 | 181 | // Valid status |
182 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
182 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
183 | 183 | |
184 | 184 | gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) ); |
185 | 185 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
212 | 212 | |
213 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
213 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
214 | 214 | |
215 | 215 | } |
216 | 216 | |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // Set default |
275 | - self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] ); |
|
275 | + self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] ); |
|
276 | 276 | |
277 | 277 | // Then check for if there is an approval column, and use that value instead |
278 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
278 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
291 | 291 | |
292 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
292 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * If the form doesn't contain the approve field, don't assume anything. |
296 | 296 | */ |
297 | - if( empty( $approved_column ) ) { |
|
297 | + if ( empty( $approved_column ) ) { |
|
298 | 298 | return; |
299 | 299 | } |
300 | 300 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | $value = apply_filters( 'gravityview/approve_entries/update_unapproved_meta', $value, $form, $entry ); |
318 | 318 | |
319 | - self::update_approved_meta( $entry_id, $value, $form['id'] ); |
|
319 | + self::update_approved_meta( $entry_id, $value, $form[ 'id' ] ); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public static function update_bulk( $entries = array(), $approved = 0, $form_id = 0 ) { |
336 | 336 | |
337 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
337 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
338 | 338 | gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) ); |
339 | 339 | return NULL; |
340 | 340 | } |
341 | 341 | |
342 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
342 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
343 | 343 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
344 | 344 | return NULL; |
345 | 345 | } |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | $approved_column_id = self::get_approved_column( $form_id ); |
355 | 355 | |
356 | 356 | $success = true; |
357 | - foreach( $entries as $entry_id ) { |
|
357 | + foreach ( $entries as $entry_id ) { |
|
358 | 358 | $update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
359 | 359 | |
360 | - if( ! $update_success ) { |
|
360 | + if ( ! $update_success ) { |
|
361 | 361 | $success = false; |
362 | 362 | } |
363 | 363 | } |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) { |
383 | 383 | |
384 | - if( !class_exists( 'GFAPI' ) ) { |
|
384 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
385 | 385 | gravityview()->log->error( 'GFAPI does not exist' ); |
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
389 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
390 | 390 | gravityview()->log->error( 'Not a valid approval value.' ); |
391 | 391 | return false; |
392 | 392 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | // If the form has an Approve/Reject field, update that value |
404 | 404 | $result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn ); |
405 | 405 | |
406 | - if( is_wp_error( $result ) ) { |
|
406 | + if ( is_wp_error( $result ) ) { |
|
407 | 407 | gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) ); |
408 | 408 | return false; |
409 | 409 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | |
416 | 416 | // add note to entry if approval field updating worked or there was no approved field |
417 | 417 | // There's no validation for the meta |
418 | - if( true === $result ) { |
|
418 | + if ( true === $result ) { |
|
419 | 419 | |
420 | 420 | // Add an entry note |
421 | 421 | self::add_approval_status_updated_note( $entry_id, $approved ); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | $note_id = false; |
470 | 470 | |
471 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
471 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
472 | 472 | |
473 | 473 | $current_user = wp_get_current_user(); |
474 | 474 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
492 | 492 | |
493 | - if( empty( $approvedcolumn ) ) { |
|
493 | + if ( empty( $approvedcolumn ) ) { |
|
494 | 494 | $approvedcolumn = self::get_approved_column( $form_id ); |
495 | 495 | } |
496 | 496 | |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
514 | 514 | |
515 | 515 | $new_value = ''; |
516 | - if( GravityView_Entry_Approval_Status::APPROVED === $status ) { |
|
516 | + if ( GravityView_Entry_Approval_Status::APPROVED === $status ) { |
|
517 | 517 | $new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn ); |
518 | 518 | } |
519 | 519 | |
520 | 520 | //update entry |
521 | - $entry["{$approvedcolumn}"] = $new_value; |
|
521 | + $entry[ "{$approvedcolumn}" ] = $new_value; |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | // If the user has enabled a different value than the label (for some reason), use it. |
550 | 550 | // This is highly unlikely |
551 | 551 | if ( is_array( $field->choices ) && ! empty( $field->choices ) ) { |
552 | - return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text']; |
|
552 | + return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ]; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | // Otherwise, fall back on the inputs array |
556 | 556 | if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) { |
557 | - return $field->inputs[0]['label']; |
|
557 | + return $field->inputs[ 0 ][ 'label' ]; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | return null; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * @since 1.18 Added "unapproved" |
607 | 607 | * @param int $entry_id ID of the Gravity Forms entry |
608 | 608 | */ |
609 | - do_action( 'gravityview/approve_entries/' . $action , $entry_id ); |
|
609 | + do_action( 'gravityview/approve_entries/' . $action, $entry_id ); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
@@ -619,11 +619,11 @@ discard block |
||
619 | 619 | */ |
620 | 620 | static public function get_approved_column( $form ) { |
621 | 621 | |
622 | - if( empty( $form ) ) { |
|
622 | + if ( empty( $form ) ) { |
|
623 | 623 | return null; |
624 | 624 | } |
625 | 625 | |
626 | - if( !is_array( $form ) ) { |
|
626 | + if ( ! is_array( $form ) ) { |
|
627 | 627 | $form = GVCommon::get_form( $form ); |
628 | 628 | } |
629 | 629 | |
@@ -633,22 +633,22 @@ discard block |
||
633 | 633 | * @var string $key |
634 | 634 | * @var GF_Field $field |
635 | 635 | */ |
636 | - foreach( $form['fields'] as $key => $field ) { |
|
636 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
637 | 637 | |
638 | 638 | $inputs = $field->get_entry_inputs(); |
639 | 639 | |
640 | - if( !empty( $field->gravityview_approved ) ) { |
|
641 | - if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) { |
|
642 | - $approved_column_id = $inputs[0]['id']; |
|
640 | + if ( ! empty( $field->gravityview_approved ) ) { |
|
641 | + if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) { |
|
642 | + $approved_column_id = $inputs[ 0 ][ 'id' ]; |
|
643 | 643 | break; |
644 | 644 | } |
645 | 645 | } |
646 | 646 | |
647 | 647 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
648 | - if( 'checkbox' === $field->type && ! empty( $inputs ) ) { |
|
648 | + if ( 'checkbox' === $field->type && ! empty( $inputs ) ) { |
|
649 | 649 | foreach ( $inputs as $input ) { |
650 | - if ( 'approved' === strtolower( $input['label'] ) ) { |
|
651 | - $approved_column_id = $input['id']; |
|
650 | + if ( 'approved' === strtolower( $input[ 'label' ] ) ) { |
|
651 | + $approved_column_id = $input[ 'id' ]; |
|
652 | 652 | break; |
653 | 653 | } |
654 | 654 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | |
675 | 675 | $view_keys = array_keys( $gv_data->get_views() ); |
676 | 676 | |
677 | - $view = \GV\View::by_id( $view_keys[0] ); |
|
677 | + $view = \GV\View::by_id( $view_keys[ 0 ] ); |
|
678 | 678 | |
679 | 679 | if ( ! $view->settings->get( 'unapprove_edit' ) ) { |
680 | 680 | return; |
@@ -699,11 +699,11 @@ discard block |
||
699 | 699 | return; |
700 | 700 | } |
701 | 701 | |
702 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
702 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
703 | 703 | $approval_status = GravityView_Entry_Approval_Status::UNAPPROVED; |
704 | 704 | } |
705 | 705 | |
706 | - self::update_approved_meta( $entry_id, $approval_status, $form['id'] ); |
|
706 | + self::update_approved_meta( $entry_id, $approval_status, $form[ 'id' ] ); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -741,9 +741,9 @@ discard block |
||
741 | 741 | $choices = GravityView_Entry_Approval_Status::get_all(); |
742 | 742 | |
743 | 743 | return <<<TEMPLATE |
744 | -<a href="#" data-approved="{$choices['approved']['value']}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices['approved']['action']}"><span class="screen-reader-text">{$choices['approved']['action']}</span></a> |
|
745 | -<a href="#" data-approved="{$choices['disapproved']['value']}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices['disapproved']['action']}"><span class="screen-reader-text">{$choices['disapproved']['action']}</span></a> |
|
746 | -<a href="#" data-approved="{$choices['unapproved']['value']}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices['unapproved']['action']}"><span class="screen-reader-text">{$choices['unapproved']['action']}</span></a> |
|
744 | +<a href="#" data-approved="{$choices[ 'approved' ][ 'value' ]}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices[ 'approved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'approved' ][ 'action' ]}</span></a> |
|
745 | +<a href="#" data-approved="{$choices[ 'disapproved' ][ 'value' ]}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices[ 'disapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'disapproved' ][ 'action' ]}</span></a> |
|
746 | +<a href="#" data-approved="{$choices[ 'unapproved' ][ 'value' ]}" aria-role="button" aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices[ 'unapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'unapproved' ][ 'action' ]}</span></a> |
|
747 | 747 | TEMPLATE; |
748 | 748 | } |
749 | 749 | } |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
13 | 13 | |
14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
26 | 26 | |
27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
28 | -$notes = (array) GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
28 | +$notes = (array)GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
29 | 29 | $strings = GravityView_Field_Notes::strings(); |
30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
31 | 31 | |
32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
35 | 35 | |
36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
38 | 38 | ?> |
39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
40 | 40 | <?php |
41 | - if( $show_notes ) { |
|
41 | + if ( $show_notes ) { |
|
42 | 42 | ?> |
43 | 43 | <form method="post" class="gv-notes-list"> |
44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
48 | 48 | <table> |
49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
50 | 50 | <?php |
51 | 51 | if ( $show_delete ) { |
52 | 52 | ?> |
53 | 53 | <thead> |
54 | 54 | <tr> |
55 | 55 | <th colspan="2"> |
56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
58 | 58 | </th> |
59 | 59 | </tr> |
60 | 60 | </thead> |
61 | 61 | <?php } ?> |
62 | 62 | <tbody> |
63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
64 | 64 | <?php |
65 | 65 | foreach ( $notes as $note ) { |
66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | } // End if can view notes |
75 | 75 | |
76 | - if( $show_add ) { |
|
76 | + if ( $show_add ) { |
|
77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
78 | 78 | } |
79 | 79 | ?> |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct() { |
9 | 9 | |
10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
11 | 11 | |
12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
12 | + add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 ); |
|
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
35 | 35 | } |
36 | 36 | |
37 | - $panels[] = new GravityView_Debug_Bar; |
|
37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
38 | 38 | |
39 | 39 | return $panels; |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
48 | 48 | return $supported_plugins; |
49 | 49 | } |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string "print_r" or "var_export" |
73 | 73 | */ |
74 | 74 | static function get_print_function() { |
75 | - if( ob_get_level() > 0 ) { |
|
75 | + if ( ob_get_level() > 0 ) { |
|
76 | 76 | $function = 'var_export'; |
77 | 77 | } else { |
78 | 78 | $function = 'print_r'; |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | 'data' => $data, |
91 | 91 | ); |
92 | 92 | |
93 | - if( !in_array( $notice, self::$notices ) ) { |
|
94 | - self::$notices[] = $notice; |
|
93 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
94 | + self::$notices[ ] = $notice; |
|
95 | 95 | } |
96 | 96 | |
97 | - if ( class_exists("GFLogging") ) { |
|
97 | + if ( class_exists( "GFLogging" ) ) { |
|
98 | 98 | GFLogging::include_logger(); |
99 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
99 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - static function log_error( $message = '', $data = null ) { |
|
103 | + static function log_error( $message = '', $data = null ) { |
|
104 | 104 | |
105 | 105 | $function = self::get_print_function(); |
106 | 106 | |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
111 | 111 | ); |
112 | 112 | |
113 | - if( !in_array( $error, self::$errors ) ) { |
|
114 | - self::$errors[] = $error; |
|
113 | + if ( ! in_array( $error, self::$errors ) ) { |
|
114 | + self::$errors[ ] = $error; |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( class_exists("GFLogging") ) { |
|
117 | + if ( class_exists( "GFLogging" ) ) { |
|
118 | 118 | GFLogging::include_logger(); |
119 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR ); |
|
119 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $error, true ), KLogger::ERROR ); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | static function is_logging_active( $plugin = 'gravityview' ) { |
135 | 135 | |
136 | - if( ! class_exists( 'GFLogging') ) { |
|
136 | + if ( ! class_exists( 'GFLogging' ) ) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 |
@@ -15,32 +15,32 @@ discard block |
||
15 | 15 | |
16 | 16 | <div id="directory-fields" class="gv-section"> |
17 | 17 | |
18 | - <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4> |
|
18 | + <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4> |
|
19 | 19 | |
20 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
20 | + <?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
21 | 21 | |
22 | - <h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4> |
|
22 | + <h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4> |
|
23 | 23 | |
24 | 24 | <div id="directory-active-fields" class="gv-grid"> |
25 | - <?php if(!empty( $curr_template ) ) { |
|
26 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
25 | + <?php if ( ! empty( $curr_template ) ) { |
|
26 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
27 | 27 | } ?> |
28 | 28 | </div> |
29 | 29 | |
30 | - <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4> |
|
30 | + <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4> |
|
31 | 31 | |
32 | 32 | <?php |
33 | 33 | |
34 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
34 | + do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
35 | 35 | |
36 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
36 | + do_action( 'gravityview_render_field_pickers', 'directory' ); |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | |
40 | 40 | <?php // list of available widgets to be shown in the popup ?> |
41 | 41 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
42 | 42 | <span class="close" role="button" aria-label="<?php esc_html_e( 'Close', 'gravityview' ); ?>"><i class="dashicons dashicons-dismiss"></i></span> |
43 | - <?php do_action('gravityview_render_available_widgets' ); ?> |
|
43 | + <?php do_action( 'gravityview_render_available_widgets' ); ?> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | </div> |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | |
57 | 57 | <div id="single-fields" class="gv-section"> |
58 | 58 | |
59 | - <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4> |
|
59 | + <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4> |
|
60 | 60 | |
61 | 61 | <div id="single-active-fields" class="gv-grid"> |
62 | 62 | <?php |
63 | - if(!empty( $curr_template ) ) { |
|
64 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
63 | + if ( ! empty( $curr_template ) ) { |
|
64 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
65 | 65 | } |
66 | 66 | ?> |
67 | 67 | </div> |
68 | 68 | <?php |
69 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
69 | + do_action( 'gravityview_render_field_pickers', 'single' ); |
|
70 | 70 | ?> |
71 | 71 | </div> |
72 | 72 | |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | |
77 | 77 | <div id="edit-fields" class="gv-section"> |
78 | 78 | |
79 | - <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4> |
|
79 | + <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4> |
|
80 | 80 | |
81 | 81 | <div id="edit-active-fields" class="gv-grid"> |
82 | 82 | <?php |
83 | - do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
83 | + do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
84 | 84 | ?> |
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <?php |
88 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
88 | + do_action( 'gravityview_render_field_pickers', 'edit' ); |
|
89 | 89 | ?> |
90 | 90 | |
91 | 91 | </div> |
@@ -22,27 +22,27 @@ |
||
22 | 22 | |
23 | 23 | <?php // list all the available templates (type= fresh or custom ) ?> |
24 | 24 | <div class="gv-grid"> |
25 | - <?php foreach( $templates as $id => $template ) { |
|
25 | + <?php foreach ( $templates as $id => $template ) { |
|
26 | 26 | $selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?> |
27 | 27 | |
28 | 28 | <div class="gv-grid-col-1-3"> |
29 | - <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
29 | + <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>"> |
|
30 | 30 | <div class="gv-view-types-hover"> |
31 | 31 | <div> |
32 | - <?php if( !empty( $template['buy_source'] ) ) { ?> |
|
33 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
32 | + <?php if ( ! empty( $template[ 'buy_source' ] ) ) { ?> |
|
33 | + <p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p> |
|
34 | 34 | <?php } else { ?> |
35 | - <p><button href="#gv_select_template" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></button></p> |
|
36 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
37 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
35 | + <p><button href="#gv_select_template" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></button></p> |
|
36 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
37 | + <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a> |
|
38 | 38 | <?php } ?> |
39 | 39 | <?php } ?> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | <div class="gv-view-types-normal"> |
43 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
44 | - <h5><?php echo esc_html( $template['label'] ); ?></h5> |
|
45 | - <p class="description"><?php echo esc_html( $template['description'] ); ?></p> |
|
43 | + <img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>"> |
|
44 | + <h5><?php echo esc_html( $template[ 'label' ] ); ?></h5> |
|
45 | + <p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p> |
|
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | </div> |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | $powered_by = gravityview()->plugin->settings->get( 'powered_by', '0' ); |
34 | 34 | |
35 | - if( empty( $powered_by ) ) { |
|
35 | + if ( empty( $powered_by ) ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function get_url() { |
61 | 61 | |
62 | - $url = sprintf( self::url, get_bloginfo('name' ) ); |
|
62 | + $url = sprintf( self::url, get_bloginfo( 'name' ) ); |
|
63 | 63 | |
64 | 64 | $affiliate_id = gravityview()->plugin->settings->get( 'affiliate_id', '' ); |
65 | 65 | |
66 | - if( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
66 | + if ( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
67 | 67 | $url = add_query_arg( array( 'ref' => $affiliate_id ), $url ); |
68 | 68 | } |
69 | 69 | |
70 | 70 | $url = add_query_arg( array( |
71 | 71 | 'utm_source' => 'powered_by', |
72 | - 'utm_term' => get_bloginfo('name' ), |
|
72 | + 'utm_term' => get_bloginfo( 'name' ), |
|
73 | 73 | ), $url ); |
74 | 74 | |
75 | 75 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | wp_embed_register_handler( 'gravityview_entry', self::get_entry_regex(), array( __CLASS__, 'render' ), 20000 ); |
27 | 27 | wp_oembed_add_provider( self::get_entry_regex(), self::$provider_url, true ); |
28 | 28 | |
29 | - if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) { |
|
29 | + if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) { |
|
30 | 30 | add_action( 'template_redirect', array( __CLASS__, 'render_provider_request' ) ); |
31 | 31 | } |
32 | 32 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | public static function render_provider_request() { |
46 | - if ( ! empty( $_GET['url'] ) ) { |
|
47 | - $url = $_GET['url']; |
|
46 | + if ( ! empty( $_GET[ 'url' ] ) ) { |
|
47 | + $url = $_GET[ 'url' ]; |
|
48 | 48 | } else { |
49 | 49 | header( 'HTTP/1.0 404 Not Found' ); |
50 | 50 | exit; |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private static function parse_matches( $matches, $url ) { |
113 | 113 | // If not using permalinks, re-assign values for matching groups |
114 | - if ( ! empty( $matches['entry_slug2'] ) ) { |
|
115 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
116 | - $matches['slug'] = $matches['slug2']; |
|
117 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
118 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
114 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
115 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
116 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
117 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
118 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( empty( $matches['entry_slug'] ) ) { |
|
121 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
122 | 122 | gravityview()->log->error( 'Entry slug not parsed by regex.', array( 'data' => $matches ) ); |
123 | 123 | return null; |
124 | 124 | } else { |
125 | - $entry_id = $matches['entry_slug']; |
|
125 | + $entry_id = $matches[ 'entry_slug' ]; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | if ( ! $view ) { |
141 | 141 | |
142 | 142 | // If the slug doesn't work, maybe using Plain permalinks and not the slug, only ID |
143 | - if( is_numeric( $matches['slug'] ) ) { |
|
144 | - $view = \GV\View::by_id( $matches['slug'] ); |
|
143 | + if ( is_numeric( $matches[ 'slug' ] ) ) { |
|
144 | + $view = \GV\View::by_id( $matches[ 'slug' ] ); |
|
145 | 145 | } |
146 | 146 | |
147 | - if( ! $view ) { |
|
148 | - $view = \GV\View::from_post( get_page_by_path( $matches['slug'], OBJECT, 'gravityview' ) ); |
|
147 | + if ( ! $view ) { |
|
148 | + $view = \GV\View::from_post( get_page_by_path( $matches[ 'slug' ], OBJECT, 'gravityview' ) ); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | |
177 | 177 | return ' |
178 | 178 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
179 | - <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
179 | + <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
180 | 180 | <p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;"> |
181 | - '.$embed_text.' |
|
181 | + '.$embed_text . ' |
|
182 | 182 | </p> |
183 | 183 | <br style="clear: both;"> |
184 | 184 | </div>'; |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | private static function render_preview_notice() { |
193 | 193 | $floaty = \GravityView_Admin::get_floaty(); |
194 | 194 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
195 | - $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
196 | - return '<div class="updated notice">'.$floaty.'<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
195 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
196 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
213 | 213 | } |
214 | 214 | |
215 | - if ( $entry && 'active' !== $entry['status'] ) { |
|
215 | + if ( $entry && 'active' !== $entry[ 'status' ] ) { |
|
216 | 216 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
217 | 217 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ( $view->settings->get( 'show_only_approved' ) ) { |
221 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
221 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
222 | 222 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
223 | 223 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
224 | 224 | } |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | * Mocks old context, etc. |
250 | 250 | */ |
251 | 251 | $loader = \GravityView_Edit_Entry::getInstance(); |
252 | - $render = $loader->instances['render']; |
|
252 | + $render = $loader->instances[ 'render' ]; |
|
253 | 253 | |
254 | - $form = \GFAPI::get_form( $entry['form_id'] ); |
|
254 | + $form = \GFAPI::get_form( $entry[ 'form_id' ] ); |
|
255 | 255 | |
256 | 256 | // @todo We really need to rewrite Edit Entry soon |
257 | 257 | \GravityView_View::$instance = null; |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | $data = \GravityView_View_Data::getInstance( get_post( $view->ID ) ); |
261 | 261 | $template = \GravityView_View::getInstance( array( |
262 | 262 | 'form' => $form, |
263 | - 'form_id' => $form['id'], |
|
263 | + 'form_id' => $form[ 'id' ], |
|
264 | 264 | 'view_id' => $view->ID, |
265 | 265 | 'entries' => array( $entry->as_entry() ), |
266 | 266 | 'atts' => \GVCommon::get_template_settings( $view->ID ), |
267 | 267 | ) ); |
268 | 268 | |
269 | - ob_start() && $render->init( $data, \GV\Entry::by_id( $entry['id'] ), $view ); |
|
269 | + ob_start() && $render->init( $data, \GV\Entry::by_id( $entry[ 'id' ] ), $view ); |
|
270 | 270 | $output = ob_get_clean(); // Render :) |
271 | 271 | } else { |
272 | 272 | /** Remove the back link. */ |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // Catch either |
311 | 311 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
312 | 312 | |
313 | - return '#'.$match_regex.'#i'; |
|
313 | + return '#' . $match_regex . '#i'; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Don't exit if we're running test suite. |
37 | 37 | * @since 1.15 |
38 | 38 | */ |
39 | - if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
39 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
40 | 40 | return $mixed; |
41 | 41 | } |
42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | function check_ajax_nonce() { |
53 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) { |
|
53 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) { |
|
54 | 54 | $this->_exit( false ); |
55 | 55 | } |
56 | 56 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $context = rgpost( 'context' ); |
70 | 70 | |
71 | 71 | // Return markup for a single or multiple contexts |
72 | - if( $context ) { |
|
72 | + if ( $context ) { |
|
73 | 73 | $data = array( |
74 | 74 | esc_attr( $context ) => '' |
75 | 75 | ); |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | function get_active_areas() { |
114 | 114 | $this->check_ajax_nonce(); |
115 | 115 | |
116 | - if( empty( $_POST['template_id'] ) ) { |
|
116 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
117 | 117 | $this->_exit( false ); |
118 | 118 | } |
119 | 119 | |
120 | 120 | ob_start(); |
121 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true ); |
|
122 | - $response['directory'] = ob_get_clean(); |
|
121 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true ); |
|
122 | + $response[ 'directory' ] = ob_get_clean(); |
|
123 | 123 | |
124 | 124 | ob_start(); |
125 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'single', '', true ); |
|
126 | - $response['single'] = ob_get_clean(); |
|
125 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true ); |
|
126 | + $response[ 'single' ] = ob_get_clean(); |
|
127 | 127 | |
128 | 128 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
129 | 129 | |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | |
139 | 139 | $this->check_ajax_nonce(); |
140 | 140 | |
141 | - if( empty( $_POST['template_id'] ) ) { |
|
141 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
142 | 142 | $this->_exit( false ); |
143 | 143 | } |
144 | 144 | |
145 | 145 | // get the fields xml config file for this specific preset |
146 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
146 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
147 | 147 | // import fields |
148 | - if( !empty( $preset_fields_path ) ) { |
|
148 | + if ( ! empty( $preset_fields_path ) ) { |
|
149 | 149 | $presets = $this->import_fields( $preset_fields_path ); |
150 | 150 | } else { |
151 | 151 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
152 | 152 | } |
153 | 153 | |
154 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
154 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
155 | 155 | |
156 | 156 | // template areas |
157 | 157 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | $default_widget_areas = \GV\Widget::get_default_widget_areas(); |
162 | 162 | |
163 | 163 | ob_start(); |
164 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
165 | - $response['header'] = ob_get_clean(); |
|
164 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
165 | + $response[ 'header' ] = ob_get_clean(); |
|
166 | 166 | |
167 | 167 | ob_start(); |
168 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
169 | - $response['footer'] = ob_get_clean(); |
|
168 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
169 | + $response[ 'footer' ] = ob_get_clean(); |
|
170 | 170 | |
171 | 171 | ob_start(); |
172 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
173 | - $response['directory'] = ob_get_clean(); |
|
172 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
173 | + $response[ 'directory' ] = ob_get_clean(); |
|
174 | 174 | |
175 | 175 | ob_start(); |
176 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
177 | - $response['single'] = ob_get_clean(); |
|
176 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
177 | + $response[ 'single' ] = ob_get_clean(); |
|
178 | 178 | |
179 | 179 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
180 | 180 | |
@@ -192,26 +192,26 @@ discard block |
||
192 | 192 | |
193 | 193 | $this->check_ajax_nonce(); |
194 | 194 | |
195 | - if( empty( $_POST['template_id'] ) ) { |
|
195 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
196 | 196 | gravityview()->log->error( 'Cannot create preset form; the template_id is empty.' ); |
197 | 197 | $this->_exit( false ); |
198 | 198 | } |
199 | 199 | |
200 | 200 | // get the xml for this specific template_id |
201 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
201 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
202 | 202 | |
203 | 203 | // import form |
204 | 204 | $form = $this->import_form( $preset_form_xml_path ); |
205 | 205 | |
206 | 206 | // get the form ID |
207 | - if( false === $form ) { |
|
207 | + if ( false === $form ) { |
|
208 | 208 | // send error to user |
209 | - gravityview()->log->error( 'Error importing form for template id: {template_id}', array( 'template_id' => (int) $_POST['template_id'] ) ); |
|
209 | + gravityview()->log->error( 'Error importing form for template id: {template_id}', array( 'template_id' => (int)$_POST[ 'template_id' ] ) ); |
|
210 | 210 | |
211 | 211 | $this->_exit( false ); |
212 | 212 | } |
213 | 213 | |
214 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
214 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
215 | 215 | |
216 | 216 | } |
217 | 217 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | gravityview()->log->debug( '[import_form] Import Preset Form. (File) {path}', array( 'path' => $xml_or_json_path ) ); |
227 | 227 | |
228 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
228 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
229 | 229 | gravityview()->log->error( 'Class GFExport or file not found. file: {path}', array( 'path' => $xml_or_json_path ) ); |
230 | 230 | return false; |
231 | 231 | } |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | gravityview()->log->debug( '[import_form] Importing form (Result) {count}', array( 'count' => $count ) ); |
238 | 238 | gravityview()->log->debug( '[import_form] Importing form (Form) ', array( 'data' => $forms ) ); |
239 | 239 | |
240 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
240 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
241 | 241 | gravityview()->log->error( 'Form Import Failed!' ); |
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // import success - return form id |
246 | - return $forms[0]; |
|
246 | + return $forms[ 0 ]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | function get_field_options() { |
258 | 258 | $this->check_ajax_nonce(); |
259 | 259 | |
260 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
260 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
261 | 261 | gravityview()->log->error( 'Required fields were not set in the $_POST request. ' ); |
262 | 262 | $this->_exit( false ); |
263 | 263 | } |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | $_post = array_map( 'esc_attr', $_post ); |
270 | 270 | |
271 | 271 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
272 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
273 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
272 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
273 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
274 | 274 | |
275 | - $form_id = empty( $_post['form_id'] ) ? null : $_post['form_id']; |
|
276 | - $response = GravityView_Render_Settings::render_field_options( $form_id, $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
275 | + $form_id = empty( $_post[ 'form_id' ] ) ? null : $_post[ 'form_id' ]; |
|
276 | + $response = GravityView_Render_Settings::render_field_options( $form_id, $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
277 | 277 | |
278 | 278 | $response = gravityview_strip_whitespace( $response ); |
279 | 279 | |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | $form = ''; |
295 | 295 | |
296 | 296 | // if form id is set, use it, else, get form from preset |
297 | - if( !empty( $_POST['form_id'] ) ) { |
|
297 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
298 | 298 | |
299 | - $form = (int) $_POST['form_id']; |
|
299 | + $form = (int)$_POST[ 'form_id' ]; |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | // get form from preset |
303 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
303 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
304 | 304 | |
305 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
305 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
306 | 306 | |
307 | 307 | } |
308 | 308 | |
@@ -318,27 +318,27 @@ discard block |
||
318 | 318 | * @param string $template_id Preset template |
319 | 319 | * |
320 | 320 | */ |
321 | - static function pre_get_form_fields( $template_id = '') { |
|
321 | + static function pre_get_form_fields( $template_id = '' ) { |
|
322 | 322 | |
323 | - if( empty( $template_id ) ) { |
|
323 | + if ( empty( $template_id ) ) { |
|
324 | 324 | gravityview()->log->error( 'Template ID not set.' ); |
325 | 325 | return false; |
326 | 326 | } else { |
327 | 327 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
328 | - if( !file_exists( $form_file ) ) { |
|
328 | + if ( ! file_exists( $form_file ) ) { |
|
329 | 329 | gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. File not found. file: {path}', array( 'template_id' => $template_id, 'path' => $form_file ) ); |
330 | 330 | return false; |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | 334 | // Load xml parser (from GravityForms) |
335 | - if( class_exists( 'GFCommon' ) ) { |
|
335 | + if ( class_exists( 'GFCommon' ) ) { |
|
336 | 336 | $xml_parser = GFCommon::get_base_path() . '/xml.php'; |
337 | 337 | } else { |
338 | 338 | $xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php'; |
339 | 339 | } |
340 | 340 | |
341 | - if( file_exists( $xml_parser ) ) { |
|
341 | + if ( file_exists( $xml_parser ) ) { |
|
342 | 342 | require_once( $xml_parser ); |
343 | 343 | } else { |
344 | 344 | gravityview()->log->debug( ' - Gravity Forms XML Parser not found {path}.', array( 'path' => $xml_parser ) ); |
@@ -349,32 +349,32 @@ discard block |
||
349 | 349 | $xmlstr = file_get_contents( $form_file ); |
350 | 350 | |
351 | 351 | $options = array( |
352 | - "page" => array("unserialize_as_array" => true), |
|
353 | - "form"=> array("unserialize_as_array" => true), |
|
354 | - "field"=> array("unserialize_as_array" => true), |
|
355 | - "rule"=> array("unserialize_as_array" => true), |
|
356 | - "choice"=> array("unserialize_as_array" => true), |
|
357 | - "input"=> array("unserialize_as_array" => true), |
|
358 | - "routing_item"=> array("unserialize_as_array" => true), |
|
359 | - "creditCard"=> array("unserialize_as_array" => true), |
|
360 | - "routin"=> array("unserialize_as_array" => true), |
|
361 | - "confirmation" => array("unserialize_as_array" => true), |
|
362 | - "notification" => array("unserialize_as_array" => true) |
|
352 | + "page" => array( "unserialize_as_array" => true ), |
|
353 | + "form"=> array( "unserialize_as_array" => true ), |
|
354 | + "field"=> array( "unserialize_as_array" => true ), |
|
355 | + "rule"=> array( "unserialize_as_array" => true ), |
|
356 | + "choice"=> array( "unserialize_as_array" => true ), |
|
357 | + "input"=> array( "unserialize_as_array" => true ), |
|
358 | + "routing_item"=> array( "unserialize_as_array" => true ), |
|
359 | + "creditCard"=> array( "unserialize_as_array" => true ), |
|
360 | + "routin"=> array( "unserialize_as_array" => true ), |
|
361 | + "confirmation" => array( "unserialize_as_array" => true ), |
|
362 | + "notification" => array( "unserialize_as_array" => true ) |
|
363 | 363 | ); |
364 | 364 | |
365 | - $xml = new RGXML($options); |
|
366 | - $forms = $xml->unserialize($xmlstr); |
|
365 | + $xml = new RGXML( $options ); |
|
366 | + $forms = $xml->unserialize( $xmlstr ); |
|
367 | 367 | |
368 | - if( !$forms ) { |
|
368 | + if ( ! $forms ) { |
|
369 | 369 | gravityview()->log->error( 'Importing Form Fields for preset [{template_id}]. Error importing file. (File) {path}', array( 'template_id' => $template_id, 'path' => $form_file ) ); |
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
374 | - $form = $forms[0]; |
|
373 | + if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) { |
|
374 | + $form = $forms[ 0 ]; |
|
375 | 375 | } |
376 | 376 | |
377 | - if( empty( $form ) ) { |
|
377 | + if ( empty( $form ) ) { |
|
378 | 378 | gravityview()->log->error( '$form not set.', array( 'data' => $forms ) ); |
379 | 379 | return false; |
380 | 380 | } |
@@ -393,38 +393,38 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function import_fields( $file ) { |
395 | 395 | |
396 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
396 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
397 | 397 | gravityview()->log->error( 'Importing Preset Fields. File not found. (File) {path}', array( 'path' => $file ) ); |
398 | 398 | return false; |
399 | 399 | } |
400 | 400 | |
401 | - if( !class_exists('WXR_Parser') ) { |
|
401 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
402 | 402 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
403 | 403 | } |
404 | 404 | |
405 | 405 | $parser = new WXR_Parser(); |
406 | 406 | $presets = $parser->parse( $file ); |
407 | 407 | |
408 | - if(is_wp_error( $presets )) { |
|
408 | + if ( is_wp_error( $presets ) ) { |
|
409 | 409 | gravityview()->log->error( 'Importing Preset Fields failed. Threw WP_Error.', array( 'data' => $presets ) ); |
410 | 410 | return false; |
411 | 411 | } |
412 | 412 | |
413 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
413 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
414 | 414 | gravityview()->log->error( 'Importing Preset Fields failed. Meta not found in file. {path}', array( 'path' => $file ) ); |
415 | 415 | return false; |
416 | 416 | } |
417 | 417 | |
418 | - gravityview()->log->debug( '[import_fields] postmeta', array( 'data' => $presets['posts'][0]['postmeta'] ) ); |
|
418 | + gravityview()->log->debug( '[import_fields] postmeta', array( 'data' => $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ); |
|
419 | 419 | |
420 | 420 | $fields = $widgets = array(); |
421 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
422 | - switch ($meta['key']) { |
|
421 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
422 | + switch ( $meta[ 'key' ] ) { |
|
423 | 423 | case '_gravityview_directory_fields': |
424 | - $fields = maybe_unserialize( $meta['value'] ); |
|
424 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
425 | 425 | break; |
426 | 426 | case '_gravityview_directory_widgets': |
427 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
427 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
428 | 428 | break; |
429 | 429 | } |
430 | 430 | } |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | $result = array(); |
68 | 68 | if ( ! $lock_holder_user_id ) { |
69 | 69 | $this->set_lock( $object_id ); |
70 | - $result['html'] = __( 'You now have control', 'gravityview' ); |
|
71 | - $result['status'] = 'lock_obtained'; |
|
70 | + $result[ 'html' ] = __( 'You now have control', 'gravityview' ); |
|
71 | + $result[ 'status' ] = 'lock_obtained'; |
|
72 | 72 | } else { |
73 | 73 | |
74 | - if( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) { |
|
74 | + if ( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) { |
|
75 | 75 | $user = get_userdata( $lock_holder_user_id ); |
76 | - $result['html'] = sprintf( __( 'Your request has been sent to %s.', 'gravityview' ), $user->display_name ); |
|
76 | + $result[ 'html' ] = sprintf( __( 'Your request has been sent to %s.', 'gravityview' ), $user->display_name ); |
|
77 | 77 | } else { |
78 | - $result['html'] = __( 'Your request has been sent.', 'gravityview' ); |
|
78 | + $result[ 'html' ] = __( 'Your request has been sent.', 'gravityview' ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $this->update_lock_request_meta( $object_id, $user_id ); |
82 | 82 | |
83 | - $result['status'] = 'lock_requested'; |
|
83 | + $result[ 'status' ] = 'lock_requested'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $result; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | $continue_enqueuing = false; |
123 | 123 | |
124 | 124 | // If any Views being loaded have entry locking, enqueue the scripts |
125 | - foreach( $views->all() as $view ) { |
|
125 | + foreach ( $views->all() as $view ) { |
|
126 | 126 | |
127 | 127 | // Make sure the View has edit locking enabled |
128 | - if( ! $view->settings->get( 'edit_locking' ) ) { |
|
128 | + if ( ! $view->settings->get( 'edit_locking' ) ) { |
|
129 | 129 | continue; |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Make sure that the entry belongs to one of the forms connected to one of the Views in this request |
133 | 133 | $joined_forms = $view::get_joined_forms( $view->ID ); |
134 | 134 | |
135 | - $entry_form_id = $entry_array['form_id']; |
|
135 | + $entry_form_id = $entry_array[ 'form_id' ]; |
|
136 | 136 | |
137 | - if( ! isset( $joined_forms[ $entry_form_id ] ) ) { |
|
137 | + if ( ! isset( $joined_forms[ $entry_form_id ] ) ) { |
|
138 | 138 | continue; |
139 | 139 | } |
140 | 140 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | break; |
144 | 144 | } |
145 | 145 | |
146 | - if( ! $continue_enqueuing ) { |
|
146 | + if ( ! $continue_enqueuing ) { |
|
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function enqueue_scripts( $entry ) { |
165 | 165 | |
166 | - $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET['gform_debug'] ) ? '' : '.min'; |
|
166 | + $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET[ 'gform_debug' ] ) ? '' : '.min'; |
|
167 | 167 | $locking_path = GFCommon::get_base_url() . '/includes/locking/'; |
168 | 168 | |
169 | 169 | wp_enqueue_script( 'gforms_locking', $locking_path . "js/locking{$min}.js", array( 'jquery', 'heartbeat' ), GFCommon::$version ); |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | $translations = array_map( 'wp_strip_all_tags', $this->get_strings() ); |
173 | 173 | |
174 | 174 | $strings = array( |
175 | - 'noResponse' => $translations['no_response'], |
|
176 | - 'requestAgain' => $translations['request_again'], |
|
177 | - 'requestError' => $translations['request_error'], |
|
178 | - 'gainedControl' => $translations['gained_control'], |
|
179 | - 'rejected' => $translations['request_rejected'], |
|
180 | - 'pending' => $translations['request_pending'], |
|
175 | + 'noResponse' => $translations[ 'no_response' ], |
|
176 | + 'requestAgain' => $translations[ 'request_again' ], |
|
177 | + 'requestError' => $translations[ 'request_error' ], |
|
178 | + 'gainedControl' => $translations[ 'gained_control' ], |
|
179 | + 'rejected' => $translations[ 'request_rejected' ], |
|
180 | + 'pending' => $translations[ 'request_pending' ], |
|
181 | 181 | ); |
182 | 182 | |
183 | - $lock_user_id = $this->check_lock( $entry['id'] ); |
|
183 | + $lock_user_id = $this->check_lock( $entry[ 'id' ] ); |
|
184 | 184 | |
185 | 185 | $vars = array( |
186 | 186 | 'hasLock' => ! $lock_user_id ? 1 : 0, |
187 | 187 | 'lockUI' => $this->get_lock_ui( $lock_user_id ), |
188 | - 'objectID' => $entry['id'], |
|
188 | + 'objectID' => $entry[ 'id' ], |
|
189 | 189 | 'objectType' => 'entry', |
190 | 190 | 'strings' => $strings, |
191 | 191 | ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $hidden = $locked ? '' : ' hidden'; |
216 | 216 | if ( $locked ) { |
217 | 217 | |
218 | - if( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) { |
|
218 | + if ( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) { |
|
219 | 219 | $avatar = get_avatar( $user->ID, 64 ); |
220 | 220 | $person_editing_text = $user->display_name; |
221 | 221 | } else { |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | |
323 | 323 | $current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) ); |
324 | 324 | |
325 | - if ( isset( $_GET['get-edit-lock'] ) ) { |
|
325 | + if ( isset( $_GET[ 'get-edit-lock' ] ) ) { |
|
326 | 326 | $this->set_lock( $entry_id ); |
327 | 327 | echo '<script>window.location = ' . json_encode( remove_query_arg( 'get-edit-lock', $current_url ) ) . ';</script>'; |
328 | 328 | exit(); |
329 | - } else if ( isset( $_GET['release-edit-lock'] ) ) { |
|
329 | + } else if ( isset( $_GET[ 'release-edit-lock' ] ) ) { |
|
330 | 330 | $this->delete_lock_meta( $entry_id ); |
331 | 331 | $current_url = remove_query_arg( 'edit', $current_url ); |
332 | 332 | echo '<script>window.location = ' . json_encode( remove_query_arg( 'release-edit-lock', $current_url ) ) . ';</script>'; |