@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base Entry class. |
@@ -24,8 +25,9 @@ discard block |
||
24 | 25 | $endpoint = self::get_endpoint_name(); |
25 | 26 | |
26 | 27 | /** Let's make sure the endpoint array is not polluted. */ |
27 | - if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) |
|
28 | - return; |
|
28 | + if ( in_array( array( EP_ALL, $endpoint, $endpoint ), $wp_rewrite->endpoints ) ) { |
|
29 | + return; |
|
30 | + } |
|
29 | 31 | |
30 | 32 | add_rewrite_endpoint( $endpoint, EP_ALL ); |
31 | 33 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $supports = array( 'title', 'revisions' ); |
36 | 36 | |
37 | 37 | if ( $is_hierarchical ) { |
38 | - $supports[] = 'page-attributes'; |
|
38 | + $supports[ ] = 'page-attributes'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The default GravityView View class. |
@@ -21,8 +22,9 @@ discard block |
||
21 | 22 | public static function register_post_type() { |
22 | 23 | |
23 | 24 | /** Register only once */ |
24 | - if ( post_type_exists( 'gravityview' ) ) |
|
25 | - return; |
|
25 | + if ( post_type_exists( 'gravityview' ) ) { |
|
26 | + return; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | /** |
28 | 30 | * @filter `gravityview_is_hierarchical` Make GravityView Views hierarchical by returning TRUE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Sets the single entry ID and also the entry |
156 | - * @param bool|int|string $single_entry |
|
156 | + * @param boolean|string $single_entry |
|
157 | 157 | */ |
158 | 158 | public function setSingleEntry( $single_entry ) { |
159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * Set the current entry |
173 | - * @param array|int $entry Entry array or entry slug or ID |
|
173 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
174 | 174 | */ |
175 | 175 | public function setEntry( $entry ) { |
176 | 176 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * |
230 | 230 | * |
231 | - * @param null $view_id |
|
231 | + * @param string $view_id |
|
232 | 232 | */ |
233 | 233 | public function set_context_view_id( $view_id = null ) { |
234 | 234 | |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @uses gravityview_get_entries() |
1107 | 1107 | * @access public |
1108 | - * @param array $args\n |
|
1108 | + * @param array $args |
|
1109 | 1109 | * - $id - View id |
1110 | 1110 | * - $page_size - Page |
1111 | 1111 | * - $sort_field - form field id to sort |
@@ -1193,7 +1193,6 @@ discard block |
||
1193 | 1193 | * @since 1.19.5 |
1194 | 1194 | * |
1195 | 1195 | * @param $args |
1196 | - * @param int $form_id |
|
1197 | 1196 | */ |
1198 | 1197 | public static function get_search_criteria_paging( $args ) { |
1199 | 1198 | |
@@ -1588,7 +1587,7 @@ discard block |
||
1588 | 1587 | /** |
1589 | 1588 | * Checks if field (column) is sortable |
1590 | 1589 | * |
1591 | - * @param string $field Field settings |
|
1590 | + * @param string $field_id Field settings |
|
1592 | 1591 | * @param array $form Gravity Forms form array |
1593 | 1592 | * |
1594 | 1593 | * @since 1.7 |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | $this->context_view_id = $_GET['gvid']; |
246 | 246 | |
247 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
247 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
248 | 248 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
249 | 249 | $this->context_view_id = array_pop( $array_keys ); |
250 | 250 | unset( $array_keys ); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | // User reported WooCommerce doesn't pass two args. |
455 | - if ( empty( $passed_post_id ) ) { |
|
455 | + if ( empty( $passed_post_id ) ) { |
|
456 | 456 | return $title; |
457 | 457 | } |
458 | 458 | |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1309 | 1309 | |
1310 | - switch( strtolower( $address_part ) ){ |
|
1310 | + switch( strtolower( $address_part ) ) { |
|
1311 | 1311 | case 'street': |
1312 | 1312 | $sort_field_id .= '.1'; |
1313 | 1313 | break; |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | */ |
1393 | 1393 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1394 | 1394 | |
1395 | - if ( empty( $single_entry ) ){ |
|
1395 | + if ( empty( $single_entry ) ) { |
|
1396 | 1396 | return false; |
1397 | 1397 | } else { |
1398 | 1398 | return $single_entry; |
@@ -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 ); |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | |
237 | 237 | $this->context_view_id = $view_id; |
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
244 | 244 | */ |
245 | - $this->context_view_id = $_GET['gvid']; |
|
245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
246 | 246 | |
247 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
247 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
248 | 248 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
249 | 249 | $this->context_view_id = array_pop( $array_keys ); |
250 | 250 | unset( $array_keys ); |
@@ -279,24 +279,24 @@ discard block |
||
279 | 279 | global $wp_rewrite; |
280 | 280 | |
281 | 281 | $is_front_page = ( $query->is_home || $query->is_page ); |
282 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
283 | - $front_page_id = get_option('page_on_front'); |
|
282 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
283 | + $front_page_id = get_option( 'page_on_front' ); |
|
284 | 284 | |
285 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
286 | 286 | |
287 | 287 | // Force to be an array, potentially a query string ( entry=16 ) |
288 | 288 | $_query = wp_parse_args( $query->query ); |
289 | 289 | |
290 | 290 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
291 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
292 | - unset( $_query['pagename'] ); |
|
291 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
292 | + unset( $_query[ 'pagename' ] ); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // this is where will break from core wordpress |
296 | 296 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
297 | 297 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
355 | 355 | |
356 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
356 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
357 | 357 | $this->setPostId( $post_id ); |
358 | 358 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
359 | 359 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
391 | 391 | |
392 | - if( 'post' === $search_method ) { |
|
392 | + if ( 'post' === $search_method ) { |
|
393 | 393 | $get = $_POST; |
394 | 394 | } else { |
395 | 395 | $get = $_GET; |
@@ -445,20 +445,20 @@ discard block |
||
445 | 445 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
446 | 446 | * @param array $entry Current entry |
447 | 447 | */ |
448 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
448 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
449 | 449 | |
450 | 450 | if ( ! $apply_outside_loop ) { |
451 | 451 | return $title; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // User reported WooCommerce doesn't pass two args. |
455 | - if ( empty( $passed_post_id ) ) { |
|
455 | + if ( empty( $passed_post_id ) ) { |
|
456 | 456 | return $title; |
457 | 457 | } |
458 | 458 | |
459 | 459 | // Don't modify the title for anything other than the current view/post. |
460 | 460 | // This is true for embedded shortcodes and Views. |
461 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
461 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
462 | 462 | return $title; |
463 | 463 | } |
464 | 464 | |
@@ -468,19 +468,19 @@ discard block |
||
468 | 468 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
469 | 469 | } else { |
470 | 470 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
471 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
471 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
472 | 472 | $view_meta = $view_data; |
473 | 473 | break; |
474 | 474 | } |
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
478 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
479 | 479 | |
480 | - $title = $view_meta['atts']['single_title']; |
|
480 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
481 | 481 | |
482 | 482 | // We are allowing HTML in the fields, so no escaping the output |
483 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
483 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
484 | 484 | |
485 | 485 | $title = do_shortcode( $title ); |
486 | 486 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
519 | - if( ! in_the_loop() ) { |
|
519 | + if ( ! in_the_loop() ) { |
|
520 | 520 | return $content; |
521 | 521 | } |
522 | 522 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | |
585 | 585 | $context = GravityView_View::getInstance()->getContext(); |
586 | 586 | |
587 | - switch( $context ) { |
|
587 | + switch ( $context ) { |
|
588 | 588 | case 'directory': |
589 | 589 | $tab = __( 'Multiple Entries', 'gravityview' ); |
590 | 590 | break; |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | } |
599 | 599 | |
600 | 600 | |
601 | - $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 ); |
|
601 | + $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 ); |
|
602 | 602 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
603 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
603 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
604 | 604 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
605 | 605 | |
606 | 606 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | public function render_view( $passed_args ) { |
634 | 634 | |
635 | 635 | // validate attributes |
636 | - if ( empty( $passed_args['id'] ) ) { |
|
636 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
637 | 637 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
638 | 638 | return null; |
639 | 639 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | return null; |
656 | 656 | } |
657 | 657 | |
658 | - $view_id = $passed_args['id']; |
|
658 | + $view_id = $passed_args[ 'id' ]; |
|
659 | 659 | |
660 | 660 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
661 | 661 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $passed_args = array_filter( $passed_args, 'strlen' ); |
669 | 669 | |
670 | 670 | //Override shortcode args over View template settings |
671 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
671 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
672 | 672 | |
673 | 673 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
674 | 674 | |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | * @since 1.15 |
692 | 692 | * @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. |
693 | 693 | */ |
694 | - 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 ) ) { |
|
694 | + 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 ) ) { |
|
695 | 695 | |
696 | 696 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
697 | 697 | |
698 | 698 | return null; |
699 | 699 | } |
700 | 700 | |
701 | - if( $this->isGravityviewPostType() ) { |
|
701 | + if ( $this->isGravityviewPostType() ) { |
|
702 | 702 | |
703 | 703 | /** |
704 | 704 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -710,9 +710,9 @@ discard block |
||
710 | 710 | */ |
711 | 711 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
712 | 712 | |
713 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
713 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
714 | 714 | |
715 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
715 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
716 | 716 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
717 | 717 | } |
718 | 718 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | $gravityview_view = new GravityView_View( $view_data ); |
729 | 729 | |
730 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
730 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
731 | 731 | |
732 | 732 | $gravityview_view->setPostId( $post_id ); |
733 | 733 | |
@@ -737,20 +737,20 @@ discard block |
||
737 | 737 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
738 | 738 | |
739 | 739 | //fetch template and slug |
740 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
740 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
741 | 741 | |
742 | 742 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
743 | 743 | |
744 | 744 | /** |
745 | 745 | * Disable fetching initial entries for views that don't need it (DataTables) |
746 | 746 | */ |
747 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
747 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
748 | 748 | |
749 | 749 | /** |
750 | 750 | * Hide View data until search is performed |
751 | 751 | * @since 1.5.4 |
752 | 752 | */ |
753 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
753 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
754 | 754 | $gravityview_view->setHideUntilSearched( true ); |
755 | 755 | $get_entries = false; |
756 | 756 | } |
@@ -758,23 +758,23 @@ discard block |
||
758 | 758 | |
759 | 759 | if ( $get_entries ) { |
760 | 760 | |
761 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
761 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
762 | 762 | // add filter to enable column sorting |
763 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
763 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
764 | 764 | } |
765 | 765 | |
766 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
766 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
767 | 767 | |
768 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
768 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
769 | 769 | |
770 | 770 | } else { |
771 | 771 | |
772 | 772 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
773 | 773 | |
774 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
774 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
775 | 775 | } |
776 | 776 | |
777 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
777 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
778 | 778 | $gravityview_view->setContext( 'directory' ); |
779 | 779 | $sections = array( 'header', 'body', 'footer' ); |
780 | 780 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
789 | 789 | * @since 1.17 |
790 | 790 | */ |
791 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
791 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
792 | 792 | |
793 | 793 | $entry = $this->getEntry(); |
794 | 794 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
799 | 799 | |
800 | 800 | // Only display warning once when multiple Views are embedded |
801 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
801 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
802 | 802 | ob_end_clean(); |
803 | 803 | return null; |
804 | 804 | } |
@@ -822,21 +822,21 @@ discard block |
||
822 | 822 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
823 | 823 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
824 | 824 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
825 | - 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 ); |
|
825 | + 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 ); |
|
826 | 826 | ob_end_clean(); |
827 | 827 | return null; |
828 | 828 | } |
829 | 829 | |
830 | 830 | //fetch template and slug |
831 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
831 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
832 | 832 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
833 | 833 | |
834 | 834 | //fetch entry detail |
835 | - $view_entries['count'] = 1; |
|
836 | - $view_entries['entries'][] = $entry; |
|
837 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
835 | + $view_entries[ 'count' ] = 1; |
|
836 | + $view_entries[ 'entries' ][ ] = $entry; |
|
837 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
838 | 838 | |
839 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
839 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
840 | 840 | |
841 | 841 | // set back link label |
842 | 842 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -846,11 +846,11 @@ discard block |
||
846 | 846 | } |
847 | 847 | |
848 | 848 | // add template style |
849 | - self::add_style( $view_data['template_id'] ); |
|
849 | + self::add_style( $view_data[ 'template_id' ] ); |
|
850 | 850 | |
851 | 851 | // Prepare to render view and set vars |
852 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
853 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
852 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
853 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
854 | 854 | |
855 | 855 | // If Edit |
856 | 856 | if ( 'edit' === gravityview_get_context() ) { |
@@ -863,11 +863,11 @@ discard block |
||
863 | 863 | |
864 | 864 | } else { |
865 | 865 | // finaly we'll render some html |
866 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
866 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
867 | 867 | |
868 | 868 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
869 | 869 | foreach ( $sections as $section ) { |
870 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
870 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
871 | 871 | $gravityview_view->render( $view_slug, $section, false ); |
872 | 872 | } |
873 | 873 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | $datetime_format = 'Y-m-d H:i:s'; |
922 | 922 | $search_is_outside_view_bounds = false; |
923 | 923 | |
924 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
924 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
925 | 925 | |
926 | 926 | $search_date = strtotime( $search_criteria[ $key ] ); |
927 | 927 | |
@@ -949,14 +949,14 @@ discard block |
||
949 | 949 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
950 | 950 | |
951 | 951 | // Then we override the search and re-set the start date |
952 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
952 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
957 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
958 | 958 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
959 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
959 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
960 | 960 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
961 | 961 | } |
962 | 962 | } |
@@ -975,19 +975,19 @@ discard block |
||
975 | 975 | public static function process_search_only_approved( $args, $search_criteria ) { |
976 | 976 | |
977 | 977 | /** @since 1.19 */ |
978 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
978 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
979 | 979 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
980 | 980 | return $search_criteria; |
981 | 981 | } |
982 | 982 | |
983 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
983 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
984 | 984 | |
985 | - $search_criteria['field_filters'][] = array( |
|
985 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
986 | 986 | 'key' => GravityView_Entry_Approval::meta_key, |
987 | 987 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
988 | 988 | ); |
989 | 989 | |
990 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
990 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
991 | 991 | |
992 | 992 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
993 | 993 | } |
@@ -1014,18 +1014,18 @@ discard block |
||
1014 | 1014 | */ |
1015 | 1015 | public static function is_entry_approved( $entry, $args = array() ) { |
1016 | 1016 | |
1017 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
1017 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1018 | 1018 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
1019 | 1019 | return true; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | /** @since 1.19 */ |
1023 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1023 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1024 | 1024 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
1025 | 1025 | return true; |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
1028 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1029 | 1029 | |
1030 | 1030 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
1031 | 1031 | } |
@@ -1059,26 +1059,26 @@ discard block |
||
1059 | 1059 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
1060 | 1060 | |
1061 | 1061 | // implicity search |
1062 | - if ( ! empty( $args['search_value'] ) ) { |
|
1062 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1063 | 1063 | |
1064 | 1064 | // Search operator options. Options: `is` or `contains` |
1065 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
1065 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1066 | 1066 | |
1067 | - $search_criteria['field_filters'][] = array( |
|
1067 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1068 | 1068 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
1069 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1069 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1070 | 1070 | 'operator' => $operator, |
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - if( $search_criteria !== $original_search_criteria ) { |
|
1074 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1075 | 1075 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | // Handle setting date range |
1079 | 1079 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1080 | 1080 | |
1081 | - if( $search_criteria !== $original_search_criteria ) { |
|
1081 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1082 | 1082 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1083 | 1083 | } |
1084 | 1084 | |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1090 | 1090 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1091 | 1091 | */ |
1092 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1092 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1093 | 1093 | |
1094 | 1094 | return $search_criteria; |
1095 | 1095 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | 'search_criteria' => $search_criteria, |
1202 | 1202 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1203 | 1203 | 'paging' => $paging, |
1204 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1204 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1205 | 1205 | ); |
1206 | 1206 | |
1207 | 1207 | /** |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1227 | 1227 | * @param array $args View configuration args. |
1228 | 1228 | */ |
1229 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1229 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1230 | 1230 | |
1231 | 1231 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1232 | 1232 | |
@@ -1251,16 +1251,16 @@ discard block |
||
1251 | 1251 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1252 | 1252 | |
1253 | 1253 | // Paging & offset |
1254 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1254 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1255 | 1255 | |
1256 | 1256 | if ( -1 === $page_size ) { |
1257 | 1257 | $page_size = PHP_INT_MAX; |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if ( isset( $args['offset'] ) ) { |
|
1261 | - $offset = intval( $args['offset'] ); |
|
1260 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1261 | + $offset = intval( $args[ 'offset' ] ); |
|
1262 | 1262 | } else { |
1263 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1263 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1264 | 1264 | $offset = ( $curr_page - 1 ) * $page_size; |
1265 | 1265 | } |
1266 | 1266 | |
@@ -1285,8 +1285,8 @@ discard block |
||
1285 | 1285 | */ |
1286 | 1286 | public static function updateViewSorting( $args, $form_id ) { |
1287 | 1287 | $sorting = array(); |
1288 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1289 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1288 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1289 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1290 | 1290 | |
1291 | 1291 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1292 | 1292 | |
@@ -1326,11 +1326,11 @@ discard block |
||
1326 | 1326 | |
1327 | 1327 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1328 | 1328 | |
1329 | - if( ! $sort_field ) { |
|
1329 | + if ( ! $sort_field ) { |
|
1330 | 1330 | return $sort_field_id; |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - switch ( $sort_field['type'] ) { |
|
1333 | + switch ( $sort_field[ 'type' ] ) { |
|
1334 | 1334 | |
1335 | 1335 | case 'address': |
1336 | 1336 | // Sorting by full address |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | */ |
1348 | 1348 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1349 | 1349 | |
1350 | - switch( strtolower( $address_part ) ){ |
|
1350 | + switch ( strtolower( $address_part ) ) { |
|
1351 | 1351 | case 'street': |
1352 | 1352 | $sort_field_id .= '.1'; |
1353 | 1353 | break; |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | */ |
1433 | 1433 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1434 | 1434 | |
1435 | - if ( empty( $single_entry ) ){ |
|
1435 | + if ( empty( $single_entry ) ) { |
|
1436 | 1436 | return false; |
1437 | 1437 | } else { |
1438 | 1438 | return $single_entry; |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1460 | 1460 | * @since 1.15 |
1461 | 1461 | */ |
1462 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1462 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1463 | 1463 | continue; |
1464 | 1464 | } |
1465 | 1465 | |
@@ -1468,19 +1468,19 @@ discard block |
||
1468 | 1468 | $css_dependencies = array(); |
1469 | 1469 | |
1470 | 1470 | // If the thickbox is enqueued, add dependencies |
1471 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1471 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1472 | 1472 | |
1473 | 1473 | /** |
1474 | 1474 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1475 | 1475 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1476 | 1476 | */ |
1477 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1477 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1478 | 1478 | |
1479 | 1479 | /** |
1480 | 1480 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1481 | 1481 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1482 | 1482 | */ |
1483 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1483 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | /** |
@@ -1488,25 +1488,25 @@ discard block |
||
1488 | 1488 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1489 | 1489 | * @since 1.15 |
1490 | 1490 | */ |
1491 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1492 | - $css_dependencies[] = 'dashicons'; |
|
1491 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1492 | + $css_dependencies[ ] = 'dashicons'; |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1496 | 1496 | |
1497 | 1497 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1498 | 1498 | |
1499 | - 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 ); |
|
1499 | + 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 ); |
|
1500 | 1500 | |
1501 | 1501 | wp_enqueue_script( 'gravityview-fe-view' ); |
1502 | 1502 | |
1503 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1503 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1504 | 1504 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | $this->enqueue_default_style( $css_dependencies ); |
1508 | 1508 | |
1509 | - self::add_style( $data['template_id'] ); |
|
1509 | + self::add_style( $data[ 'template_id' ] ); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | } elseif ( empty( $template_id ) ) { |
1569 | 1569 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1570 | 1570 | } else { |
1571 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1571 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | } |
@@ -1593,11 +1593,11 @@ discard block |
||
1593 | 1593 | * Not a table-based template; don't add sort icons |
1594 | 1594 | * @since 1.12 |
1595 | 1595 | */ |
1596 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1596 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1597 | 1597 | return $label; |
1598 | 1598 | } |
1599 | 1599 | |
1600 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1600 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1601 | 1601 | return $label; |
1602 | 1602 | } |
1603 | 1603 | |
@@ -1605,29 +1605,29 @@ discard block |
||
1605 | 1605 | |
1606 | 1606 | $class = 'gv-sort'; |
1607 | 1607 | |
1608 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1608 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1609 | 1609 | |
1610 | 1610 | $sort_args = array( |
1611 | - 'sort' => $field['id'], |
|
1611 | + 'sort' => $field[ 'id' ], |
|
1612 | 1612 | 'dir' => 'asc', |
1613 | 1613 | ); |
1614 | 1614 | |
1615 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1615 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1616 | 1616 | //toggle sorting direction. |
1617 | - if ( 'asc' === $sorting['direction'] ) { |
|
1618 | - $sort_args['dir'] = 'desc'; |
|
1617 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1618 | + $sort_args[ 'dir' ] = 'desc'; |
|
1619 | 1619 | $class .= ' gv-icon-sort-desc'; |
1620 | 1620 | } else { |
1621 | - $sort_args['dir'] = 'asc'; |
|
1621 | + $sort_args[ 'dir' ] = 'asc'; |
|
1622 | 1622 | $class .= ' gv-icon-sort-asc'; |
1623 | 1623 | } |
1624 | 1624 | } else { |
1625 | 1625 | $class .= ' gv-icon-caret-up-down'; |
1626 | 1626 | } |
1627 | 1627 | |
1628 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1628 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1629 | 1629 | |
1630 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1630 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1631 | 1631 | |
1632 | 1632 | } |
1633 | 1633 | |
@@ -1645,7 +1645,7 @@ discard block |
||
1645 | 1645 | |
1646 | 1646 | $field_type = $field_id; |
1647 | 1647 | |
1648 | - if( is_numeric( $field_id ) ) { |
|
1648 | + if ( is_numeric( $field_id ) ) { |
|
1649 | 1649 | $field = GFFormsModel::get_field( $form, $field_id ); |
1650 | 1650 | $field_type = $field->type; |
1651 | 1651 | } |
@@ -1668,7 +1668,7 @@ discard block |
||
1668 | 1668 | return false; |
1669 | 1669 | } |
1670 | 1670 | |
1671 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1671 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1672 | 1672 | |
1673 | 1673 | } |
1674 | 1674 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
17 | + var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
46 | 46 | |
47 | 47 | // It's not the parent field; it's an input |
48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
49 | 49 | |
50 | - if( $this->is_choice_value_enabled() ) { |
|
50 | + if ( $this->is_choice_value_enabled() ) { |
|
51 | 51 | |
52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - $field_options['choice_display'] = array( |
|
68 | + $field_options[ 'choice_display' ] = array( |
|
69 | 69 | 'type' => 'radio', |
70 | 70 | 'class' => 'vertical', |
71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
51 | 51 | |
52 | - if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
52 | + if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see GVCommon::entry_has_transaction_data() |
102 | 102 | * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine. |
103 | 103 | */ |
104 | - $hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
104 | + $hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
105 | 105 | |
106 | 106 | return $hide_product_fields; |
107 | 107 | } |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The Request abstract class. |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base \GV\Shortcode class. |
@@ -50,7 +50,6 @@ |
||
50 | 50 | * |
51 | 51 | * @throws \ErrorException if shortcode with this name has already been registered elsewhere. |
52 | 52 | * @internal |
53 | - |
|
54 | 53 | * @return \GV\Shortcode The only internally registered instance of this shortcode. |
55 | 54 | */ |
56 | 55 | public static function add() { |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | public static function add() { |
57 | 57 | $shortcode = new static(); |
58 | 58 | if ( shortcode_exists( $shortcode->name ) ) { |
59 | - if ( empty( self::$shortcodes[$shortcode->name] ) ) { |
|
59 | + if ( empty( self::$shortcodes[ $shortcode->name ] ) ) { |
|
60 | 60 | throw new \ErrorException( sprintf( 'Shortcode [%s] has already been registered elsewhere.', $shortcode->name ) ); |
61 | 61 | } |
62 | 62 | } else { |
63 | 63 | add_shortcode( $shortcode->name, array( get_class( $shortcode ), 'callback' ) ); |
64 | - self::$shortcodes[$shortcode->name] = $shortcode; |
|
64 | + self::$shortcodes[ $shortcode->name ] = $shortcode; |
|
65 | 65 | } |
66 | 66 | |
67 | - return self::$shortcodes[$shortcode->name]; |
|
67 | + return self::$shortcodes[ $shortcode->name ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function remove() { |
78 | 78 | $shortcode = new static(); |
79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
80 | 80 | remove_shortcode( $shortcode->name ); |
81 | 81 | } |
82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
109 | 109 | |
110 | 110 | foreach ( $matches as $shortcode ) { |
111 | - $shortcode_name = $shortcode[2]; |
|
111 | + $shortcode_name = $shortcode[ 2 ]; |
|
112 | 112 | |
113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
114 | - $shortcode_content = $shortcode[5]; |
|
113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
114 | + $shortcode_content = $shortcode[ 5 ]; |
|
115 | 115 | |
116 | 116 | /** This is a registered GravityView shortcode. */ |
117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
118 | - $shortcode = clone( self::$shortcodes[$shortcode_name] ); |
|
117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
118 | + $shortcode = clone( self::$shortcodes[ $shortcode_name ] ); |
|
119 | 119 | } else { |
120 | 120 | /** This is some generic shortcode. */ |
121 | 121 | $shortcode = new self; |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV\Shortcodes; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base \GV\Shortcode class. |