@@ -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,21 +581,21 @@ 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 | - if( $post_id ) { |
|
| 598 | + if ( $post_id ) { |
|
| 599 | 599 | $passed_post = get_post( $post_id ); |
| 600 | 600 | $views = \GV\View_Collection::from_post( $passed_post ); |
| 601 | 601 | $has_multiple_views = $views->count() > 1; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if ( $has_multiple_views ) { |
| 607 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 607 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | return add_query_arg( $args, $directory_link ); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 628 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 628 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $view_id = 0; |
| 649 | 649 | if ( $context->view ) { |
| 650 | 650 | $view_id = $context->view->ID; |
| 651 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 651 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 652 | 652 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
| 653 | 653 | } |
| 654 | 654 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | $default_css_class .= ' gv-container-no-results'; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 679 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 680 | 680 | |
| 681 | 681 | /** |
| 682 | 682 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | |
| 704 | 704 | $value = GravityView_API::field_value( $entry, $field ); |
| 705 | 705 | |
| 706 | - if( $value === '' ) { |
|
| 706 | + if ( $value === '' ) { |
|
| 707 | 707 | /** |
| 708 | 708 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 709 | 709 | * @param string $value (empty string) |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | */ |
| 817 | 817 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 818 | 818 | |
| 819 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 819 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 820 | 820 | |
| 821 | 821 | // For the complete field value as generated by Gravity Forms |
| 822 | 822 | return $display_value; |
@@ -850,16 +850,16 @@ discard block |
||
| 850 | 850 | $terms = explode( ', ', $value ); |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | - foreach ($terms as $term_name ) { |
|
| 853 | + foreach ( $terms as $term_name ) { |
|
| 854 | 854 | |
| 855 | 855 | // If we're processing a category, |
| 856 | - if( $taxonomy === 'category' ) { |
|
| 856 | + if ( $taxonomy === 'category' ) { |
|
| 857 | 857 | |
| 858 | 858 | // Use rgexplode to prevent errors if : doesn't exist |
| 859 | 859 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
| 860 | 860 | |
| 861 | 861 | // The explode was succesful; we have the category ID |
| 862 | - if( !empty( $term_id )) { |
|
| 862 | + if ( ! empty( $term_id ) ) { |
|
| 863 | 863 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 864 | 864 | } else { |
| 865 | 865 | // We have to fall back to the name |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | // There's still a tag/category here. |
| 875 | - if( $term ) { |
|
| 875 | + if ( $term ) { |
|
| 876 | 876 | |
| 877 | 877 | $term_link = get_term_link( $term, $taxonomy ); |
| 878 | 878 | |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | continue; |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 884 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | - return implode(', ', $output ); |
|
| 888 | + return implode( ', ', $output ); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | |
| 900 | 900 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 901 | 901 | |
| 902 | - if( empty( $link ) ) { |
|
| 903 | - return strip_tags( $output); |
|
| 902 | + if ( empty( $link ) ) { |
|
| 903 | + return strip_tags( $output ); |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | return $output; |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | $fe = GravityView_frontend::getInstance(); |
| 920 | 920 | |
| 921 | 921 | // Solve problem when loading content via admin-ajax.php |
| 922 | - if( ! $fe->getGvOutputData() ) { |
|
| 922 | + if ( ! $fe->getGvOutputData() ) { |
|
| 923 | 923 | |
| 924 | 924 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
| 925 | 925 | |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | // Make 100% sure that we're dealing with a properly called situation |
| 930 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 930 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 931 | 931 | |
| 932 | 932 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
| 933 | 933 | |
@@ -1149,12 +1149,12 @@ discard block |
||
| 1149 | 1149 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
| 1150 | 1150 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1151 | 1151 | |
| 1152 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1153 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1152 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1153 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1157 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1156 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1157 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | if ( is_null( $context ) ) { |
@@ -1257,21 +1257,21 @@ discard block |
||
| 1257 | 1257 | } else { |
| 1258 | 1258 | // @deprecated path |
| 1259 | 1259 | // Required fields. |
| 1260 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1260 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1261 | 1261 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
| 1262 | 1262 | return ''; |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | if ( $context instanceof \GV\Template_Context ) { |
| 1267 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1268 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1269 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1267 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1268 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1269 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1270 | 1270 | } else { |
| 1271 | 1271 | // @deprecated path |
| 1272 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1273 | - $field = $args['field']; |
|
| 1274 | - $form = $args['form']; |
|
| 1272 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1273 | + $field = $args[ 'field' ]; |
|
| 1274 | + $form = $args[ 'form' ]; |
|
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | 1277 | /** |
@@ -1291,43 +1291,43 @@ discard block |
||
| 1291 | 1291 | ); |
| 1292 | 1292 | |
| 1293 | 1293 | if ( $context instanceof \GV\Template_Context ) { |
| 1294 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1294 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1295 | 1295 | } else { |
| 1296 | 1296 | // @deprecated path |
| 1297 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
| 1297 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | // If the value is empty and we're hiding empty, return empty. |
| 1301 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1301 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1302 | 1302 | return ''; |
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1306 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
| 1305 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1306 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | // Get width setting, if exists |
| 1310 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
| 1310 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
| 1311 | 1311 | |
| 1312 | 1312 | // If replacing with CSS inline formatting, let's do it. |
| 1313 | - $placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
| 1313 | + $placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
| 1314 | 1314 | |
| 1315 | 1315 | // Grab the Class using `gv_class` |
| 1316 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
| 1317 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1316 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
| 1317 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1318 | 1318 | |
| 1319 | 1319 | if ( $context instanceof \GV\Template_Context ) { |
| 1320 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label' ); |
|
| 1320 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' ); |
|
| 1321 | 1321 | } else { |
| 1322 | 1322 | // Default Label value |
| 1323 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
| 1323 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
| 1327 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
| 1326 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
| 1327 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
| 1328 | 1328 | |
| 1329 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
| 1330 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1329 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
| 1330 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | /** |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | * @since 2.0 |
| 1339 | 1339 | * @param \GV\Template_Context $context The context. |
| 1340 | 1340 | */ |
| 1341 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
| 1341 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
| 1342 | 1342 | |
| 1343 | 1343 | /** |
| 1344 | 1344 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | foreach ( $placeholders as $tag => $value ) { |
| 1366 | 1366 | |
| 1367 | 1367 | // If the tag doesn't exist just skip it |
| 1368 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1368 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1369 | 1369 | continue; |
| 1370 | 1370 | } |
| 1371 | 1371 | |