@@ -39,6 +39,9 @@ discard block |
||
39 | 39 | $this->add_hooks(); |
40 | 40 | } |
41 | 41 | |
42 | + /** |
|
43 | + * @param string $component |
|
44 | + */ |
|
42 | 45 | private function load_components( $component ) { |
43 | 46 | |
44 | 47 | $dir = trailingslashit( self::$file ); |
@@ -255,7 +258,6 @@ discard block |
||
255 | 258 | * |
256 | 259 | * @since 1.5.1 |
257 | 260 | * @param array $visibility_caps Array of capabilities to display in field dropdown. |
258 | - * @param string $field_type Type of field options to render (`field` or `widget`) |
|
259 | 261 | * @param string $template_id Table slug |
260 | 262 | * @param float $field_id GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by` |
261 | 263 | * @param string $context What context are we in? Example: `single` or `directory` |
@@ -717,7 +719,7 @@ discard block |
||
717 | 719 | * |
718 | 720 | * @param array $entry Gravity Forms entry array |
719 | 721 | * @param array $field Field settings (optional) |
720 | - * @param int|\GV\View $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional) |
|
722 | + * @param integer $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional) |
|
721 | 723 | * @return bool |
722 | 724 | */ |
723 | 725 | public static function check_user_cap_delete_entry( $entry, $field = array(), $view = 0 ) { |
@@ -532,7 +532,7 @@ |
||
532 | 532 | * @since 1.16.4 |
533 | 533 | * @param int $entry_id ID of the Gravity Forms entry |
534 | 534 | * @param array $entry Deleted entry array |
535 | - */ |
|
535 | + */ |
|
536 | 536 | do_action( 'gravityview/delete-entry/deleted', $entry_id, $entry ); |
537 | 537 | } |
538 | 538 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Index 100 is the default GravityView template path. |
151 | 151 | // Index 110 is Edit Entry link |
152 | - $file_paths[115] = self::$file; |
|
152 | + $file_paths[ 115 ] = self::$file; |
|
153 | 153 | |
154 | 154 | return $file_paths; |
155 | 155 | } |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
171 | 171 | |
172 | 172 | // Always a link, never a filter |
173 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
173 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
174 | 174 | |
175 | 175 | // Delete Entry link should only appear to visitors capable of editing entries |
176 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
176 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
177 | 177 | |
178 | - $add_option['delete_link'] = array( |
|
178 | + $add_option[ 'delete_link' ] = array( |
|
179 | 179 | 'type' => 'text', |
180 | 180 | 'label' => __( 'Delete Link Text', 'gravityview' ), |
181 | 181 | 'desc' => null, |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'merge_tags' => true, |
184 | 184 | ); |
185 | 185 | |
186 | - $field_options['allow_edit_cap'] = array( |
|
186 | + $field_options[ 'allow_edit_cap' ] = array( |
|
187 | 187 | 'type' => 'select', |
188 | 188 | 'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ), |
189 | 189 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
208 | 208 | |
209 | 209 | if ( 'edit' !== $zone ) { |
210 | - $entry_default_fields['delete_link'] = array( |
|
210 | + $entry_default_fields[ 'delete_link' ] = array( |
|
211 | 211 | 'label' => __( 'Delete Entry', 'gravityview' ), |
212 | 212 | 'type' => 'delete_link', |
213 | 213 | 'desc' => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ), |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | function add_available_field( $available_fields = array() ) { |
226 | 226 | |
227 | - $available_fields['delete_link'] = array( |
|
227 | + $available_fields[ 'delete_link' ] = array( |
|
228 | 228 | 'label_text' => __( 'Delete Entry', 'gravityview' ), |
229 | 229 | 'field_id' => 'delete_link', |
230 | 230 | 'label_type' => 'field', |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | if ( $field_id === 'delete_link' ) { |
271 | 271 | |
272 | 272 | // Remove other built-in caps. |
273 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
273 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
274 | 274 | |
275 | - $caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
275 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $caps; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param [type] $entry [description] |
286 | 286 | */ |
287 | 287 | function set_entry( $entry = null ) { |
288 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
288 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | self::getInstance()->set_entry( $entry ); |
320 | 320 | |
321 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
321 | + $base = GravityView_API::directory_link( $post_id ?: $view_id, true ); |
|
322 | 322 | |
323 | 323 | if ( empty( $base ) ) { |
324 | 324 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $attributes = array( |
381 | 381 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
382 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
382 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
383 | 383 | 'onclick' => self::get_confirm_dialog(), |
384 | 384 | ); |
385 | 385 | |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | ); |
416 | 416 | |
417 | 417 | // If the form is submitted |
418 | - if ( 'delete' === $get_fields['action'] && ! empty( $get_fields['entry_id'] ) ) { |
|
418 | + if ( 'delete' === $get_fields[ 'action' ] && ! empty( $get_fields[ 'entry_id' ] ) ) { |
|
419 | 419 | |
420 | 420 | // Make sure it's a GravityView request |
421 | - $valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) ); |
|
421 | + $valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) ); |
|
422 | 422 | |
423 | 423 | if ( ! $valid_nonce_key ) { |
424 | 424 | gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' ); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // Get the entry slug |
429 | - $entry_slug = esc_attr( $get_fields['entry_id'] ); |
|
429 | + $entry_slug = esc_attr( $get_fields[ 'entry_id' ] ); |
|
430 | 430 | |
431 | 431 | // See if there's an entry there |
432 | 432 | $entry = gravityview_get_entry( $entry_slug, true, false ); |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | // Redirect after deleting the entry. |
476 | - $view = \GV\View::by_id( $get_fields['view_id'] ); |
|
476 | + $view = \GV\View::by_id( $get_fields[ 'view_id' ] ); |
|
477 | 477 | $delete_redirect = $view->settings->get( 'delete_redirect' ); |
478 | 478 | $delete_redirect_url = $view->settings->get( 'delete_redirect_url' ); |
479 | 479 | |
480 | 480 | if ( '1' !== $delete_redirect ) { |
481 | - $delete_redirect_url = get_post_permalink( $get_fields['view_id'] ); |
|
481 | + $delete_redirect_url = get_post_permalink( $get_fields[ 'view_id' ] ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | wp_safe_redirect( $delete_redirect_url ); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | */ |
514 | 514 | private function delete_or_trash_entry( $entry ) { |
515 | 515 | |
516 | - $entry_id = $entry['id']; |
|
516 | + $entry_id = $entry[ 'id' ]; |
|
517 | 517 | |
518 | 518 | $mode = $this->get_delete_mode(); |
519 | 519 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
578 | 578 | |
579 | 579 | // The entry had no connected post |
580 | - if ( empty( $entry['post_id'] ) ) { |
|
580 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
581 | 581 | return; |
582 | 582 | } |
583 | 583 | |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | $action = current_action(); |
596 | 596 | |
597 | 597 | if ( 'gravityview/delete-entry/deleted' === $action ) { |
598 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
598 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
599 | 599 | } else { |
600 | - $result = wp_trash_post( $entry['post_id'] ); |
|
600 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | if ( false === $result ) { |
@@ -628,13 +628,13 @@ discard block |
||
628 | 628 | public function verify_nonce() { |
629 | 629 | |
630 | 630 | // No delete entry request was made |
631 | - if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
631 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
632 | 632 | return false; |
633 | 633 | } |
634 | 634 | |
635 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
635 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
636 | 636 | |
637 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
637 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
638 | 638 | |
639 | 639 | /** |
640 | 640 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
691 | 691 | } |
692 | 692 | |
693 | - if ( $entry['status'] === 'trash' ) { |
|
693 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
694 | 694 | if ( 'trash' === $this->get_delete_mode() ) { |
695 | 695 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
696 | 696 | } else { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | $current_user = wp_get_current_user(); |
736 | 736 | |
737 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : null; |
|
737 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null; |
|
738 | 738 | |
739 | 739 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
740 | 740 | if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
@@ -748,17 +748,17 @@ discard block |
||
748 | 748 | if ( ! empty( $field ) ) { |
749 | 749 | |
750 | 750 | // If capability is not defined, something is not right! |
751 | - if ( empty( $field['allow_edit_cap'] ) ) { |
|
751 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
752 | 752 | |
753 | 753 | gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) ); |
754 | 754 | |
755 | 755 | return false; |
756 | 756 | } |
757 | 757 | |
758 | - if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
758 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
759 | 759 | |
760 | 760 | // Do not return true if cap is read, as we need to check if the current user created the entry |
761 | - if ( $field['allow_edit_cap'] !== 'read' ) { |
|
761 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
762 | 762 | return true; |
763 | 763 | } |
764 | 764 | } else { |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | - if ( ! isset( $entry['created_by'] ) ) { |
|
772 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
773 | 773 | |
774 | 774 | gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
775 | 775 | |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | // If the logged-in user is the same as the user who created the entry, we're good. |
788 | - if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
788 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
789 | 789 | |
790 | 790 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
791 | 791 | |
@@ -809,12 +809,12 @@ discard block |
||
809 | 809 | * @return void |
810 | 810 | */ |
811 | 811 | public function maybe_display_message( $current_view_id = 0 ) { |
812 | - if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
812 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
813 | 813 | return; |
814 | 814 | } |
815 | 815 | |
816 | 816 | // Entry wasn't deleted from current View |
817 | - if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
817 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
818 | 818 | return; |
819 | 819 | } |
820 | 820 | |
@@ -823,11 +823,11 @@ discard block |
||
823 | 823 | |
824 | 824 | public function display_message() { |
825 | 825 | |
826 | - if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) { |
|
826 | + if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
827 | 827 | return; |
828 | 828 | } |
829 | 829 | |
830 | - $status = esc_attr( $_GET['status'] ); |
|
830 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
831 | 831 | $message_from_url = \GV\Utils::_GET( 'message' ); |
832 | 832 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
833 | 833 | $class = ''; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | function update_priority() { |
53 | 53 | global $wp_meta_boxes; |
54 | 54 | |
55 | - if ( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
55 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
56 | 56 | foreach ( array( 'high', 'core', 'low' ) as $position ) { |
57 | - if ( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
58 | - foreach ( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
57 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
58 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
59 | 59 | if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
60 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
61 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
60 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
61 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach ( $metaboxes as $m ) { |
193 | 193 | |
194 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
194 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
195 | 195 | |
196 | 196 | GravityView_Metabox_Tabs::add( $tab ); |
197 | 197 | |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | |
262 | 262 | $form = gravityview_get_form( $curr_form ); |
263 | 263 | |
264 | - $get_id_backup = isset( $_GET['id'] ) ? $_GET['id'] : null; |
|
264 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : null; |
|
265 | 265 | |
266 | - if ( isset( $form['id'] ) ) { |
|
266 | + if ( isset( $form[ 'id' ] ) ) { |
|
267 | 267 | $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
268 | 268 | |
269 | 269 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
270 | - $_GET['id'] = $form['id']; |
|
270 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
271 | 271 | |
272 | 272 | } else { |
273 | 273 | $form_script = 'var form = new Form();'; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
277 | 277 | |
278 | 278 | // Restore previous $_GET setting |
279 | - $_GET['id'] = $get_id_backup; |
|
279 | + $_GET[ 'id' ] = $get_id_backup; |
|
280 | 280 | |
281 | 281 | return $output; |
282 | 282 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | ); |
532 | 532 | |
533 | 533 | if ( version_compare( \GFCommon::$version, '2.3-beta-4', '>=' ) ) { |
534 | - $default_settings['sort_direction']['options']['RAND'] = __( 'Random', 'gravityview' ); |
|
534 | + $default_settings[ 'sort_direction' ][ 'options' ][ 'RAND' ] = __( 'Random', 'gravityview' ); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | /** |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if ( ! $detailed ) { |
553 | 553 | $defaults = array(); |
554 | 554 | foreach ( $default_settings as $key => $value ) { |
555 | - $defaults[ $key ] = $value['value']; |
|
555 | + $defaults[ $key ] = $value[ 'value' ]; |
|
556 | 556 | } |
557 | 557 | return $defaults; |
558 | 558 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | // If the $group argument is set for the method, |
564 | 564 | // ignore any settings that aren't in that group. |
565 | 565 | if ( ! empty( $group ) && is_string( $group ) ) { |
566 | - if ( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
566 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
567 | 567 | unset( $default_settings[ $key ] ); |
568 | 568 | } |
569 | 569 | } |