@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** @var WP_Admin_Bar $wp_admin_bar */ |
39 | 39 | global $wp_admin_bar; |
40 | 40 | |
41 | - if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
41 | + if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | 'parent' => 'gravityview', |
111 | 111 | 'title' => __( 'Edit Entry', 'gravityview' ), |
112 | 112 | 'meta' => array( |
113 | - 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ), |
|
113 | + 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ), |
|
114 | 114 | ), |
115 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ), |
|
115 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ), |
|
116 | 116 | ) ); |
117 | 117 | |
118 | 118 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** @var WP_Admin_Bar $wp_admin_bar */ |
129 | 129 | global $wp_admin_bar; |
130 | 130 | |
131 | - if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
131 | + if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
132 | 132 | |
133 | 133 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
134 | 134 | $views = gravityview()->views->all(); |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | $form_id = $view->form ? $view->form->ID : null; |
153 | 153 | } else { |
154 | 154 | /** Deprecated. */ |
155 | - $view_id = $view['id']; |
|
156 | - $form_id = $view['form_id']; |
|
155 | + $view_id = $view[ 'id' ]; |
|
156 | + $form_id = $view[ 'form_id' ]; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $edit_view_title = __( 'Edit View', 'gravityview' ); |
160 | 160 | $edit_form_title = __( 'Edit Form', 'gravityview' ); |
161 | 161 | |
162 | - if( sizeof( $views ) > 1 ) { |
|
162 | + if ( sizeof( $views ) > 1 ) { |
|
163 | 163 | $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view_id ); |
164 | 164 | $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $form_id ); |
165 | 165 | } |
166 | 166 | |
167 | - if( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
167 | + if ( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
168 | 168 | |
169 | - $added_views[] = $view_id; |
|
169 | + $added_views[ ] = $view_id; |
|
170 | 170 | |
171 | 171 | $wp_admin_bar->add_menu( array( |
172 | 172 | 'id' => 'edit-view-' . $view_id, |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | ) ); |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
179 | + if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
180 | 180 | |
181 | - $added_forms[] = $form_id; |
|
181 | + $added_forms[ ] = $form_id; |
|
182 | 182 | |
183 | 183 | $wp_admin_bar->add_menu( array( |
184 | 184 | 'id' => 'edit-form-' . $form_id, |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | |
238 | 238 | $this->context_view_id = $view_id; |
239 | 239 | |
240 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
240 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
241 | 241 | /** |
242 | 242 | * used on a has_multiple_views context |
243 | 243 | * @see GravityView_API::entry_link |
244 | 244 | */ |
245 | - $this->context_view_id = $_GET['gvid']; |
|
245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
246 | 246 | |
247 | 247 | } elseif ( ! $multiple_views ) { |
248 | 248 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -285,24 +285,24 @@ discard block |
||
285 | 285 | global $wp_rewrite; |
286 | 286 | |
287 | 287 | $is_front_page = ( $query->is_home || $query->is_page ); |
288 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
289 | - $front_page_id = get_option('page_on_front'); |
|
288 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
289 | + $front_page_id = get_option( 'page_on_front' ); |
|
290 | 290 | |
291 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
291 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
292 | 292 | |
293 | 293 | // Force to be an array, potentially a query string ( entry=16 ) |
294 | 294 | $_query = wp_parse_args( $query->query ); |
295 | 295 | |
296 | 296 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
297 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
298 | - unset( $_query['pagename'] ); |
|
297 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
298 | + unset( $_query[ 'pagename' ] ); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | // this is where will break from core wordpress |
302 | 302 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
303 | 303 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
304 | - foreach ( (array) $endpoints as $endpoint ) { |
|
305 | - $ignore[] = $endpoint[1]; |
|
304 | + foreach ( (array)$endpoints as $endpoint ) { |
|
305 | + $ignore[ ] = $endpoint[ 1 ]; |
|
306 | 306 | } |
307 | 307 | unset( $endpoints ); |
308 | 308 | |
@@ -312,21 +312,21 @@ discard block |
||
312 | 312 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
313 | 313 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
314 | 314 | |
315 | - $qv =& $query->query_vars; |
|
315 | + $qv = & $query->query_vars; |
|
316 | 316 | |
317 | 317 | // Prevent redirect when on the single entry endpoint |
318 | - if( self::is_single_entry() ) { |
|
318 | + if ( self::is_single_entry() ) { |
|
319 | 319 | add_filter( 'redirect_canonical', '__return_false' ); |
320 | 320 | } |
321 | 321 | |
322 | 322 | $query->is_page = true; |
323 | 323 | $query->is_home = false; |
324 | - $qv['page_id'] = $front_page_id; |
|
324 | + $qv[ 'page_id' ] = $front_page_id; |
|
325 | 325 | |
326 | 326 | // Correct <!--nextpage--> for page_on_front |
327 | - if ( ! empty( $qv['paged'] ) ) { |
|
328 | - $qv['page'] = $qv['paged']; |
|
329 | - unset( $qv['paged'] ); |
|
327 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
328 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
329 | + unset( $qv[ 'paged' ] ); |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
361 | 361 | |
362 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
362 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
363 | 363 | $this->setPostId( $post_id ); |
364 | 364 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
365 | 365 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
397 | 397 | |
398 | - if( 'post' === $search_method ) { |
|
398 | + if ( 'post' === $search_method ) { |
|
399 | 399 | $get = $_POST; |
400 | 400 | } else { |
401 | 401 | $get = $_GET; |
@@ -451,20 +451,20 @@ discard block |
||
451 | 451 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
452 | 452 | * @param array $entry Current entry |
453 | 453 | */ |
454 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
454 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
455 | 455 | |
456 | 456 | if ( ! $apply_outside_loop ) { |
457 | 457 | return $title; |
458 | 458 | } |
459 | 459 | |
460 | 460 | // User reported WooCommerce doesn't pass two args. |
461 | - if ( empty( $passed_post_id ) ) { |
|
461 | + if ( empty( $passed_post_id ) ) { |
|
462 | 462 | return $title; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Don't modify the title for anything other than the current view/post. |
466 | 466 | // This is true for embedded shortcodes and Views. |
467 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
467 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
468 | 468 | return $title; |
469 | 469 | } |
470 | 470 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | } else { |
488 | 488 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
489 | 489 | foreach ( gravityview()->views->all() as $_view ) { |
490 | - if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) { |
|
490 | + if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) { |
|
491 | 491 | $view = $_view; |
492 | 492 | break; |
493 | 493 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } else { |
500 | 500 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
501 | 501 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
502 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
502 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
503 | 503 | $view_meta = $view_data; |
504 | 504 | break; |
505 | 505 | } |
@@ -514,12 +514,12 @@ discard block |
||
514 | 514 | } |
515 | 515 | } else { |
516 | 516 | /** Deprecated stuff in the future. See the branch above. */ |
517 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
517 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
518 | 518 | |
519 | - $title = $view_meta['atts']['single_title']; |
|
519 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
520 | 520 | |
521 | 521 | // We are allowing HTML in the fields, so no escaping the output |
522 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
522 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
523 | 523 | |
524 | 524 | $title = do_shortcode( $title ); |
525 | 525 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | |
559 | 559 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
560 | - if( ! in_the_loop() ) { |
|
560 | + if ( ! in_the_loop() ) { |
|
561 | 561 | return $content; |
562 | 562 | } |
563 | 563 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | |
633 | 633 | $context = GravityView_View::getInstance()->getContext(); |
634 | 634 | |
635 | - switch( $context ) { |
|
635 | + switch ( $context ) { |
|
636 | 636 | case 'directory': |
637 | 637 | $tab = __( 'Multiple Entries', 'gravityview' ); |
638 | 638 | break; |
@@ -646,9 +646,9 @@ discard block |
||
646 | 646 | } |
647 | 647 | |
648 | 648 | |
649 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
649 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
650 | 650 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
651 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
651 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
652 | 652 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
653 | 653 | |
654 | 654 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | public function render_view( $passed_args ) { |
682 | 682 | |
683 | 683 | // validate attributes |
684 | - if ( empty( $passed_args['id'] ) ) { |
|
684 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
685 | 685 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
686 | 686 | return null; |
687 | 687 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | return null; |
704 | 704 | } |
705 | 705 | |
706 | - $view_id = $passed_args['id']; |
|
706 | + $view_id = $passed_args[ 'id' ]; |
|
707 | 707 | |
708 | 708 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
709 | 709 | $view = gravityview()->views->get( $view_id ); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $passed_args = array_filter( $passed_args, 'strlen' ); |
729 | 729 | |
730 | 730 | //Override shortcode args over View template settings |
731 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
731 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
732 | 732 | |
733 | 733 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
734 | 734 | } |
@@ -752,14 +752,14 @@ discard block |
||
752 | 752 | * @since 1.15 |
753 | 753 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
754 | 754 | */ |
755 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
755 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
756 | 756 | |
757 | 757 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
758 | 758 | |
759 | 759 | return null; |
760 | 760 | } |
761 | 761 | |
762 | - if( $this->isGravityviewPostType() ) { |
|
762 | + if ( $this->isGravityviewPostType() ) { |
|
763 | 763 | |
764 | 764 | /** |
765 | 765 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -775,10 +775,10 @@ discard block |
||
775 | 775 | $embed_only = $view->settings->get( 'embed_only' ); |
776 | 776 | } else { |
777 | 777 | /** Deprecated. View attributes moved to \GV\View::$settings. */ |
778 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
778 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
779 | 779 | } |
780 | 780 | |
781 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
781 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
782 | 782 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
783 | 783 | } |
784 | 784 | } |
@@ -794,13 +794,13 @@ discard block |
||
794 | 794 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
795 | 795 | $view_data = $view->as_data(); |
796 | 796 | $gravityview_view = new GravityView_View( $view_data ); |
797 | - $post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() ); |
|
797 | + $post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() ); |
|
798 | 798 | $template_id = $view->template ? $view->template->ID : null; |
799 | 799 | } else { |
800 | 800 | /** These constructs are deprecated. Use the new gravityview() wrapper. */ |
801 | 801 | $gravityview_view = new GravityView_View( $view_data ); |
802 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
803 | - $template_id = $view_data['template_id']; |
|
802 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
803 | + $template_id = $view_data[ 'template_id' ]; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | $gravityview_view->setPostId( $post_id ); |
@@ -811,20 +811,20 @@ discard block |
||
811 | 811 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
812 | 812 | |
813 | 813 | //fetch template and slug |
814 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' ); |
|
814 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' ); |
|
815 | 815 | |
816 | 816 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
817 | 817 | |
818 | 818 | /** |
819 | 819 | * Disable fetching initial entries for views that don't need it (DataTables) |
820 | 820 | */ |
821 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
821 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
822 | 822 | |
823 | 823 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
824 | 824 | $hide_until_searched = $view->settings->get( 'hide_until_searched' ); |
825 | 825 | } else { |
826 | 826 | /** $atts is deprecated, use \GV\View:$settings */ |
827 | - $hide_until_searched = ! empty( $atts['hide_until_searched'] ); |
|
827 | + $hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] ); |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | /** |
@@ -842,12 +842,12 @@ discard block |
||
842 | 842 | $sort_columns = $view->settings->get( 'sort_columns' ); |
843 | 843 | } else { |
844 | 844 | /** $atts is deprecated, use \GV\View:$settings */ |
845 | - $sort_columns = ! empty( $atts['sort_columns'] ); |
|
845 | + $sort_columns = ! empty( $atts[ 'sort_columns' ] ); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if ( $sort_columns ) { |
849 | 849 | // add filter to enable column sorting |
850 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
850 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -855,19 +855,19 @@ discard block |
||
855 | 855 | } else { |
856 | 856 | /** $atts is deprecated, use \GV\View:$settings */ |
857 | 857 | /** $view_data is depreacted, use \GV\View properties */ |
858 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
858 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
859 | 859 | } |
860 | 860 | |
861 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
861 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
862 | 862 | |
863 | 863 | } else { |
864 | 864 | |
865 | 865 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
866 | 866 | |
867 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
867 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
868 | 868 | } |
869 | 869 | |
870 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
870 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
871 | 871 | $gravityview_view->setContext( 'directory' ); |
872 | 872 | $sections = array( 'header', 'body', 'footer' ); |
873 | 873 | |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | do_action( 'gravityview_render_entry_' . $view->ID ); |
885 | 885 | } else { |
886 | 886 | /** $view_data is depreacted, use \GV\View properties */ |
887 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
887 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | $entry = $this->getEntry(); |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
896 | 896 | |
897 | 897 | // Only display warning once when multiple Views are embedded |
898 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
898 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
899 | 899 | ob_end_clean(); |
900 | 900 | return null; |
901 | 901 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
921 | 921 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views(); |
922 | 922 | if ( $multiple_views && $view_id != $this->get_context_view_id() ) { |
923 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
923 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
924 | 924 | ob_end_clean(); |
925 | 925 | return null; |
926 | 926 | } |
@@ -930,14 +930,14 @@ discard block |
||
930 | 930 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
931 | 931 | |
932 | 932 | //fetch entry detail |
933 | - $view_entries['count'] = 1; |
|
934 | - $view_entries['entries'][] = $entry; |
|
935 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
933 | + $view_entries[ 'count' ] = 1; |
|
934 | + $view_entries[ 'entries' ][ ] = $entry; |
|
935 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
936 | 936 | |
937 | 937 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
938 | 938 | $back_link_label = $view->settings->get( 'back_link_label', null ); |
939 | 939 | } else { |
940 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
940 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | // set back link label |
@@ -951,8 +951,8 @@ discard block |
||
951 | 951 | self::add_style( $template_id ); |
952 | 952 | |
953 | 953 | // Prepare to render view and set vars |
954 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
955 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
954 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
955 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
956 | 956 | |
957 | 957 | // If Edit |
958 | 958 | if ( 'edit' === gravityview_get_context() ) { |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | |
970 | 970 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
971 | 971 | foreach ( $sections as $section ) { |
972 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
972 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
973 | 973 | $gravityview_view->render( $view_slug, $section, false ); |
974 | 974 | } |
975 | 975 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | $datetime_format = 'Y-m-d H:i:s'; |
1024 | 1024 | $search_is_outside_view_bounds = false; |
1025 | 1025 | |
1026 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
1026 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
1027 | 1027 | |
1028 | 1028 | $search_date = strtotime( $search_criteria[ $key ] ); |
1029 | 1029 | |
@@ -1051,14 +1051,14 @@ discard block |
||
1051 | 1051 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
1052 | 1052 | |
1053 | 1053 | // Then we override the search and re-set the start date |
1054 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
1054 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | |
1059 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
1059 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
1060 | 1060 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
1061 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
1061 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
1062 | 1062 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
1063 | 1063 | } |
1064 | 1064 | } |
@@ -1077,19 +1077,19 @@ discard block |
||
1077 | 1077 | public static function process_search_only_approved( $args, $search_criteria ) { |
1078 | 1078 | |
1079 | 1079 | /** @since 1.19 */ |
1080 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1080 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1081 | 1081 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
1082 | 1082 | return $search_criteria; |
1083 | 1083 | } |
1084 | 1084 | |
1085 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
1085 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
1086 | 1086 | |
1087 | - $search_criteria['field_filters'][] = array( |
|
1087 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1088 | 1088 | 'key' => GravityView_Entry_Approval::meta_key, |
1089 | 1089 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
1090 | 1090 | ); |
1091 | 1091 | |
1092 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
1092 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
1093 | 1093 | |
1094 | 1094 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
1095 | 1095 | } |
@@ -1116,18 +1116,18 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | public static function is_entry_approved( $entry, $args = array() ) { |
1118 | 1118 | |
1119 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
1119 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1120 | 1120 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
1121 | 1121 | return true; |
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | /** @since 1.19 */ |
1125 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1125 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1126 | 1126 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
1127 | 1127 | return true; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
1130 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1131 | 1131 | |
1132 | 1132 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
1133 | 1133 | } |
@@ -1161,26 +1161,26 @@ discard block |
||
1161 | 1161 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
1162 | 1162 | |
1163 | 1163 | // implicity search |
1164 | - if ( ! empty( $args['search_value'] ) ) { |
|
1164 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1165 | 1165 | |
1166 | 1166 | // Search operator options. Options: `is` or `contains` |
1167 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
1167 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1168 | 1168 | |
1169 | - $search_criteria['field_filters'][] = array( |
|
1169 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1170 | 1170 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
1171 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1171 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1172 | 1172 | 'operator' => $operator, |
1173 | 1173 | ); |
1174 | 1174 | } |
1175 | 1175 | |
1176 | - if( $search_criteria !== $original_search_criteria ) { |
|
1176 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1177 | 1177 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | // Handle setting date range |
1181 | 1181 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1182 | 1182 | |
1183 | - if( $search_criteria !== $original_search_criteria ) { |
|
1183 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1184 | 1184 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1192 | 1192 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1193 | 1193 | */ |
1194 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1194 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1195 | 1195 | |
1196 | 1196 | return $search_criteria; |
1197 | 1197 | } |
@@ -1240,19 +1240,19 @@ discard block |
||
1240 | 1240 | $form = \GV\GF_Form::by_id( $form_id ); |
1241 | 1241 | |
1242 | 1242 | $entries = $form->entries |
1243 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1244 | - ->offset( $args['offset'] ) |
|
1245 | - ->limit( $parameters['paging']['page_size'] ) |
|
1246 | - ->page( ( ( $parameters['paging']['offset'] - $args['offset'] ) / $parameters['paging']['page_size'] ) + 1 ); |
|
1243 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1244 | + ->offset( $args[ 'offset' ] ) |
|
1245 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1246 | + ->page( ( ( $parameters[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
1247 | 1247 | |
1248 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
1248 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
1249 | 1249 | $field = new \GV\Field(); |
1250 | - $field->ID = $parameters['sorting']['key']; |
|
1251 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1250 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1251 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1252 | 1252 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1253 | 1253 | } |
1254 | 1254 | |
1255 | - $parameters['paging'] = array( |
|
1255 | + $parameters[ 'paging' ] = array( |
|
1256 | 1256 | 'offset' => ( $entries->current_page - 1 ) * $entries->limit, |
1257 | 1257 | 'page_size' => $entries->limit, |
1258 | 1258 | ); |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | 'search_criteria' => $search_criteria, |
1333 | 1333 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1334 | 1334 | 'paging' => $paging, |
1335 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1335 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1336 | 1336 | ); |
1337 | 1337 | |
1338 | 1338 | /** |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1358 | 1358 | * @param array $args View configuration args. |
1359 | 1359 | */ |
1360 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1360 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1361 | 1361 | |
1362 | 1362 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1363 | 1363 | |
@@ -1382,17 +1382,17 @@ discard block |
||
1382 | 1382 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1383 | 1383 | |
1384 | 1384 | // Paging & offset |
1385 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1385 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1386 | 1386 | |
1387 | 1387 | if ( -1 === $page_size ) { |
1388 | 1388 | $page_size = PHP_INT_MAX; |
1389 | 1389 | } |
1390 | 1390 | |
1391 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1391 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1392 | 1392 | $offset = ( $curr_page - 1 ) * $page_size; |
1393 | 1393 | |
1394 | - if ( ! empty( $args['offset'] ) ) { |
|
1395 | - $offset += intval( $args['offset'] ); |
|
1394 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1395 | + $offset += intval( $args[ 'offset' ] ); |
|
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | $paging = array( |
@@ -1416,8 +1416,8 @@ discard block |
||
1416 | 1416 | */ |
1417 | 1417 | public static function updateViewSorting( $args, $form_id ) { |
1418 | 1418 | $sorting = array(); |
1419 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1420 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1419 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1420 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1421 | 1421 | |
1422 | 1422 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1423 | 1423 | |
@@ -1457,11 +1457,11 @@ discard block |
||
1457 | 1457 | |
1458 | 1458 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1459 | 1459 | |
1460 | - if( ! $sort_field ) { |
|
1460 | + if ( ! $sort_field ) { |
|
1461 | 1461 | return $sort_field_id; |
1462 | 1462 | } |
1463 | 1463 | |
1464 | - switch ( $sort_field['type'] ) { |
|
1464 | + switch ( $sort_field[ 'type' ] ) { |
|
1465 | 1465 | |
1466 | 1466 | case 'address': |
1467 | 1467 | // Sorting by full address |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | */ |
1479 | 1479 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1480 | 1480 | |
1481 | - switch( strtolower( $address_part ) ){ |
|
1481 | + switch ( strtolower( $address_part ) ) { |
|
1482 | 1482 | case 'street': |
1483 | 1483 | $sort_field_id .= '.1'; |
1484 | 1484 | break; |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | */ |
1564 | 1564 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1565 | 1565 | |
1566 | - if ( empty( $single_entry ) ){ |
|
1566 | + if ( empty( $single_entry ) ) { |
|
1567 | 1567 | return false; |
1568 | 1568 | } else { |
1569 | 1569 | return $single_entry; |
@@ -1596,14 +1596,14 @@ discard block |
||
1596 | 1596 | $template_id = $view->template ? $view->template->ID : null; |
1597 | 1597 | $data = $view->as_data(); |
1598 | 1598 | } else { |
1599 | - $template_id = $data['template_id']; |
|
1599 | + $template_id = $data[ 'template_id' ]; |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | /** |
1603 | 1603 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1604 | 1604 | * @since 1.15 |
1605 | 1605 | */ |
1606 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1606 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1607 | 1607 | continue; |
1608 | 1608 | } |
1609 | 1609 | |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | $lightbox = $view->settings->get( 'lightbox' ); |
1616 | 1616 | } else { |
1617 | 1617 | /** View data attributes are now stored in \GV\View::$settings */ |
1618 | - $lightbox = ! empty( $data['atts']['lightbox'] ); |
|
1618 | + $lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] ); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | 1621 | // If the thickbox is enqueued, add dependencies |
@@ -1625,13 +1625,13 @@ discard block |
||
1625 | 1625 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1626 | 1626 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1627 | 1627 | */ |
1628 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1628 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1629 | 1629 | |
1630 | 1630 | /** |
1631 | 1631 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1632 | 1632 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1633 | 1633 | */ |
1634 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1634 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | /** |
@@ -1639,19 +1639,19 @@ discard block |
||
1639 | 1639 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1640 | 1640 | * @since 1.15 |
1641 | 1641 | */ |
1642 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1643 | - $css_dependencies[] = 'dashicons'; |
|
1642 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1643 | + $css_dependencies[ ] = 'dashicons'; |
|
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1647 | 1647 | |
1648 | 1648 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1649 | 1649 | |
1650 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1650 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1651 | 1651 | |
1652 | 1652 | wp_enqueue_script( 'gravityview-fe-view' ); |
1653 | 1653 | |
1654 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1654 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1655 | 1655 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1656 | 1656 | } |
1657 | 1657 | |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | } elseif ( empty( $template_id ) ) { |
1720 | 1720 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1721 | 1721 | } else { |
1722 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1722 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | } |
@@ -1744,11 +1744,11 @@ discard block |
||
1744 | 1744 | * Not a table-based template; don't add sort icons |
1745 | 1745 | * @since 1.12 |
1746 | 1746 | */ |
1747 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1747 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1748 | 1748 | return $label; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1751 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1752 | 1752 | return $label; |
1753 | 1753 | } |
1754 | 1754 | |
@@ -1756,29 +1756,29 @@ discard block |
||
1756 | 1756 | |
1757 | 1757 | $class = 'gv-sort'; |
1758 | 1758 | |
1759 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1759 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1760 | 1760 | |
1761 | 1761 | $sort_args = array( |
1762 | - 'sort' => $field['id'], |
|
1762 | + 'sort' => $field[ 'id' ], |
|
1763 | 1763 | 'dir' => 'asc', |
1764 | 1764 | ); |
1765 | 1765 | |
1766 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1766 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1767 | 1767 | //toggle sorting direction. |
1768 | - if ( 'asc' === $sorting['direction'] ) { |
|
1769 | - $sort_args['dir'] = 'desc'; |
|
1768 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1769 | + $sort_args[ 'dir' ] = 'desc'; |
|
1770 | 1770 | $class .= ' gv-icon-sort-desc'; |
1771 | 1771 | } else { |
1772 | - $sort_args['dir'] = 'asc'; |
|
1772 | + $sort_args[ 'dir' ] = 'asc'; |
|
1773 | 1773 | $class .= ' gv-icon-sort-asc'; |
1774 | 1774 | } |
1775 | 1775 | } else { |
1776 | 1776 | $class .= ' gv-icon-caret-up-down'; |
1777 | 1777 | } |
1778 | 1778 | |
1779 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1779 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1780 | 1780 | |
1781 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1781 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1782 | 1782 | |
1783 | 1783 | } |
1784 | 1784 | |
@@ -1796,7 +1796,7 @@ discard block |
||
1796 | 1796 | |
1797 | 1797 | $field_type = $field_id; |
1798 | 1798 | |
1799 | - if( is_numeric( $field_id ) ) { |
|
1799 | + if ( is_numeric( $field_id ) ) { |
|
1800 | 1800 | $field = GFFormsModel::get_field( $form, $field_id ); |
1801 | 1801 | $field_type = $field->type; |
1802 | 1802 | } |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | return false; |
1820 | 1820 | } |
1821 | 1821 | |
1822 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1822 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1823 | 1823 | |
1824 | 1824 | } |
1825 | 1825 |
@@ -129,12 +129,12 @@ |
||
129 | 129 | |
130 | 130 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
131 | 131 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
132 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
132 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
137 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
136 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
137 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
138 | 138 | if ( ! $view ) { |
139 | 139 | continue; |
140 | 140 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | /** Call all lazy callbacks. */ |
105 | 105 | foreach ( $this->callbacks as $callback ) { |
106 | - if ( $callback[0] != 'count' ) { |
|
106 | + if ( $callback[ 0 ] != 'count' ) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | - $total += $callback[1]( $this->filters ); |
|
110 | + $total += $callback[ 1 ]( $this->filters ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $total - $this->offset; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | /** Call all lazy callbacks. */ |
163 | 163 | foreach ( $this->callbacks as $i => $callback ) { |
164 | - if ( $callback[0] != 'fetch' ) { |
|
164 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
168 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $this->fetched = $this->count(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return; |
322 | 322 | } |
323 | 323 | |
324 | - $this->callbacks []= array( $type, $callback ); |
|
324 | + $this->callbacks [ ] = array( $type, $callback ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @return void |
26 | 26 | */ |
27 | 27 | public function add( $value ) { |
28 | - $this->storage []= $value; |
|
28 | + $this->storage [ ] = $value; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function merge( \GV\Collection $collection ) { |
52 | - array_map( array( $this, 'add'), $collection->all() ); |
|
52 | + array_map( array( $this, 'add' ), $collection->all() ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @return string The version of PHP. |
206 | 206 | */ |
207 | 207 | private function get_php_version() { |
208 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
209 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
208 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
209 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | * @return string The version of WordPress. |
218 | 218 | */ |
219 | 219 | private function get_wordpress_version() { |
220 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
221 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
220 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
221 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | * @return string The version of Gravity Forms. |
231 | 231 | */ |
232 | 232 | private function get_gravityforms_version() { |
233 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
233 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
234 | 234 | throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
235 | 235 | } |
236 | 236 | |
237 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
238 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
237 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
238 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | private function __clone() { } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | protected function log( $level, $message, $context ) { |
29 | 29 | |
30 | 30 | $backtrace = debug_backtrace(); |
31 | - $location = $this->interpolate( "{class}{type}{function}", $backtrace[2] ); |
|
31 | + $location = $this->interpolate( "{class}{type}{function}", $backtrace[ 2 ] ); |
|
32 | 32 | |
33 | 33 | $message = $this->interpolate( "[$level, $location] $message", $context ); |
34 | 34 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | do_action( |
53 | 53 | sprintf( 'gravityview_log_%s_test', $action ), |
54 | 54 | $this->interpolate( $message, $context ), |
55 | - empty( $context['data'] ) ? array() : $context['data'] |
|
55 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | do_action( |
60 | 60 | sprintf( 'gravityview_log_%s', $action ), |
61 | 61 | $this->interpolate( $message, $context ), |
62 | - empty( $context['data'] ) ? array() : $context['data'] |
|
62 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function emergency($message, array $context = array()) |
|
39 | + public function emergency( $message, array $context = array() ) |
|
40 | 40 | { |
41 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
41 | + $this->log( LogLevel::EMERGENCY, $message, $context ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function alert($message, array $context = array()) |
|
55 | + public function alert( $message, array $context = array() ) |
|
56 | 56 | { |
57 | - $this->log(LogLevel::ALERT, $message, $context); |
|
57 | + $this->log( LogLevel::ALERT, $message, $context ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function critical($message, array $context = array()) |
|
70 | + public function critical( $message, array $context = array() ) |
|
71 | 71 | { |
72 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
72 | + $this->log( LogLevel::CRITICAL, $message, $context ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function error($message, array $context = array()) |
|
84 | + public function error( $message, array $context = array() ) |
|
85 | 85 | { |
86 | - $this->log(LogLevel::ERROR, $message, $context); |
|
86 | + $this->log( LogLevel::ERROR, $message, $context ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - public function warning($message, array $context = array()) |
|
100 | + public function warning( $message, array $context = array() ) |
|
101 | 101 | { |
102 | - $this->log(LogLevel::WARNING, $message, $context); |
|
102 | + $this->log( LogLevel::WARNING, $message, $context ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function notice($message, array $context = array()) |
|
113 | + public function notice( $message, array $context = array() ) |
|
114 | 114 | { |
115 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
115 | + $this->log( LogLevel::NOTICE, $message, $context ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function info($message, array $context = array()) |
|
128 | + public function info( $message, array $context = array() ) |
|
129 | 129 | { |
130 | - $this->log(LogLevel::INFO, $message, $context); |
|
130 | + $this->log( LogLevel::INFO, $message, $context ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function debug($message, array $context = array()) |
|
141 | + public function debug( $message, array $context = array() ) |
|
142 | 142 | { |
143 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
143 | + $this->log( LogLevel::DEBUG, $message, $context ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return void |
32 | 32 | */ |
33 | 33 | public function __set( $key, $value ) { |
34 | - $this->_context[$key] = $value; |
|
34 | + $this->_context[ $key ] = $value; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed|null |
46 | 46 | */ |
47 | 47 | public function __get( $key ) { |
48 | - return isset( $this->_context[$key] ) ? $this->_context[$key] : null; |
|
48 | + return isset( $this->_context[ $key ] ) ? $this->_context[ $key ] : null; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |