@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $form = $gravityview_view->getForm(); |
| 33 | 33 | |
| 34 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
| 34 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
| 35 | 35 | /** Allow to fall through for back compatibility testing purposes. */ |
| 36 | 36 | } else { |
| 37 | 37 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $width = NULL; |
| 74 | 74 | |
| 75 | - if( !empty( $field['width'] ) ) { |
|
| 76 | - $width = absint( $field['width'] ); |
|
| 75 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
| 76 | + $width = absint( $field[ 'width' ] ); |
|
| 77 | 77 | |
| 78 | 78 | // If using percentages, limit to 100% |
| 79 | - if( '%d%%' === $format && $width > 100 ) { |
|
| 79 | + if ( '%d%%' === $format && $width > 100 ) { |
|
| 80 | 80 | $width = 100; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -97,42 +97,42 @@ discard block |
||
| 97 | 97 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
| 98 | 98 | $classes = array(); |
| 99 | 99 | |
| 100 | - if( !empty( $field['custom_class'] ) ) { |
|
| 100 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
| 101 | 101 | |
| 102 | - $custom_class = $field['custom_class']; |
|
| 102 | + $custom_class = $field[ 'custom_class' ]; |
|
| 103 | 103 | |
| 104 | - if( !empty( $entry ) ) { |
|
| 104 | + if ( ! empty( $entry ) ) { |
|
| 105 | 105 | |
| 106 | 106 | // We want the merge tag to be formatted as a class. The merge tag may be |
| 107 | 107 | // replaced by a multiple-word value that should be output as a single class. |
| 108 | 108 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
| 109 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 109 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 110 | 110 | |
| 111 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 111 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
| 112 | 112 | |
| 113 | 113 | // And then we want life to return to normal |
| 114 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 114 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // And now we want the spaces to be handled nicely. |
| 118 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
| 118 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if(!empty($field['id'])) { |
|
| 123 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
| 124 | - $form_id = '-'.$form['id']; |
|
| 122 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
| 123 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 124 | + $form_id = '-' . $form[ 'id' ]; |
|
| 125 | 125 | } else { |
| 126 | 126 | // @deprecated path. Form should always be given. |
| 127 | 127 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
| 128 | 128 | $gravityview_view = GravityView_View::getInstance(); |
| 129 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
| 129 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
| 132 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return esc_attr(implode(' ', $classes)); |
|
| 135 | + return esc_attr( implode( ' ', $classes ) ); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @return string Sanitized unique HTML `id` attribute for the field |
| 149 | 149 | */ |
| 150 | 150 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
| 151 | - $id = $field['id']; |
|
| 151 | + $id = $field[ 'id' ]; |
|
| 152 | 152 | |
| 153 | 153 | if ( ! empty( $id ) ) { |
| 154 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
| 155 | - $form_id = '-' . $form['id']; |
|
| 154 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 155 | + $form_id = '-' . $form[ 'id' ]; |
|
| 156 | 156 | } else { |
| 157 | 157 | // @deprecated path. Form should always be given. |
| 158 | 158 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
| 163 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return esc_attr( $id ); |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
| 202 | 202 | |
| 203 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 203 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 204 | 204 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
| 205 | 205 | return NULL; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $href = self::entry_link( $entry, $base_id ); |
| 209 | 209 | |
| 210 | - if( '' === $href ) { |
|
| 210 | + if ( '' === $href ) { |
|
| 211 | 211 | return NULL; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } else { |
| 245 | 245 | $gravityview_view = GravityView_View::getInstance(); |
| 246 | 246 | |
| 247 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 247 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 248 | 248 | $is_search = true; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | // If we've saved the permalink in memory, use it |
| 343 | 343 | // @since 1.3 |
| 344 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 344 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 345 | 345 | |
| 346 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
| 346 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
| 347 | 347 | $link = home_url(); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | // If not yet saved, cache the permalink. |
| 354 | 354 | // @since 1.3 |
| 355 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 355 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | // Deal with returning to proper pagination for embedded views |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $args = array(); |
| 362 | 362 | |
| 363 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 364 | - $args['pagenum'] = intval( $pagenum ); |
|
| 363 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 364 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 368 | - $args['sort'] = $sort; |
|
| 369 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 367 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 368 | + $args[ 'sort' ] = $sort; |
|
| 369 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $link = add_query_arg( $args, $link ); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 404 | 404 | |
| 405 | 405 | // Generate an unique hash to use as the default value |
| 406 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 406 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | 409 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 415 | 415 | |
| 416 | 416 | // Make sure we have something - use the original ID as backup. |
| 417 | - if( empty( $slug ) ) { |
|
| 417 | + if ( empty( $slug ) ) { |
|
| 418 | 418 | $slug = $id; |
| 419 | 419 | } |
| 420 | 420 | |
@@ -508,15 +508,15 @@ discard block |
||
| 508 | 508 | * @param boolean $custom Should we process the custom entry slug? |
| 509 | 509 | */ |
| 510 | 510 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 511 | - if( $custom ) { |
|
| 511 | + if ( $custom ) { |
|
| 512 | 512 | // create the gravityview_unique_id and save it |
| 513 | 513 | |
| 514 | 514 | // Get the entry hash |
| 515 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 515 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 516 | 516 | |
| 517 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 517 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
| 518 | 518 | |
| 519 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 519 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 520 | 520 | |
| 521 | 521 | } |
| 522 | 522 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
| 537 | 537 | $entry = GVCommon::get_entry( $entry ); |
| 538 | - } else if( empty( $entry ) ) { |
|
| 538 | + } else if ( empty( $entry ) ) { |
|
| 539 | 539 | // @deprecated path |
| 540 | 540 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 541 | 541 | } |
@@ -555,9 +555,9 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
| 557 | 557 | |
| 558 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 558 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 559 | 559 | |
| 560 | - if ( get_option('permalink_structure') && !is_preview() ) { |
|
| 560 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 561 | 561 | |
| 562 | 562 | $args = array(); |
| 563 | 563 | |
@@ -567,9 +567,9 @@ discard block |
||
| 567 | 567 | */ |
| 568 | 568 | $link_parts = explode( '?', $directory_link ); |
| 569 | 569 | |
| 570 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 570 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 571 | 571 | |
| 572 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 572 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 573 | 573 | |
| 574 | 574 | } else { |
| 575 | 575 | |
@@ -581,22 +581,22 @@ discard block |
||
| 581 | 581 | */ |
| 582 | 582 | if ( $add_directory_args ) { |
| 583 | 583 | |
| 584 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 585 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 584 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 585 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
| 589 | 589 | * @since 1.7 |
| 590 | 590 | */ |
| 591 | 591 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
| 592 | - $args['sort'] = $sort; |
|
| 593 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 592 | + $args[ 'sort' ] = $sort; |
|
| 593 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
| 599 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 599 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | return add_query_arg( $args, $directory_link ); |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 620 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 620 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $view_id = 0; |
| 641 | 641 | if ( $context->view ) { |
| 642 | 642 | $view_id = $context->view->ID; |
| 643 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 643 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 644 | 644 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
| 645 | 645 | } |
| 646 | 646 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $default_css_class .= ' gv-container-no-results'; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 671 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | $value = GravityView_API::field_value( $entry, $field ); |
| 697 | 697 | |
| 698 | - if( $value === '' ) { |
|
| 698 | + if ( $value === '' ) { |
|
| 699 | 699 | /** |
| 700 | 700 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 701 | 701 | * @param string $value (empty string) |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 810 | 810 | |
| 811 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 811 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 812 | 812 | |
| 813 | 813 | // For the complete field value as generated by Gravity Forms |
| 814 | 814 | return $display_value; |
@@ -842,16 +842,16 @@ discard block |
||
| 842 | 842 | $terms = explode( ', ', $value ); |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - foreach ($terms as $term_name ) { |
|
| 845 | + foreach ( $terms as $term_name ) { |
|
| 846 | 846 | |
| 847 | 847 | // If we're processing a category, |
| 848 | - if( $taxonomy === 'category' ) { |
|
| 848 | + if ( $taxonomy === 'category' ) { |
|
| 849 | 849 | |
| 850 | 850 | // Use rgexplode to prevent errors if : doesn't exist |
| 851 | 851 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
| 852 | 852 | |
| 853 | 853 | // The explode was succesful; we have the category ID |
| 854 | - if( !empty( $term_id )) { |
|
| 854 | + if ( ! empty( $term_id ) ) { |
|
| 855 | 855 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 856 | 856 | } else { |
| 857 | 857 | // We have to fall back to the name |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // There's still a tag/category here. |
| 867 | - if( $term ) { |
|
| 867 | + if ( $term ) { |
|
| 868 | 868 | |
| 869 | 869 | $term_link = get_term_link( $term, $taxonomy ); |
| 870 | 870 | |
@@ -873,11 +873,11 @@ discard block |
||
| 873 | 873 | continue; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 876 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - return implode(', ', $output ); |
|
| 880 | + return implode( ', ', $output ); |
|
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | /** |
@@ -891,8 +891,8 @@ discard block |
||
| 891 | 891 | |
| 892 | 892 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 893 | 893 | |
| 894 | - if( empty( $link ) ) { |
|
| 895 | - return strip_tags( $output); |
|
| 894 | + if ( empty( $link ) ) { |
|
| 895 | + return strip_tags( $output ); |
|
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | return $output; |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | $fe = GravityView_frontend::getInstance(); |
| 912 | 912 | |
| 913 | 913 | // Solve problem when loading content via admin-ajax.php |
| 914 | - if( ! $fe->getGvOutputData() ) { |
|
| 914 | + if ( ! $fe->getGvOutputData() ) { |
|
| 915 | 915 | |
| 916 | 916 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
| 917 | 917 | |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | // Make 100% sure that we're dealing with a properly called situation |
| 922 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 922 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 923 | 923 | |
| 924 | 924 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
| 925 | 925 | |
@@ -1141,12 +1141,12 @@ discard block |
||
| 1141 | 1141 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
| 1142 | 1142 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1143 | 1143 | |
| 1144 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1145 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1144 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1145 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1149 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1148 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1149 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | if ( is_null( $context ) ) { |
@@ -1249,21 +1249,21 @@ discard block |
||
| 1249 | 1249 | } else { |
| 1250 | 1250 | // @deprecated path |
| 1251 | 1251 | // Required fields. |
| 1252 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1252 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1253 | 1253 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
| 1254 | 1254 | return ''; |
| 1255 | 1255 | } |
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | if ( $context instanceof \GV\Template_Context ) { |
| 1259 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1260 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1261 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1259 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1260 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1261 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1262 | 1262 | } else { |
| 1263 | 1263 | // @deprecated path |
| 1264 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1265 | - $field = $args['field']; |
|
| 1266 | - $form = $args['form']; |
|
| 1264 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1265 | + $field = $args[ 'field' ]; |
|
| 1266 | + $form = $args[ 'form' ]; |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | /** |
@@ -1283,43 +1283,43 @@ discard block |
||
| 1283 | 1283 | ); |
| 1284 | 1284 | |
| 1285 | 1285 | if ( $context instanceof \GV\Template_Context ) { |
| 1286 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1286 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1287 | 1287 | } else { |
| 1288 | 1288 | // @deprecated path |
| 1289 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
| 1289 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | // If the value is empty and we're hiding empty, return empty. |
| 1293 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1293 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1294 | 1294 | return ''; |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1298 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
| 1297 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1298 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | 1301 | // Get width setting, if exists |
| 1302 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
| 1302 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
| 1303 | 1303 | |
| 1304 | 1304 | // If replacing with CSS inline formatting, let's do it. |
| 1305 | - $placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
| 1305 | + $placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
| 1306 | 1306 | |
| 1307 | 1307 | // Grab the Class using `gv_class` |
| 1308 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
| 1309 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1308 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
| 1309 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1310 | 1310 | |
| 1311 | 1311 | if ( $context instanceof \GV\Template_Context ) { |
| 1312 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label' ); |
|
| 1312 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' ); |
|
| 1313 | 1313 | } else { |
| 1314 | 1314 | // Default Label value |
| 1315 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
| 1315 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
| 1319 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
| 1318 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
| 1319 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
| 1320 | 1320 | |
| 1321 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
| 1322 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1321 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
| 1322 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | /** |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | * @since 2.0 |
| 1331 | 1331 | * @param \GV\Template_Context $context The context. |
| 1332 | 1332 | */ |
| 1333 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
| 1333 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
| 1334 | 1334 | |
| 1335 | 1335 | /** |
| 1336 | 1336 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | foreach ( $placeholders as $tag => $value ) { |
| 1358 | 1358 | |
| 1359 | 1359 | // If the tag doesn't exist just skip it |
| 1360 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1360 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1361 | 1361 | continue; |
| 1362 | 1362 | } |
| 1363 | 1363 | |