@@ -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', |
@@ -271,9 +271,9 @@ discard block |
||
| 271 | 271 | if ( $field_id === 'delete_link' ) { |
| 272 | 272 | |
| 273 | 273 | // Remove other built-in caps. |
| 274 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
| 274 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
| 275 | 275 | |
| 276 | - $caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
| 276 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | return $caps; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * @param [type] $entry [description] |
| 287 | 287 | */ |
| 288 | 288 | function set_entry( $entry = null ) { |
| 289 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
| 289 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | self::getInstance()->set_entry( $entry ); |
| 321 | 321 | |
| 322 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
| 322 | + $base = GravityView_API::directory_link( $post_id ?: $view_id, true ); |
|
| 323 | 323 | |
| 324 | 324 | if ( empty( $base ) ) { |
| 325 | 325 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | $attributes = array( |
| 382 | 382 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
| 383 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
| 383 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
| 384 | 384 | 'onclick' => self::get_confirm_dialog(), |
| 385 | 385 | ); |
| 386 | 386 | |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | ); |
| 417 | 417 | |
| 418 | 418 | // If the form is not submitted, return early |
| 419 | - if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) { |
|
| 419 | + if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) { |
|
| 420 | 420 | return; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | // Make sure it's a GravityView request |
| 424 | - $valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) ); |
|
| 424 | + $valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) ); |
|
| 425 | 425 | |
| 426 | 426 | if ( ! $valid_nonce_key ) { |
| 427 | 427 | gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' ); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // Get the entry slug |
| 432 | - $entry_slug = esc_attr( $get_fields['entry_id'] ); |
|
| 432 | + $entry_slug = esc_attr( $get_fields[ 'entry_id' ] ); |
|
| 433 | 433 | |
| 434 | 434 | // See if there's an entry there |
| 435 | 435 | $entry = gravityview_get_entry( $entry_slug, true, false ); |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Redirect after deleting the entry. |
| 479 | - $view = \GV\View::by_id( $get_fields['view_id'] ); |
|
| 479 | + $view = \GV\View::by_id( $get_fields[ 'view_id' ] ); |
|
| 480 | 480 | $delete_redirect = $view->settings->get( 'delete_redirect' ); |
| 481 | 481 | $delete_redirect_url = $view->settings->get( 'delete_redirect_url' ); |
| 482 | 482 | |
| 483 | 483 | if ( '1' !== $delete_redirect ) { |
| 484 | - $delete_redirect_url = get_post_permalink( $get_fields['view_id'] ); |
|
| 484 | + $delete_redirect_url = get_post_permalink( $get_fields[ 'view_id' ] ); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | wp_redirect( $delete_redirect_url ); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | */ |
| 515 | 515 | private function delete_or_trash_entry( $entry ) { |
| 516 | 516 | |
| 517 | - $entry_id = $entry['id']; |
|
| 517 | + $entry_id = $entry[ 'id' ]; |
|
| 518 | 518 | |
| 519 | 519 | $mode = $this->get_delete_mode(); |
| 520 | 520 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
| 579 | 579 | |
| 580 | 580 | // The entry had no connected post |
| 581 | - if ( empty( $entry['post_id'] ) ) { |
|
| 581 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
| 582 | 582 | return; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | $action = current_action(); |
| 597 | 597 | |
| 598 | 598 | if ( 'gravityview/delete-entry/deleted' === $action ) { |
| 599 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
| 599 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
| 600 | 600 | } else { |
| 601 | - $result = wp_trash_post( $entry['post_id'] ); |
|
| 601 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | if ( false === $result ) { |
@@ -629,13 +629,13 @@ discard block |
||
| 629 | 629 | public function verify_nonce() { |
| 630 | 630 | |
| 631 | 631 | // No delete entry request was made |
| 632 | - if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
| 632 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
| 633 | 633 | return false; |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
| 636 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
| 637 | 637 | |
| 638 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
| 638 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
| 639 | 639 | |
| 640 | 640 | /** |
| 641 | 641 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - if ( $entry['status'] === 'trash' ) { |
|
| 694 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
| 695 | 695 | if ( 'trash' === $this->get_delete_mode() ) { |
| 696 | 696 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
| 697 | 697 | } else { |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | $current_user = wp_get_current_user(); |
| 737 | 737 | |
| 738 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : null; |
|
| 738 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null; |
|
| 739 | 739 | |
| 740 | 740 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
| 741 | 741 | if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
@@ -749,17 +749,17 @@ discard block |
||
| 749 | 749 | if ( ! empty( $field ) ) { |
| 750 | 750 | |
| 751 | 751 | // If capability is not defined, something is not right! |
| 752 | - if ( empty( $field['allow_edit_cap'] ) ) { |
|
| 752 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
| 753 | 753 | |
| 754 | 754 | gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) ); |
| 755 | 755 | |
| 756 | 756 | return false; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
| 759 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
| 760 | 760 | |
| 761 | 761 | // Do not return true if cap is read, as we need to check if the current user created the entry |
| 762 | - if ( $field['allow_edit_cap'] !== 'read' ) { |
|
| 762 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
| 763 | 763 | return true; |
| 764 | 764 | } |
| 765 | 765 | } else { |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - if ( ! isset( $entry['created_by'] ) ) { |
|
| 773 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 774 | 774 | |
| 775 | 775 | gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
| 776 | 776 | |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | // If the logged-in user is the same as the user who created the entry, we're good. |
| 789 | - if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 789 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 790 | 790 | |
| 791 | 791 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
| 792 | 792 | |
@@ -810,12 +810,12 @@ discard block |
||
| 810 | 810 | * @return void |
| 811 | 811 | */ |
| 812 | 812 | public function maybe_display_message( $current_view_id = 0 ) { |
| 813 | - if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
| 813 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
| 814 | 814 | return; |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | // Entry wasn't deleted from current View |
| 818 | - if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
| 818 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
| 819 | 819 | return; |
| 820 | 820 | } |
| 821 | 821 | |
@@ -824,11 +824,11 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | public function display_message() { |
| 826 | 826 | |
| 827 | - if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) { |
|
| 827 | + if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
| 828 | 828 | return; |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | - $status = esc_attr( $_GET['status'] ); |
|
| 831 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
| 832 | 832 | $message_from_url = \GV\Utils::_GET( 'message' ); |
| 833 | 833 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
| 834 | 834 | $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 | } |