@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box gv-search-date"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="gv-search-box gv-search-field-text"> |
| 13 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 15 | 15 | <?php } ?> |
| 16 | 16 | <p> |
| 17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 18 | 18 | </p> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; |
| 235 | 235 | |
| 236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | 237 | /** |
| 238 | 238 | * used on a has_multiple_views context |
| 239 | 239 | * @see GravityView_API::entry_link |
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 241 | 241 | */ |
| 242 | - $this->context_view_id = $_GET['gvid']; |
|
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 285 | 285 | $this->setPostId( $post_id ); |
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 319 | 319 | |
| 320 | - if( 'post' === $search_method ) { |
|
| 320 | + if ( 'post' === $search_method ) { |
|
| 321 | 321 | $get = $_POST; |
| 322 | 322 | } else { |
| 323 | 323 | $get = $_GET; |
@@ -373,20 +373,20 @@ discard block |
||
| 373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 374 | 374 | * @param array $entry Current entry |
| 375 | 375 | */ |
| 376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 377 | 377 | |
| 378 | 378 | if ( ! $apply_outside_loop ) { |
| 379 | 379 | return $title; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // User reported WooCommerce doesn't pass two args. |
| 383 | - if ( empty( $passed_post_id ) ) { |
|
| 383 | + if ( empty( $passed_post_id ) ) { |
|
| 384 | 384 | return $title; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Don't modify the title for anything other than the current view/post. |
| 388 | 388 | // This is true for embedded shortcodes and Views. |
| 389 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 389 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 390 | 390 | return $title; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -396,19 +396,19 @@ discard block |
||
| 396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 397 | 397 | } else { |
| 398 | 398 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 399 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 399 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 400 | 400 | $view_meta = $view_data; |
| 401 | 401 | break; |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 406 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 407 | 407 | |
| 408 | - $title = $view_meta['atts']['single_title']; |
|
| 408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 409 | 409 | |
| 410 | 410 | // We are allowing HTML in the fields, so no escaping the output |
| 411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 412 | 412 | |
| 413 | 413 | $title = do_shortcode( $title ); |
| 414 | 414 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | public function render_view( $passed_args ) { |
| 510 | 510 | |
| 511 | 511 | // validate attributes |
| 512 | - if ( empty( $passed_args['id'] ) ) { |
|
| 512 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 514 | 514 | return null; |
| 515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | return null; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - $view_id = $passed_args['id']; |
|
| 534 | + $view_id = $passed_args[ 'id' ]; |
|
| 535 | 535 | |
| 536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 545 | 545 | |
| 546 | 546 | //Override shortcode args over View template settings |
| 547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 548 | 548 | |
| 549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 550 | 550 | |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | * Don't render View if user isn't allowed to see it |
| 567 | 567 | * @since 1.15 |
| 568 | 568 | */ |
| 569 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 569 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 570 | 570 | return null; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if( $this->isGravityviewPostType() ) { |
|
| 573 | + if ( $this->isGravityviewPostType() ) { |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | */ |
| 583 | 583 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 584 | 584 | |
| 585 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 585 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 586 | 586 | |
| 587 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 587 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 588 | 588 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 589 | 589 | } |
| 590 | 590 | } |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | $gravityview_view = new GravityView_View( $view_data ); |
| 601 | 601 | |
| 602 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 602 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 603 | 603 | |
| 604 | 604 | $gravityview_view->setPostId( $post_id ); |
| 605 | 605 | |
@@ -609,20 +609,20 @@ discard block |
||
| 609 | 609 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 610 | 610 | |
| 611 | 611 | //fetch template and slug |
| 612 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 612 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 613 | 613 | |
| 614 | 614 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 618 | 618 | */ |
| 619 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 619 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | 622 | * Hide View data until search is performed |
| 623 | 623 | * @since 1.5.4 |
| 624 | 624 | */ |
| 625 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 625 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 626 | 626 | $gravityview_view->setHideUntilSearched( true ); |
| 627 | 627 | $get_entries = false; |
| 628 | 628 | } |
@@ -630,23 +630,23 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | if ( $get_entries ) { |
| 632 | 632 | |
| 633 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 633 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 634 | 634 | // add filter to enable column sorting |
| 635 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 635 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 638 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 639 | 639 | |
| 640 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 640 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 641 | 641 | |
| 642 | 642 | } else { |
| 643 | 643 | |
| 644 | 644 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 645 | 645 | |
| 646 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 646 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 649 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 650 | 650 | $gravityview_view->setContext( 'directory' ); |
| 651 | 651 | $sections = array( 'header', 'body', 'footer' ); |
| 652 | 652 | |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | // user requested Single Entry View |
| 656 | 656 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
| 657 | 657 | |
| 658 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 658 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 659 | 659 | |
| 660 | 660 | $entry = $this->getEntry(); |
| 661 | 661 | |
@@ -682,20 +682,20 @@ discard block |
||
| 682 | 682 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 683 | 683 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 684 | 684 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 685 | - 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 ); |
|
| 685 | + 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 ); |
|
| 686 | 686 | return null; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | //fetch template and slug |
| 690 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 690 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 691 | 691 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 692 | 692 | |
| 693 | 693 | //fetch entry detail |
| 694 | - $view_entries['count'] = 1; |
|
| 695 | - $view_entries['entries'][] = $entry; |
|
| 696 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 694 | + $view_entries[ 'count' ] = 1; |
|
| 695 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 696 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 697 | 697 | |
| 698 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 698 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 699 | 699 | |
| 700 | 700 | // set back link label |
| 701 | 701 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -705,11 +705,11 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // add template style |
| 708 | - self::add_style( $view_data['template_id'] ); |
|
| 708 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 709 | 709 | |
| 710 | 710 | // Prepare to render view and set vars |
| 711 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 712 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 711 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 712 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 713 | 713 | |
| 714 | 714 | // If Edit |
| 715 | 715 | if ( 'edit' === gravityview_get_context() ) { |
@@ -722,11 +722,11 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | } else { |
| 724 | 724 | // finaly we'll render some html |
| 725 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 725 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 726 | 726 | |
| 727 | 727 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 728 | 728 | foreach ( $sections as $section ) { |
| 729 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 729 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 730 | 730 | $gravityview_view->render( $view_slug, $section, false ); |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $datetime_format = 'Y-m-d H:i:s'; |
| 781 | 781 | $search_is_outside_view_bounds = false; |
| 782 | 782 | |
| 783 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 783 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 784 | 784 | |
| 785 | 785 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 786 | 786 | |
@@ -808,14 +808,14 @@ discard block |
||
| 808 | 808 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 809 | 809 | |
| 810 | 810 | // Then we override the search and re-set the start date |
| 811 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 811 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 816 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 817 | 817 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 818 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 818 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 819 | 819 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 820 | 820 | } |
| 821 | 821 | } |
@@ -833,9 +833,9 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 835 | 835 | |
| 836 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 837 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 836 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 837 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 839 | 839 | |
| 840 | 840 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 841 | 841 | } |
@@ -859,12 +859,12 @@ discard block |
||
| 859 | 859 | */ |
| 860 | 860 | public static function is_entry_approved( $entry, $args = array() ) { |
| 861 | 861 | |
| 862 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 862 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 863 | 863 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 864 | 864 | return true; |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 867 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 868 | 868 | |
| 869 | 869 | if ( $is_approved ) { |
| 870 | 870 | return true; |
@@ -897,26 +897,26 @@ discard block |
||
| 897 | 897 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 898 | 898 | |
| 899 | 899 | // implicity search |
| 900 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 900 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 901 | 901 | |
| 902 | 902 | // Search operator options. Options: `is` or `contains` |
| 903 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 903 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 904 | 904 | |
| 905 | - $search_criteria['field_filters'][] = array( |
|
| 905 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 906 | 906 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 907 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 907 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 908 | 908 | 'operator' => $operator, |
| 909 | 909 | ); |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 912 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 913 | 913 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // Handle setting date range |
| 917 | 917 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 918 | 918 | |
| 919 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 919 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 920 | 920 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 921 | 921 | } |
| 922 | 922 | |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 928 | 928 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 929 | 929 | */ |
| 930 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 930 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 931 | 931 | |
| 932 | 932 | return $search_criteria; |
| 933 | 933 | } |
@@ -973,16 +973,16 @@ discard block |
||
| 973 | 973 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 974 | 974 | |
| 975 | 975 | // Paging & offset |
| 976 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 976 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 977 | 977 | |
| 978 | 978 | if ( -1 === $page_size ) { |
| 979 | 979 | $page_size = PHP_INT_MAX; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - if ( isset( $args['offset'] ) ) { |
|
| 983 | - $offset = intval( $args['offset'] ); |
|
| 982 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 983 | + $offset = intval( $args[ 'offset' ] ); |
|
| 984 | 984 | } else { |
| 985 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 985 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 986 | 986 | $offset = ( $curr_page - 1 ) * $page_size; |
| 987 | 987 | } |
| 988 | 988 | |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | 'search_criteria' => $search_criteria, |
| 1001 | 1001 | 'sorting' => $sorting, |
| 1002 | 1002 | 'paging' => $paging, |
| 1003 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1003 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1004 | 1004 | ); |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1026 | 1026 | * @param array $args View configuration args. |
| 1027 | 1027 | */ |
| 1028 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1028 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1029 | 1029 | |
| 1030 | 1030 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1031 | 1031 | |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | */ |
| 1066 | 1066 | public static function updateViewSorting( $args, $form_id ) { |
| 1067 | 1067 | $sorting = array(); |
| 1068 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1069 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1068 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1069 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1072 | 1072 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1108 | 1108 | |
| 1109 | - switch ( $sort_field['type'] ) { |
|
| 1109 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1110 | 1110 | |
| 1111 | 1111 | case 'address': |
| 1112 | 1112 | // Sorting by full address |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | */ |
| 1124 | 1124 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1125 | 1125 | |
| 1126 | - switch( strtolower( $address_part ) ){ |
|
| 1126 | + switch ( strtolower( $address_part ) ) { |
|
| 1127 | 1127 | case 'street': |
| 1128 | 1128 | $sort_field_id .= '.1'; |
| 1129 | 1129 | break; |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | */ |
| 1204 | 1204 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1205 | 1205 | |
| 1206 | - if ( empty( $single_entry ) ){ |
|
| 1206 | + if ( empty( $single_entry ) ) { |
|
| 1207 | 1207 | return false; |
| 1208 | 1208 | } else { |
| 1209 | 1209 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1231 | 1231 | * @since 1.15 |
| 1232 | 1232 | */ |
| 1233 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1233 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1234 | 1234 | continue; |
| 1235 | 1235 | } |
| 1236 | 1236 | |
@@ -1239,19 +1239,19 @@ discard block |
||
| 1239 | 1239 | $css_dependencies = array(); |
| 1240 | 1240 | |
| 1241 | 1241 | // If the thickbox is enqueued, add dependencies |
| 1242 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1242 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1243 | 1243 | |
| 1244 | 1244 | /** |
| 1245 | 1245 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1246 | 1246 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1247 | 1247 | */ |
| 1248 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1248 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1249 | 1249 | |
| 1250 | 1250 | /** |
| 1251 | 1251 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1252 | 1252 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1253 | 1253 | */ |
| 1254 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1254 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | /** |
@@ -1259,25 +1259,25 @@ discard block |
||
| 1259 | 1259 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1260 | 1260 | * @since 1.15 |
| 1261 | 1261 | */ |
| 1262 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1263 | - $css_dependencies[] = 'dashicons'; |
|
| 1262 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1263 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1267 | 1267 | |
| 1268 | 1268 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1269 | 1269 | |
| 1270 | - 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 ); |
|
| 1270 | + 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 ); |
|
| 1271 | 1271 | |
| 1272 | 1272 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1273 | 1273 | |
| 1274 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1274 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1275 | 1275 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1279 | 1279 | |
| 1280 | - self::add_style( $data['template_id'] ); |
|
| 1280 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1281 | 1281 | |
| 1282 | 1282 | } |
| 1283 | 1283 | |
@@ -1313,7 +1313,7 @@ discard block |
||
| 1313 | 1313 | } elseif ( empty( $template_id ) ) { |
| 1314 | 1314 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1315 | 1315 | } else { |
| 1316 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1316 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | } |
@@ -1338,11 +1338,11 @@ discard block |
||
| 1338 | 1338 | * Not a table-based template; don't add sort icons |
| 1339 | 1339 | * @since 1.12 |
| 1340 | 1340 | */ |
| 1341 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1341 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1342 | 1342 | return $label; |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1345 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1346 | 1346 | return $label; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
@@ -1350,29 +1350,29 @@ discard block |
||
| 1350 | 1350 | |
| 1351 | 1351 | $class = 'gv-sort'; |
| 1352 | 1352 | |
| 1353 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1353 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1354 | 1354 | |
| 1355 | 1355 | $sort_args = array( |
| 1356 | - 'sort' => $field['id'], |
|
| 1356 | + 'sort' => $field[ 'id' ], |
|
| 1357 | 1357 | 'dir' => 'asc', |
| 1358 | 1358 | ); |
| 1359 | 1359 | |
| 1360 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1360 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1361 | 1361 | //toggle sorting direction. |
| 1362 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1363 | - $sort_args['dir'] = 'desc'; |
|
| 1362 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1363 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1364 | 1364 | $class .= ' gv-icon-sort-desc'; |
| 1365 | 1365 | } else { |
| 1366 | - $sort_args['dir'] = 'asc'; |
|
| 1366 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1367 | 1367 | $class .= ' gv-icon-sort-asc'; |
| 1368 | 1368 | } |
| 1369 | 1369 | } else { |
| 1370 | 1370 | $class .= ' gv-icon-caret-up-down'; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1373 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1374 | 1374 | |
| 1375 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1375 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1376 | 1376 | |
| 1377 | 1377 | } |
| 1378 | 1378 | |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | |
| 1391 | 1391 | $field_type = $field_id; |
| 1392 | 1392 | |
| 1393 | - if( is_numeric( $field_id ) ) { |
|
| 1393 | + if ( is_numeric( $field_id ) ) { |
|
| 1394 | 1394 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1395 | 1395 | $field_type = $field->type; |
| 1396 | 1396 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | return false; |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1416 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1417 | 1417 | |
| 1418 | 1418 | } |
| 1419 | 1419 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | /** |
| 202 | 202 | * Add admin script to the no-conflict scripts whitelist |
| 203 | 203 | * @param array $allowed Scripts allowed in no-conflict mode |
| 204 | - * @return array Scripts allowed in no-conflict mode, plus the search widget script |
|
| 204 | + * @return string[] Scripts allowed in no-conflict mode, plus the search widget script |
|
| 205 | 205 | */ |
| 206 | 206 | public function register_no_conflict( $allowed ) { |
| 207 | 207 | $allowed[] = 'gravityview_searchwidget_admin'; |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | /** |
| 890 | 890 | * Get the label for a search form field |
| 891 | 891 | * @param array $field Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys |
| 892 | - * @param array $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 892 | + * @param GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 893 | 893 | * @return string Label for the search form |
| 894 | 894 | */ |
| 895 | 895 | private static function get_field_label( $field, $form_field = array() ) { |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | /** |
| 1059 | 1059 | * Require the datepicker script for the frontend GV script |
| 1060 | 1060 | * @param array $js_dependencies Array of existing required scripts for the fe-views.js script |
| 1061 | - * @return array Array required scripts, with `jquery-ui-datepicker` added |
|
| 1061 | + * @return string[] Array required scripts, with `jquery-ui-datepicker` added |
|
| 1062 | 1062 | */ |
| 1063 | 1063 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1064 | 1064 | |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | /** |
| 1071 | 1071 | * Modify the array passed to wp_localize_script() |
| 1072 | 1072 | * |
| 1073 | - * @param array $js_localization The data padded to the Javascript file |
|
| 1073 | + * @param array $localizations The data padded to the Javascript file |
|
| 1074 | 1074 | * @param array $view_data View data array with View settings |
| 1075 | 1075 | * |
| 1076 | 1076 | * @return array |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'type' => 'radio', |
| 64 | 64 | 'full_width' => true, |
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 67 | 67 | 'value' => 'any', |
| 68 | 68 | 'class' => 'hide-if-js', |
| 69 | 69 | 'options' => array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
| 87 | 87 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
| 88 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
| 88 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
| 89 | 89 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
| 90 | 90 | |
| 91 | 91 | // ajax - get the searchable fields |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 150 | 150 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 151 | 151 | |
| 152 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 152 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 205 | 205 | */ |
| 206 | 206 | public function register_no_conflict( $allowed ) { |
| 207 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 207 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 208 | 208 | return $allowed; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -217,24 +217,24 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public static function get_searchable_fields() { |
| 219 | 219 | |
| 220 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 220 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 221 | 221 | exit( '0' ); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | $form = ''; |
| 225 | 225 | |
| 226 | 226 | // Fetch the form for the current View |
| 227 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 227 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 228 | 228 | |
| 229 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 229 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 230 | 230 | |
| 231 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 231 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 232 | 232 | |
| 233 | - $form = (int) $_POST['formid']; |
|
| 233 | + $form = (int)$_POST[ 'formid' ]; |
|
| 234 | 234 | |
| 235 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 235 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 236 | 236 | |
| 237 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 237 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 283 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 282 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 283 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Get fields with sub-inputs and no parent |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | foreach ( $fields as $id => $field ) { |
| 304 | 304 | |
| 305 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 305 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 306 | 306 | continue; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 309 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 310 | 310 | |
| 311 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 311 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 331 | 331 | |
| 332 | 332 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 333 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 333 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 334 | 334 | $input_type = 'boolean'; // on/off checkbox |
| 335 | 335 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 336 | 336 | $input_type = 'multi'; //multiselect |
@@ -372,19 +372,19 @@ discard block |
||
| 372 | 372 | $post_id = 0; |
| 373 | 373 | |
| 374 | 374 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 375 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 376 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 375 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 376 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 377 | 377 | } |
| 378 | 378 | // We're in the WordPress Widget context, and the base View ID should be used |
| 379 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 380 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 379 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 380 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 384 | 384 | |
| 385 | 385 | // Add hidden fields to the search form |
| 386 | 386 | foreach ( $args as $key => $value ) { |
| 387 | - $search_fields[] = array( |
|
| 387 | + $search_fields[ ] = array( |
|
| 388 | 388 | 'name' => $key, |
| 389 | 389 | 'input' => 'hidden', |
| 390 | 390 | 'value' => $value, |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function filter_entries( $search_criteria ) { |
| 407 | 407 | |
| 408 | - if( 'post' === $this->search_method ) { |
|
| 408 | + if ( 'post' === $this->search_method ) { |
|
| 409 | 409 | $get = $_POST; |
| 410 | 410 | } else { |
| 411 | 411 | $get = $_GET; |
@@ -422,15 +422,15 @@ discard block |
||
| 422 | 422 | $get = gv_map_deep( $get, 'urldecode' ); |
| 423 | 423 | |
| 424 | 424 | // add free search |
| 425 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 425 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 426 | 426 | |
| 427 | 427 | // Search for a piece |
| 428 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 428 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 429 | 429 | |
| 430 | 430 | $words = array_filter( $words ); |
| 431 | 431 | |
| 432 | 432 | foreach ( $words as $word ) { |
| 433 | - $search_criteria['field_filters'][] = array( |
|
| 433 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 434 | 434 | 'key' => null, // The field ID to search |
| 435 | 435 | 'value' => $word, // The value to search |
| 436 | 436 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | //start date & end date |
| 442 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 443 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 442 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 443 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 444 | 444 | |
| 445 | 445 | /** |
| 446 | 446 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -455,16 +455,16 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 457 | 457 | */ |
| 458 | - if( !empty( $curr_start ) ) { |
|
| 459 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 458 | + if ( ! empty( $curr_start ) ) { |
|
| 459 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 460 | 460 | } |
| 461 | - if( !empty( $curr_end ) ) { |
|
| 462 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 461 | + if ( ! empty( $curr_end ) ) { |
|
| 462 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // search for a specific entry ID |
| 466 | 466 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 467 | - $search_criteria['field_filters'][] = array( |
|
| 467 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 468 | 468 | 'key' => 'id', |
| 469 | 469 | 'value' => absint( $get[ 'gv_id' ] ), |
| 470 | 470 | 'operator' => '=', |
@@ -473,36 +473,36 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | // search for a specific Created_by ID |
| 475 | 475 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 476 | - $search_criteria['field_filters'][] = array( |
|
| 476 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 477 | 477 | 'key' => 'created_by', |
| 478 | - 'value' => absint( $get['gv_by'] ), |
|
| 478 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 479 | 479 | 'operator' => '=', |
| 480 | 480 | ); |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | |
| 484 | 484 | // Get search mode passed in URL |
| 485 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 485 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 486 | 486 | |
| 487 | 487 | // get the other search filters |
| 488 | 488 | foreach ( $get as $key => $value ) { |
| 489 | 489 | |
| 490 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 490 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 491 | 491 | continue; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // could return simple filter or multiple filters |
| 495 | 495 | $filter = $this->prepare_field_filter( $key, $value ); |
| 496 | 496 | |
| 497 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 498 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 497 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 498 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 499 | 499 | |
| 500 | 500 | // if date range type, set search mode to ALL |
| 501 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 501 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 502 | 502 | $mode = 'all'; |
| 503 | 503 | } |
| 504 | - } elseif( !empty( $filter ) ) { |
|
| 505 | - $search_criteria['field_filters'][] = $filter; |
|
| 504 | + } elseif ( ! empty( $filter ) ) { |
|
| 505 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * @since 1.5.1 |
| 512 | 512 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 513 | 513 | */ |
| 514 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 514 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 515 | 515 | |
| 516 | 516 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 517 | 517 | |
@@ -549,11 +549,11 @@ discard block |
||
| 549 | 549 | 'value' => $value, |
| 550 | 550 | ); |
| 551 | 551 | |
| 552 | - switch ( $form_field['type'] ) { |
|
| 552 | + switch ( $form_field[ 'type' ] ) { |
|
| 553 | 553 | |
| 554 | 554 | case 'select': |
| 555 | 555 | case 'radio': |
| 556 | - $filter['operator'] = 'is'; |
|
| 556 | + $filter[ 'operator' ] = 'is'; |
|
| 557 | 557 | break; |
| 558 | 558 | |
| 559 | 559 | case 'post_category': |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | foreach ( $value as $val ) { |
| 569 | 569 | $cat = get_term( $val, 'category' ); |
| 570 | - $filter[] = array( |
|
| 570 | + $filter[ ] = array( |
|
| 571 | 571 | 'key' => $field_id, |
| 572 | 572 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 573 | 573 | 'operator' => 'is', |
@@ -586,18 +586,18 @@ discard block |
||
| 586 | 586 | $filter = array(); |
| 587 | 587 | |
| 588 | 588 | foreach ( $value as $val ) { |
| 589 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 589 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | break; |
| 593 | 593 | |
| 594 | 594 | case 'checkbox': |
| 595 | 595 | // convert checkbox on/off into the correct search filter |
| 596 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 597 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 598 | - if ( $input['id'] == $field_id ) { |
|
| 599 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 600 | - $filter['operator'] = 'is'; |
|
| 596 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 597 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 598 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 599 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 600 | + $filter[ 'operator' ] = 'is'; |
|
| 601 | 601 | break; |
| 602 | 602 | } |
| 603 | 603 | } |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | $filter = array(); |
| 608 | 608 | |
| 609 | 609 | foreach ( $value as $val ) { |
| 610 | - $filter[] = array( |
|
| 610 | + $filter[ ] = array( |
|
| 611 | 611 | 'key' => $field_id, |
| 612 | 612 | 'value' => $val, |
| 613 | 613 | 'operator' => 'is', |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | foreach ( $words as $word ) { |
| 629 | 629 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 630 | 630 | // Keep the same key for each filter |
| 631 | - $filter['value'] = $word; |
|
| 631 | + $filter[ 'value' ] = $word; |
|
| 632 | 632 | // Add a search for the value |
| 633 | - $filters[] = $filter; |
|
| 633 | + $filters[ ] = $filter; |
|
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 | |
@@ -657,19 +657,19 @@ discard block |
||
| 657 | 657 | * @since 1.16.3 |
| 658 | 658 | * Safeguard until GF implements '<=' operator |
| 659 | 659 | */ |
| 660 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 660 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 661 | 661 | $operator = '<'; |
| 662 | 662 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - $filter[] = array( |
|
| 665 | + $filter[ ] = array( |
|
| 666 | 666 | 'key' => $field_id, |
| 667 | 667 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 668 | 668 | 'operator' => $operator, |
| 669 | 669 | ); |
| 670 | 670 | } |
| 671 | 671 | } else { |
| 672 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 672 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | break; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | 'ymd_dot' => 'Y.m.d', |
| 701 | 701 | ); |
| 702 | 702 | |
| 703 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 703 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 704 | 704 | $format = $datepicker[ $field->dateFormat ]; |
| 705 | 705 | } |
| 706 | 706 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | public function add_template_path( $file_paths ) { |
| 732 | 732 | |
| 733 | 733 | // Index 100 is the default GravityView template path. |
| 734 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 734 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 735 | 735 | |
| 736 | 736 | return $file_paths; |
| 737 | 737 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | // get configured search fields |
| 757 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 757 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 758 | 758 | |
| 759 | 759 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 760 | 760 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -768,24 +768,24 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $updated_field = $field; |
| 770 | 770 | |
| 771 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 771 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 772 | 772 | $has_date = true; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 776 | 776 | |
| 777 | - switch ( $field['field'] ) { |
|
| 777 | + switch ( $field[ 'field' ] ) { |
|
| 778 | 778 | |
| 779 | 779 | case 'search_all': |
| 780 | - $updated_field['key'] = 'search_all'; |
|
| 781 | - $updated_field['input'] = 'search_all'; |
|
| 782 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 780 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 781 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 782 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 783 | 783 | break; |
| 784 | 784 | |
| 785 | 785 | case 'entry_date': |
| 786 | - $updated_field['key'] = 'entry_date'; |
|
| 787 | - $updated_field['input'] = 'entry_date'; |
|
| 788 | - $updated_field['value'] = array( |
|
| 786 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 787 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 788 | + $updated_field[ 'value' ] = array( |
|
| 789 | 789 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 790 | 790 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 791 | 791 | ); |
@@ -793,16 +793,16 @@ discard block |
||
| 793 | 793 | break; |
| 794 | 794 | |
| 795 | 795 | case 'entry_id': |
| 796 | - $updated_field['key'] = 'entry_id'; |
|
| 797 | - $updated_field['input'] = 'entry_id'; |
|
| 798 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 796 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 797 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 798 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 799 | 799 | break; |
| 800 | 800 | |
| 801 | 801 | case 'created_by': |
| 802 | - $updated_field['key'] = 'created_by'; |
|
| 803 | - $updated_field['name'] = 'gv_by'; |
|
| 804 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 805 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 802 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 803 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 804 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 805 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 806 | 806 | break; |
| 807 | 807 | } |
| 808 | 808 | |
@@ -820,16 +820,16 @@ discard block |
||
| 820 | 820 | */ |
| 821 | 821 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 822 | 822 | |
| 823 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 823 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 824 | 824 | |
| 825 | 825 | /** @since 1.14 */ |
| 826 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 826 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 827 | 827 | |
| 828 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 828 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 829 | 829 | |
| 830 | 830 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 831 | 831 | |
| 832 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 832 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 833 | 833 | |
| 834 | 834 | if ( $has_date ) { |
| 835 | 835 | // enqueue datepicker stuff only if needed! |
@@ -851,10 +851,10 @@ discard block |
||
| 851 | 851 | public static function get_search_class( $custom_class = '' ) { |
| 852 | 852 | $gravityview_view = GravityView_View::getInstance(); |
| 853 | 853 | |
| 854 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 854 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 855 | 855 | |
| 856 | - if ( ! empty( $custom_class ) ) { |
|
| 857 | - $search_class .= ' '.$custom_class; |
|
| 856 | + if ( ! empty( $custom_class ) ) { |
|
| 857 | + $search_class .= ' ' . $custom_class; |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
@@ -896,11 +896,11 @@ discard block |
||
| 896 | 896 | |
| 897 | 897 | $label = rgget( 'label', $field ); |
| 898 | 898 | |
| 899 | - if( '' === $label ) { |
|
| 899 | + if ( '' === $label ) { |
|
| 900 | 900 | |
| 901 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 901 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 902 | 902 | |
| 903 | - switch( $field['field'] ) { |
|
| 903 | + switch ( $field[ 'field' ] ) { |
|
| 904 | 904 | case 'search_all': |
| 905 | 905 | $label = __( 'Search Entries:', 'gravityview' ); |
| 906 | 906 | break; |
@@ -918,10 +918,10 @@ discard block |
||
| 918 | 918 | break; |
| 919 | 919 | default: |
| 920 | 920 | // If this is a field input, not a field |
| 921 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 921 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 922 | 922 | |
| 923 | 923 | // Get the label for the field in question, which returns an array |
| 924 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 924 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 925 | 925 | |
| 926 | 926 | // Get the item with the `label` key |
| 927 | 927 | $values = wp_list_pluck( $items, 'label' ); |
@@ -958,32 +958,32 @@ discard block |
||
| 958 | 958 | $form = $gravityview_view->getForm(); |
| 959 | 959 | |
| 960 | 960 | // for advanced field ids (eg, first name / last name ) |
| 961 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 961 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 962 | 962 | |
| 963 | 963 | // get searched value from $_GET/$_POST (string or array) |
| 964 | 964 | $value = $this->rgget_or_rgpost( $name ); |
| 965 | 965 | |
| 966 | 966 | // get form field details |
| 967 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 967 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 968 | 968 | |
| 969 | 969 | $filter = array( |
| 970 | - 'key' => $field['field'], |
|
| 970 | + 'key' => $field[ 'field' ], |
|
| 971 | 971 | 'name' => $name, |
| 972 | 972 | 'label' => self::get_field_label( $field, $form_field ), |
| 973 | - 'input' => $field['input'], |
|
| 973 | + 'input' => $field[ 'input' ], |
|
| 974 | 974 | 'value' => $value, |
| 975 | - 'type' => $form_field['type'], |
|
| 975 | + 'type' => $form_field[ 'type' ], |
|
| 976 | 976 | ); |
| 977 | 977 | |
| 978 | 978 | // collect choices |
| 979 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 980 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 981 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 982 | - $filter['choices'] = $form_field['choices']; |
|
| 979 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 980 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 981 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 982 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 986 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 985 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 986 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | return $filter; |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | |
| 1008 | 1008 | $choices = array(); |
| 1009 | 1009 | foreach ( $users as $user ) { |
| 1010 | - $choices[] = array( |
|
| 1010 | + $choices[ ] = array( |
|
| 1011 | 1011 | 'value' => $user->ID, |
| 1012 | 1012 | 'text' => $user->display_name, |
| 1013 | 1013 | ); |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | */ |
| 1063 | 1063 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1064 | 1064 | |
| 1065 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1065 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1066 | 1066 | |
| 1067 | 1067 | return $js_dependencies; |
| 1068 | 1068 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | 'isRTL' => is_rtl(), |
| 1107 | 1107 | ), $view_data ); |
| 1108 | 1108 | |
| 1109 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1109 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1110 | 1110 | |
| 1111 | 1111 | return $localizations; |
| 1112 | 1112 | |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | * @return void |
| 1136 | 1136 | */ |
| 1137 | 1137 | private function maybe_enqueue_flexibility() { |
| 1138 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1138 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1139 | 1139 | wp_enqueue_script( 'gv-flexibility' ); |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1158 | 1158 | |
| 1159 | 1159 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1160 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1160 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1161 | 1161 | |
| 1162 | 1162 | /** |
| 1163 | 1163 | * @filter `gravityview_search_datepicker_class` |
@@ -28,30 +28,30 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // @todo check if this hook is needed.. |
| 47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 48 | 48 | |
| 49 | 49 | // Add Connected Form column |
| 50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 51 | 51 | |
| 52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 53 | 53 | |
| 54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 55 | 55 | |
| 56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 67 | 67 | global $pagenow; |
| 68 | 68 | |
| 69 | - if ( !is_admin() ) { |
|
| 69 | + if ( ! is_admin() ) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | function add_view_dropdown() { |
| 88 | 88 | $current_screen = get_current_screen(); |
| 89 | 89 | |
| 90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $forms = gravityview_get_forms(); |
| 95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
| 96 | 96 | // If there are no forms to select, show no forms. |
| 97 | - if( !empty( $forms ) ) { ?> |
|
| 97 | + if ( ! empty( $forms ) ) { ?> |
|
| 98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 100 | - <?php foreach( $forms as $form ) { ?> |
|
| 101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 100 | + <?php foreach ( $forms as $form ) { ?> |
|
| 101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 102 | 102 | <?php } ?> |
| 103 | 103 | </select> |
| 104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
| 136 | 136 | |
| 137 | - if( empty( $connected_views ) ) { |
|
| 137 | + if ( empty( $connected_views ) ) { |
|
| 138 | 138 | return $menu_items; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $sub_menu_items = array(); |
| 142 | 142 | foreach ( (array)$connected_views as $view ) { |
| 143 | 143 | |
| 144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 149 | 149 | |
| 150 | - $sub_menu_items[] = array( |
|
| 150 | + $sub_menu_items[ ] = array( |
|
| 151 | 151 | 'label' => esc_attr( $label ), |
| 152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // If there were no items added, then let's create the parent menu |
| 157 | - if( $sub_menu_items ) { |
|
| 157 | + if ( $sub_menu_items ) { |
|
| 158 | 158 | |
| 159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 160 | - $sub_menu_items[] = array( |
|
| 160 | + $sub_menu_items[ ] = array( |
|
| 161 | 161 | 'url' => '#', |
| 162 | 162 | 'label' => '', |
| 163 | 163 | 'menu_class' => 'hidden', |
| 164 | 164 | 'capabilities' => '', |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $menu_items['gravityview'] = array( |
|
| 167 | + $menu_items[ 'gravityview' ] = array( |
|
| 168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $add = array( 'captcha', 'page' ); |
| 195 | 195 | |
| 196 | 196 | // Don't allowing editing the following values: |
| 197 | - if( $context === 'edit' ) { |
|
| 198 | - $add[] = 'post_id'; |
|
| 197 | + if ( $context === 'edit' ) { |
|
| 198 | + $add[ ] = 'post_id'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
| 218 | 218 | foreach ( $default_args as $key => $arg ) { |
| 219 | 219 | |
| 220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 222 | 222 | |
| 223 | 223 | // By default, use `tooltip` if defined. |
| 224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 225 | 225 | |
| 226 | 226 | // Otherwise, use the description as a tooltip. |
| 227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 228 | - $tooltip = $arg['desc']; |
|
| 227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 228 | + $tooltip = $arg[ 'desc' ]; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // If there's no tooltip set, continue |
| 232 | - if( empty( $tooltip ) ) { |
|
| 232 | + if ( empty( $tooltip ) ) { |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Add the tooltip |
| 237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 238 | - 'title' => $arg['label'], |
|
| 237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 238 | + 'title' => $arg[ 'label' ], |
|
| 239 | 239 | 'value' => $tooltip, |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 256 | 256 | |
| 257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 258 | 258 | |
| 259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 294 | 294 | |
| 295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 296 | 296 | |
| 297 | 297 | break; |
| 298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
| 333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 334 | 334 | |
| 335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
| 336 | - if( empty( $form ) ) { |
|
| 336 | + if ( empty( $form ) ) { |
|
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // The $form is passed as the form ID |
| 341 | - if( !is_array( $form ) ) { |
|
| 341 | + if ( ! is_array( $form ) ) { |
|
| 342 | 342 | $form = gravityview_get_form( $form ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $form_id = $form['id']; |
|
| 345 | + $form_id = $form[ 'id' ]; |
|
| 346 | 346 | $links = array(); |
| 347 | 347 | |
| 348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 352 | 352 | } else { |
| 353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $output = ''; |
| 372 | 372 | |
| 373 | - if( !empty( $include_form_link ) ) { |
|
| 373 | + if ( ! empty( $include_form_link ) ) { |
|
| 374 | 374 | $output .= $form_link; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 384 | 384 | |
| 385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 386 | 386 | |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | // Get the date column and save it for later to add back in. |
| 397 | 397 | // This adds it after the Data Source column. |
| 398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
| 399 | - $date = $columns['date']; |
|
| 400 | - unset( $columns['date'] ); |
|
| 399 | + $date = $columns[ 'date' ]; |
|
| 400 | + unset( $columns[ 'date' ] ); |
|
| 401 | 401 | |
| 402 | 402 | $data_source_required_caps = array( |
| 403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | 'gravityforms_preview_forms', |
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 416 | 416 | |
| 417 | 417 | // Add the date back in. |
| 418 | - $columns['date'] = $date; |
|
| 418 | + $columns[ 'date' ] = $date; |
|
| 419 | 419 | |
| 420 | 420 | return $columns; |
| 421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // validate post_type |
| 437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -449,67 +449,67 @@ discard block |
||
| 449 | 449 | $statii = array(); |
| 450 | 450 | |
| 451 | 451 | // check if this is a start fresh View |
| 452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 453 | 453 | |
| 454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 455 | 455 | // save form id |
| 456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 457 | 457 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
| 462 | 462 | return; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Was this a start fresh? |
| 466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 468 | 468 | } else { |
| 469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Check if we have a template id |
| 473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 474 | 474 | |
| 475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 476 | 476 | |
| 477 | 477 | // now save template id |
| 478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | // save View Configuration metabox |
| 483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 484 | 484 | |
| 485 | 485 | // template settings |
| 486 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 487 | - $_POST['template_settings'] = array(); |
|
| 486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 487 | + $_POST[ 'template_settings' ] = array(); |
|
| 488 | 488 | } |
| 489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 490 | 490 | |
| 491 | 491 | $fields = array(); |
| 492 | 492 | |
| 493 | 493 | // Directory&single Visible Fields |
| 494 | - if( !empty( $preset_fields ) ) { |
|
| 494 | + if ( ! empty( $preset_fields ) ) { |
|
| 495 | 495 | |
| 496 | 496 | $fields = $preset_fields; |
| 497 | 497 | |
| 498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
| 498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
| 499 | 499 | $fields = _gravityview_process_posted_fields(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 503 | 503 | |
| 504 | 504 | // Directory Visible Widgets |
| 505 | - if( empty( $_POST['widgets'] ) ) { |
|
| 506 | - $_POST['widgets'] = array(); |
|
| 505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 506 | + $_POST[ 'widgets' ] = array(); |
|
| 507 | 507 | } |
| 508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
| 508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
| 509 | 509 | |
| 510 | 510 | } // end save view configuration |
| 511 | 511 | |
| 512 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 512 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | /** |
@@ -541,20 +541,20 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $output = ''; |
| 543 | 543 | |
| 544 | - if( !empty( $fields ) ) { |
|
| 544 | + if ( ! empty( $fields ) ) { |
|
| 545 | 545 | |
| 546 | - foreach( $fields as $id => $details ) { |
|
| 546 | + foreach ( $fields as $id => $details ) { |
|
| 547 | 547 | |
| 548 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
| 548 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Edit mode only allows editing the parent fields, not single inputs. |
| 553 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 553 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 554 | 554 | continue; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
| 557 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
| 558 | 558 | |
| 559 | 559 | } // End foreach |
| 560 | 560 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | echo $output; |
| 563 | 563 | |
| 564 | 564 | // For the EDIT view we only want to allow the form fields. |
| 565 | - if( $context === 'edit' ) { |
|
| 565 | + if ( $context === 'edit' ) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | 568 | |
@@ -586,16 +586,16 @@ discard block |
||
| 586 | 586 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 587 | 587 | array( |
| 588 | 588 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 589 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 589 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 590 | 590 | 'field_id' => 'all-fields', |
| 591 | 591 | 'label_type' => 'field', |
| 592 | 592 | 'input_type' => NULL, |
| 593 | 593 | 'field_options' => NULL, |
| 594 | 594 | 'settings_html' => NULL, |
| 595 | 595 | ) |
| 596 | - )); |
|
| 596 | + ) ); |
|
| 597 | 597 | |
| 598 | - if( !empty( $additional_fields )) { |
|
| 598 | + if ( ! empty( $additional_fields ) ) { |
|
| 599 | 599 | foreach ( (array)$additional_fields as $item ) { |
| 600 | 600 | |
| 601 | 601 | // Prevent items from not having index set |
@@ -606,16 +606,16 @@ discard block |
||
| 606 | 606 | 'input_type' => NULL, |
| 607 | 607 | 'field_options' => NULL, |
| 608 | 608 | 'settings_html' => NULL, |
| 609 | - )); |
|
| 609 | + ) ); |
|
| 610 | 610 | |
| 611 | 611 | // Backward compat. |
| 612 | - if( !empty( $item['field_options'] ) ) { |
|
| 612 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 613 | 613 | // Use settings_html from now on. |
| 614 | - $item['settings_html'] = $item['field_options']; |
|
| 614 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // Render a label for each of them |
| 618 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
| 618 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
| 619 | 619 | |
| 620 | 620 | } |
| 621 | 621 | } |
@@ -628,72 +628,72 @@ discard block |
||
| 628 | 628 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 629 | 629 | * @return array |
| 630 | 630 | */ |
| 631 | - function get_entry_default_fields($form, $zone) { |
|
| 631 | + function get_entry_default_fields( $form, $zone ) { |
|
| 632 | 632 | |
| 633 | 633 | $entry_default_fields = array(); |
| 634 | 634 | |
| 635 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 635 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 636 | 636 | |
| 637 | 637 | $entry_default_fields = array( |
| 638 | 638 | 'id' => array( |
| 639 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 639 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 640 | 640 | 'type' => 'id', |
| 641 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 641 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 642 | 642 | ), |
| 643 | 643 | 'date_created' => array( |
| 644 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 645 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 644 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 645 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 646 | 646 | 'type' => 'date_created', |
| 647 | 647 | ), |
| 648 | 648 | 'source_url' => array( |
| 649 | - 'label' => __('Source URL', 'gravityview'), |
|
| 649 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 650 | 650 | 'type' => 'source_url', |
| 651 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 651 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 652 | 652 | ), |
| 653 | 653 | 'ip' => array( |
| 654 | - 'label' => __('User IP', 'gravityview'), |
|
| 654 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 655 | 655 | 'type' => 'ip', |
| 656 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 656 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 657 | 657 | ), |
| 658 | 658 | 'created_by' => array( |
| 659 | - 'label' => __('User', 'gravityview'), |
|
| 659 | + 'label' => __( 'User', 'gravityview' ), |
|
| 660 | 660 | 'type' => 'created_by', |
| 661 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 661 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 662 | 662 | ), |
| 663 | 663 | |
| 664 | 664 | /** |
| 665 | 665 | * @since 1.2 |
| 666 | 666 | */ |
| 667 | 667 | 'custom' => array( |
| 668 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 668 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 669 | 669 | 'type' => 'custom', |
| 670 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 670 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 671 | 671 | ), |
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * @since 1.7.2 |
| 675 | 675 | */ |
| 676 | 676 | 'other_entries' => array( |
| 677 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 677 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 678 | 678 | 'type' => 'other_entries', |
| 679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 679 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 680 | 680 | ), |
| 681 | 681 | |
| 682 | 682 | /** |
| 683 | 683 | * @since 1.14 |
| 684 | 684 | */ |
| 685 | 685 | 'notes' => array( |
| 686 | - 'label' => __('Entry Notes', 'gravityview'), |
|
| 686 | + 'label' => __( 'Entry Notes', 'gravityview' ), |
|
| 687 | 687 | 'type' => 'notes', |
| 688 | - 'desc' => __('Entry notes (if any).', 'gravityview'), |
|
| 688 | + 'desc' => __( 'Entry notes (if any).', 'gravityview' ), |
|
| 689 | 689 | ), |
| 690 | 690 | ); |
| 691 | 691 | |
| 692 | - if( 'single' !== $zone) { |
|
| 692 | + if ( 'single' !== $zone ) { |
|
| 693 | 693 | |
| 694 | - $entry_default_fields['entry_link'] = array( |
|
| 695 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 696 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 694 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 695 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 696 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 697 | 697 | 'type' => 'entry_link', |
| 698 | 698 | ); |
| 699 | 699 | } |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @param string|array $form form_ID or form object |
| 708 | 708 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 709 | 709 | */ |
| 710 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 710 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | function get_available_fields( $form = '', $zone = NULL ) { |
| 720 | 720 | |
| 721 | - if( empty( $form ) ) { |
|
| 721 | + if ( empty( $form ) ) { |
|
| 722 | 722 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
| 723 | 723 | return array(); |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $fields = gravityview_get_form_fields( $form, true ); |
| 728 | 728 | |
| 729 | 729 | // get meta fields ( only if form was already created ) |
| 730 | - if( !is_array( $form ) ) { |
|
| 730 | + if ( ! is_array( $form ) ) { |
|
| 731 | 731 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 732 | 732 | } else { |
| 733 | 733 | $meta_fields = array(); |
@@ -751,11 +751,11 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | $widgets = $this->get_registered_widgets(); |
| 753 | 753 | |
| 754 | - if( !empty( $widgets ) ) { |
|
| 754 | + if ( ! empty( $widgets ) ) { |
|
| 755 | 755 | |
| 756 | - foreach( $widgets as $id => $details ) { |
|
| 756 | + foreach ( $widgets as $id => $details ) { |
|
| 757 | 757 | |
| 758 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 758 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 759 | 759 | |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 790 | 790 | global $post; |
| 791 | 791 | |
| 792 | - if( $type === 'widget' ) { |
|
| 792 | + if ( $type === 'widget' ) { |
|
| 793 | 793 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 794 | 794 | } else { |
| 795 | 795 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -798,15 +798,15 @@ discard block |
||
| 798 | 798 | $available_items = array(); |
| 799 | 799 | |
| 800 | 800 | // if saved values, get available fields to label everyone |
| 801 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 801 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 802 | 802 | |
| 803 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 804 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 803 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 804 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 805 | 805 | } else { |
| 806 | 806 | $form = gravityview_get_form_id( $post->ID ); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - if( 'field' === $type ) { |
|
| 809 | + if ( 'field' === $type ) { |
|
| 810 | 810 | $available_items = $this->get_available_fields( $form, $zone ); |
| 811 | 811 | } else { |
| 812 | 812 | $available_items = $this->get_registered_widgets(); |
@@ -814,39 +814,39 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - foreach( $rows as $row ) : |
|
| 818 | - foreach( $row as $col => $areas ) : |
|
| 819 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 817 | + foreach ( $rows as $row ) : |
|
| 818 | + foreach ( $row as $col => $areas ) : |
|
| 819 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 820 | 820 | |
| 821 | 821 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 822 | 822 | |
| 823 | - <?php foreach( $areas as $area ) : ?> |
|
| 823 | + <?php foreach ( $areas as $area ) : ?> |
|
| 824 | 824 | |
| 825 | 825 | <div class="gv-droppable-area"> |
| 826 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 826 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 827 | 827 | |
| 828 | 828 | <?php // render saved fields |
| 829 | 829 | |
| 830 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 830 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 831 | 831 | |
| 832 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 832 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 833 | 833 | |
| 834 | 834 | $input_type = NULL; |
| 835 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 835 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 836 | 836 | |
| 837 | - if( !$original_item ) { |
|
| 837 | + if ( ! $original_item ) { |
|
| 838 | 838 | |
| 839 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
| 839 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
| 840 | 840 | |
| 841 | 841 | $original_item = $field; |
| 842 | 842 | } else { |
| 843 | 843 | |
| 844 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 844 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 845 | 845 | |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | // Field options dialog box |
| 849 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 849 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 850 | 850 | |
| 851 | 851 | $item = array( |
| 852 | 852 | 'input_type' => $input_type, |
@@ -855,16 +855,16 @@ discard block |
||
| 855 | 855 | ); |
| 856 | 856 | |
| 857 | 857 | // Merge the values with the current item to pass things like widget descriptions and original field names |
| 858 | - if( $original_item ) { |
|
| 858 | + if ( $original_item ) { |
|
| 859 | 859 | $item = wp_parse_args( $item, $original_item ); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - switch( $type ) { |
|
| 862 | + switch ( $type ) { |
|
| 863 | 863 | case 'widget': |
| 864 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 864 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 865 | 865 | break; |
| 866 | 866 | default: |
| 867 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
| 867 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | |
@@ -874,11 +874,11 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | } // End if zone is not empty ?> |
| 876 | 876 | |
| 877 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 877 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 878 | 878 | </div> |
| 879 | 879 | <div class="gv-droppable-area-action"> |
| 880 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 881 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 880 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 881 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 882 | 882 | </div> |
| 883 | 883 | </div> |
| 884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 901 | 901 | |
| 902 | 902 | $widgets = array(); |
| 903 | - if( !empty( $post_id ) ) { |
|
| 903 | + if ( ! empty( $post_id ) ) { |
|
| 904 | 904 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
| 905 | 905 | |
| 906 | 906 | } |
@@ -931,19 +931,19 @@ discard block |
||
| 931 | 931 | */ |
| 932 | 932 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 933 | 933 | |
| 934 | - if( empty( $template_id ) ) { |
|
| 934 | + if ( empty( $template_id ) ) { |
|
| 935 | 935 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
| 936 | 936 | return; |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 940 | 940 | |
| 941 | - if( empty( $template_areas ) ) { |
|
| 941 | + if ( empty( $template_areas ) ) { |
|
| 942 | 942 | |
| 943 | 943 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
| 944 | 944 | $output = '<div>'; |
| 945 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 946 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 945 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 946 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 947 | 947 | $output .= '</div>'; |
| 948 | 948 | } else { |
| 949 | 949 | |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | - if( $echo ) { |
|
| 961 | + if ( $echo ) { |
|
| 962 | 962 | echo $output; |
| 963 | 963 | } |
| 964 | 964 | |
@@ -978,25 +978,25 @@ discard block |
||
| 978 | 978 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 979 | 979 | |
| 980 | 980 | // Add the GV font (with the Astronaut) |
| 981 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 981 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 982 | 982 | |
| 983 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 983 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 984 | 984 | |
| 985 | 985 | // Don't process any scripts below here if it's not a GravityView page. |
| 986 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
| 986 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
| 987 | 987 | |
| 988 | 988 | // Only enqueue the following on single pages |
| 989 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
| 989 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
| 990 | 990 | |
| 991 | 991 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 992 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 992 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 993 | 993 | |
| 994 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 994 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 995 | 995 | |
| 996 | 996 | //enqueue scripts |
| 997 | 997 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 998 | 998 | |
| 999 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 999 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1000 | 1000 | 'cookiepath' => COOKIEPATH, |
| 1001 | 1001 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1002 | 1002 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1009,9 +1009,9 @@ discard block |
||
| 1009 | 1009 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1010 | 1010 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1011 | 1011 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1012 | - )); |
|
| 1012 | + ) ); |
|
| 1013 | 1013 | |
| 1014 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1014 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1015 | 1015 | |
| 1016 | 1016 | self::enqueue_gravity_forms_scripts(); |
| 1017 | 1017 | |
@@ -1030,10 +1030,10 @@ discard block |
||
| 1030 | 1030 | ); |
| 1031 | 1031 | |
| 1032 | 1032 | if ( wp_is_mobile() ) { |
| 1033 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1033 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | - foreach ($scripts as $script) { |
|
| 1036 | + foreach ( $scripts as $script ) { |
|
| 1037 | 1037 | wp_enqueue_script( $script ); |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
@@ -1042,11 +1042,11 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | $filter = current_filter(); |
| 1044 | 1044 | |
| 1045 | - if( preg_match('/script/ism', $filter ) ) { |
|
| 1045 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
| 1046 | 1046 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
| 1047 | 1047 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
| 1048 | 1048 | $registered = array_merge( $registered, $allow_scripts ); |
| 1049 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
| 1049 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
| 1050 | 1050 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
| 1051 | 1051 | $registered = array_merge( $registered, $allow_styles ); |
| 1052 | 1052 | } |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
| 33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
| 34 | 34 | |
| 35 | - if( file_exists( $template_css_path ) ) { |
|
| 35 | + if ( file_exists( $template_css_path ) ) { |
|
| 36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
| 37 | - do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' ); |
|
| 37 | + do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' ); |
|
| 38 | 38 | } else { |
| 39 | 39 | // Default: use GravityView CSS file |
| 40 | 40 | |
| 41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
| 42 | - if( '' === $dir_path ) { |
|
| 42 | + if ( '' === $dir_path ) { |
|
| 43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
| 47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
| 84 | 84 | |
| 85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
| 85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
| 86 | 86 | |
| 87 | - if( empty( $permalink_args ) ) { |
|
| 87 | + if ( empty( $permalink_args ) ) { |
|
| 88 | 88 | return array(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
| 110 | 110 | |
| 111 | 111 | $output = ''; |
| 112 | - if( is_array( $current ) ) { |
|
| 113 | - if( in_array( $value, $current ) ) { |
|
| 112 | + if ( is_array( $current ) ) { |
|
| 113 | + if ( in_array( $value, $current ) ) { |
|
| 114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if( $echo ) { |
|
| 120 | + if ( $echo ) { |
|
| 121 | 121 | echo $output; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | function gravityview_strip_whitespace( $string ) { |
| 173 | 173 | $string = normalize_whitespace( $string ); |
| 174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
| 174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @return string Included file contents |
| 186 | 186 | */ |
| 187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
| 188 | - if( ! file_exists( $file_path ) ) { |
|
| 188 | + if ( ! file_exists( $file_path ) ) { |
|
| 189 | 189 | do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
| 190 | 190 | return ''; |
| 191 | 191 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | function gravityview_get_floaty() { |
| 203 | 203 | |
| 204 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 204 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
| 205 | 205 | $style = 'margin:10px 10px 10px 0;'; |
| 206 | 206 | $class = 'alignright'; |
| 207 | 207 | } else { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $class = 'alignleft'; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 212 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="87" width="66" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | function gravityview_number_format( $number, $decimals = '' ) { |
| 233 | 233 | global $wp_locale; |
| 234 | 234 | |
| 235 | - if( '' === $decimals ) { |
|
| 235 | + if ( '' === $decimals ) { |
|
| 236 | 236 | |
| 237 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 237 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Calculate the position of the decimal point in the number |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $parts = parse_url( $value ); |
| 264 | 264 | |
| 265 | 265 | // No domain? Strange...show the original text. |
| 266 | - if( empty( $parts['host'] ) ) { |
|
| 266 | + if ( empty( $parts[ 'host' ] ) ) { |
|
| 267 | 267 | return $value; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -276,16 +276,16 @@ discard block |
||
| 276 | 276 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 277 | 277 | * If true: `http://example.com => example.com` |
| 278 | 278 | */ |
| 279 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 279 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
| 280 | 280 | |
| 281 | - if( isset( $parts['scheme'] ) ) { |
|
| 282 | - $return .= $parts['scheme']; |
|
| 281 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
| 282 | + $return .= $parts[ 'scheme' ]; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // The domain, which may contain a subdomain |
| 288 | - $domain = $parts['host']; |
|
| 288 | + $domain = $parts[ 'host' ]; |
|
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | 291 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 294 | 294 | * If true: `www.example.com => example.com` |
| 295 | 295 | */ |
| 296 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 296 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
| 297 | 297 | |
| 298 | - if( $strip_www ) { |
|
| 299 | - $domain = str_replace('www.', '', $domain ); |
|
| 298 | + if ( $strip_www ) { |
|
| 299 | + $domain = str_replace( 'www.', '', $domain ); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | * If true: `http://demo.example.com => example.com` \n |
| 307 | 307 | * If false: `http://demo.example.com => demo.example.com` |
| 308 | 308 | */ |
| 309 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
| 309 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
| 310 | 310 | |
| 311 | - if( $strip_subdomains ) { |
|
| 311 | + if ( $strip_subdomains ) { |
|
| 312 | 312 | |
| 313 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 313 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
| 314 | 314 | |
| 315 | 315 | } |
| 316 | 316 | |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
| 325 | 325 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
| 326 | 326 | */ |
| 327 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
| 327 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
| 328 | 328 | |
| 329 | - if( empty( $root_only ) ) { |
|
| 329 | + if ( empty( $root_only ) ) { |
|
| 330 | 330 | |
| 331 | - if( isset( $parts['path'] ) ) { |
|
| 332 | - $return .= $parts['path']; |
|
| 331 | + if ( isset( $parts[ 'path' ] ) ) { |
|
| 332 | + $return .= $parts[ 'path' ]; |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -339,12 +339,12 @@ discard block |
||
| 339 | 339 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 340 | 340 | * If true: `http://example.com/?query=example => example.com` |
| 341 | 341 | */ |
| 342 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 342 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
| 343 | 343 | |
| 344 | - if( empty( $strip_query_string ) ) { |
|
| 344 | + if ( empty( $strip_query_string ) ) { |
|
| 345 | 345 | |
| 346 | - if( isset( $parts['query'] ) ) { |
|
| 347 | - $return .= '?'.$parts['query']; |
|
| 346 | + if ( isset( $parts[ 'query' ] ) ) { |
|
| 347 | + $return .= '?' . $parts[ 'query' ]; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | } |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
| 363 | 363 | |
| 364 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 365 | - return $matches['domain']; |
|
| 364 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 365 | + return $matches[ 'domain' ]; |
|
| 366 | 366 | } else { |
| 367 | 367 | return $string_maybe_has_subdomain; |
| 368 | 368 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
| 385 | 385 | |
| 386 | - if( |
|
| 386 | + if ( |
|
| 387 | 387 | ! isset( $value ) // If it's not set, it's empty! |
| 388 | 388 | || false === $value |
| 389 | 389 | || null === $value |
@@ -394,20 +394,20 @@ discard block |
||
| 394 | 394 | return true; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
| 397 | + if ( is_string( $value ) && $allow_string_booleans ) { |
|
| 398 | 398 | |
| 399 | 399 | $value = trim( $value ); |
| 400 | 400 | $value = strtolower( $value ); |
| 401 | 401 | |
| 402 | 402 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
| 403 | 403 | $value = true; |
| 404 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 404 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 405 | 405 | $value = false; |
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
| 410 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 410 | + if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 411 | 411 | return false; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | // Use the original function, if exists. |
| 432 | 432 | // Requires WP 4.4+ |
| 433 | - if( function_exists( 'map_deep') ) { |
|
| 433 | + if ( function_exists( 'map_deep' ) ) { |
|
| 434 | 434 | return map_deep( $value, $callback ); |
| 435 | 435 | } |
| 436 | 436 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | $exploded = explode( '.', "{$field_id}" ); |
| 497 | 497 | |
| 498 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
| 498 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
@@ -536,13 +536,13 @@ discard block |
||
| 536 | 536 | */ |
| 537 | 537 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
| 538 | 538 | |
| 539 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 539 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
| 540 | 540 | |
| 541 | 541 | $choices = array(); |
| 542 | 542 | |
| 543 | 543 | if ( is_array( $terms ) ) { |
| 544 | 544 | foreach ( $terms as $term_id => $term_name ) { |
| 545 | - $choices[] = array( |
|
| 545 | + $choices[ ] = array( |
|
| 546 | 546 | 'text' => $term_name, |
| 547 | 547 | 'value' => $term_id |
| 548 | 548 | ); |
@@ -566,21 +566,21 @@ discard block |
||
| 566 | 566 | function _gravityview_process_posted_fields() { |
| 567 | 567 | $fields = array(); |
| 568 | 568 | |
| 569 | - if( !empty( $_POST['fields'] ) ) { |
|
| 570 | - if ( ! is_array( $_POST['fields'] ) ) { |
|
| 569 | + if ( ! empty( $_POST[ 'fields' ] ) ) { |
|
| 570 | + if ( ! is_array( $_POST[ 'fields' ] ) ) { |
|
| 571 | 571 | |
| 572 | 572 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
| 573 | 573 | $fields_holder = array(); |
| 574 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
| 574 | + GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder ); |
|
| 575 | 575 | |
| 576 | - if ( isset( $fields_holder['fields'] ) ) { |
|
| 577 | - $fields = $fields_holder['fields']; |
|
| 576 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
| 577 | + $fields = $fields_holder[ 'fields' ]; |
|
| 578 | 578 | } else { |
| 579 | 579 | do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | } else { |
| 583 | - $fields = $_POST['fields']; |
|
| 583 | + $fields = $_POST[ 'fields' ]; |
|
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | 'slug' => 'edit', |
| 25 | 25 | 'type' => 'internal', |
| 26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
| 27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
| 28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
| 27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
| 28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
| 29 | 29 | 'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ), |
| 30 | 30 | ); |
| 31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | '1-1' => array( |
| 43 | 43 | array( |
| 44 | 44 | 'areaid' => 'edit-fields', |
| 45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
| 45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
| 46 | 46 | ) |
| 47 | 47 | ) |
| 48 | 48 | ) |