@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $form = $gravityview_view->getForm(); |
| 32 | 32 | |
| 33 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
| 33 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
| 34 | 34 | /** Allow to fall through for back compatibility testing purposes. */ |
| 35 | 35 | } else { |
| 36 | 36 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -38,29 +38,29 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $label = ''; |
| 40 | 40 | |
| 41 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
| 41 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
| 42 | 42 | |
| 43 | - $label = $field['label']; |
|
| 43 | + $label = $field[ 'label' ]; |
|
| 44 | 44 | |
| 45 | 45 | // Support Gravity Forms 1.9+ |
| 46 | - if( class_exists( 'GF_Field' ) ) { |
|
| 46 | + if ( class_exists( 'GF_Field' ) ) { |
|
| 47 | 47 | |
| 48 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 48 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 49 | 49 | |
| 50 | - if( $field_object ) { |
|
| 50 | + if ( $field_object ) { |
|
| 51 | 51 | |
| 52 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
| 52 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
| 53 | 53 | |
| 54 | 54 | // This is a complex field, with labels on a per-input basis |
| 55 | - if( $input ) { |
|
| 55 | + if ( $input ) { |
|
| 56 | 56 | |
| 57 | 57 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
| 58 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 58 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 59 | 59 | |
| 60 | 60 | } else { |
| 61 | 61 | |
| 62 | 62 | // This is a field with one label |
| 63 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
| 63 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
| 72 | - if ( !empty( $field['custom_label'] ) ) { |
|
| 72 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 73 | 73 | |
| 74 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
| 74 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | $width = NULL; |
| 135 | 135 | |
| 136 | - if( !empty( $field['width'] ) ) { |
|
| 137 | - $width = absint( $field['width'] ); |
|
| 136 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
| 137 | + $width = absint( $field[ 'width' ] ); |
|
| 138 | 138 | |
| 139 | 139 | // If using percentages, limit to 100% |
| 140 | - if( '%d%%' === $format && $width > 100 ) { |
|
| 140 | + if ( '%d%%' === $format && $width > 100 ) { |
|
| 141 | 141 | $width = 100; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -157,42 +157,42 @@ discard block |
||
| 157 | 157 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
| 158 | 158 | $classes = array(); |
| 159 | 159 | |
| 160 | - if( !empty( $field['custom_class'] ) ) { |
|
| 160 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
| 161 | 161 | |
| 162 | - $custom_class = $field['custom_class']; |
|
| 162 | + $custom_class = $field[ 'custom_class' ]; |
|
| 163 | 163 | |
| 164 | - if( !empty( $entry ) ) { |
|
| 164 | + if ( ! empty( $entry ) ) { |
|
| 165 | 165 | |
| 166 | 166 | // We want the merge tag to be formatted as a class. The merge tag may be |
| 167 | 167 | // replaced by a multiple-word value that should be output as a single class. |
| 168 | 168 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
| 169 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 169 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 170 | 170 | |
| 171 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 171 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
| 172 | 172 | |
| 173 | 173 | // And then we want life to return to normal |
| 174 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 174 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // And now we want the spaces to be handled nicely. |
| 178 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
| 178 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if(!empty($field['id'])) { |
|
| 183 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
| 184 | - $form_id = '-'.$form['id']; |
|
| 182 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
| 183 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 184 | + $form_id = '-' . $form[ 'id' ]; |
|
| 185 | 185 | } else { |
| 186 | 186 | // @deprecated path. Form should always be given. |
| 187 | 187 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
| 188 | 188 | $gravityview_view = GravityView_View::getInstance(); |
| 189 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
| 189 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
| 192 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - return esc_attr(implode(' ', $classes)); |
|
| 195 | + return esc_attr( implode( ' ', $classes ) ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | * @return string Sanitized unique HTML `id` attribute for the field |
| 208 | 208 | */ |
| 209 | 209 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
| 210 | - $id = $field['id']; |
|
| 210 | + $id = $field[ 'id' ]; |
|
| 211 | 211 | |
| 212 | 212 | if ( ! empty( $id ) ) { |
| 213 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
| 214 | - $form_id = '-' . $form['id']; |
|
| 213 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 214 | + $form_id = '-' . $form[ 'id' ]; |
|
| 215 | 215 | } else { |
| 216 | 216 | // @deprecated path. Form should always be given. |
| 217 | 217 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
| 222 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return esc_attr( $id ); |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
| 260 | 260 | |
| 261 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 261 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 262 | 262 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
| 263 | 263 | return NULL; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $href = self::entry_link( $entry, $base_id ); |
| 267 | 267 | |
| 268 | - if( '' === $href ) { |
|
| 268 | + if ( '' === $href ) { |
|
| 269 | 269 | return NULL; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } else { |
| 303 | 303 | $gravityview_view = GravityView_View::getInstance(); |
| 304 | 304 | |
| 305 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 305 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 306 | 306 | $is_search = true; |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $output = esc_html__( 'This search returned no results.', 'gk-gravityview' ); |
| 315 | 315 | |
| 316 | - if( $context ) { |
|
| 316 | + if ( $context ) { |
|
| 317 | 317 | $setting = $context->view->settings->get( 'no_search_results_text', $output ); |
| 318 | 318 | } |
| 319 | 319 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $output = esc_html__( 'No entries match your request.', 'gk-gravityview' ); |
| 323 | 323 | |
| 324 | - if( $context ) { |
|
| 324 | + if ( $context ) { |
|
| 325 | 325 | $setting = $context->view->settings->get( 'no_results_text', $output ); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -444,9 +444,9 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | // If we've saved the permalink in memory, use it |
| 446 | 446 | // @since 1.3 |
| 447 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 447 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 448 | 448 | |
| 449 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
| 449 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
| 450 | 450 | $link = home_url(); |
| 451 | 451 | } |
| 452 | 452 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | // If not yet saved, cache the permalink. |
| 457 | 457 | // @since 1.3 |
| 458 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 458 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // Deal with returning to proper pagination for embedded views |
@@ -463,13 +463,13 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | $args = array(); |
| 465 | 465 | |
| 466 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 467 | - $args['pagenum'] = intval( $pagenum ); |
|
| 466 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 467 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 471 | - $args['sort'] = $sort; |
|
| 472 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 470 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 471 | + $args[ 'sort' ] = $sort; |
|
| 472 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | $link = add_query_arg( $args, $link ); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 507 | 507 | |
| 508 | 508 | // Generate an unique hash to use as the default value |
| 509 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 509 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 510 | 510 | |
| 511 | 511 | /** |
| 512 | 512 | * @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}` |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 518 | 518 | |
| 519 | 519 | // Make sure we have something - use the original ID as backup. |
| 520 | - if( empty( $slug ) ) { |
|
| 520 | + if ( empty( $slug ) ) { |
|
| 521 | 521 | $slug = $id; |
| 522 | 522 | } |
| 523 | 523 | |
@@ -611,15 +611,15 @@ discard block |
||
| 611 | 611 | * @param boolean $custom Should we process the custom entry slug? |
| 612 | 612 | */ |
| 613 | 613 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 614 | - if( $custom ) { |
|
| 614 | + if ( $custom ) { |
|
| 615 | 615 | // create the gravityview_unique_id and save it |
| 616 | 616 | |
| 617 | 617 | // Get the entry hash |
| 618 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 618 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 619 | 619 | |
| 620 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 620 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
| 621 | 621 | |
| 622 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 622 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 623 | 623 | |
| 624 | 624 | } |
| 625 | 625 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | |
| 646 | 646 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
| 647 | 647 | $entry = GVCommon::get_entry( $entry ); |
| 648 | - } else if( empty( $entry ) ) { |
|
| 648 | + } else if ( empty( $entry ) ) { |
|
| 649 | 649 | // @deprecated path |
| 650 | 650 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 651 | 651 | } |
@@ -665,32 +665,32 @@ discard block |
||
| 665 | 665 | |
| 666 | 666 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
| 667 | 667 | |
| 668 | - if ( ! empty( $entry['_multi'] ) ) { |
|
| 668 | + if ( ! empty( $entry[ '_multi' ] ) ) { |
|
| 669 | 669 | $entry_slugs = array(); |
| 670 | 670 | |
| 671 | - foreach ( $entry['_multi'] as $_multi ) { |
|
| 671 | + foreach ( $entry[ '_multi' ] as $_multi ) { |
|
| 672 | 672 | |
| 673 | - if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
| 674 | - $entry_slugs[] = $gv_multi->get_slug(); |
|
| 673 | + if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) { |
|
| 674 | + $entry_slugs[ ] = $gv_multi->get_slug(); |
|
| 675 | 675 | } else { |
| 676 | 676 | // TODO: This path isn't covered by unit tests |
| 677 | - $entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi ); |
|
| 677 | + $entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi ); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | unset( $gv_multi ); |
| 681 | 681 | |
| 682 | - $forms[] = $_multi['form_id']; |
|
| 682 | + $forms[ ] = $_multi[ 'form_id' ]; |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | $entry_slug = implode( ',', $entry_slugs ); |
| 686 | 686 | } else { |
| 687 | 687 | |
| 688 | 688 | // Fallback when |
| 689 | - if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
| 689 | + if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) { |
|
| 690 | 690 | $entry_slug = $gv_entry->get_slug(); |
| 691 | 691 | } else { |
| 692 | 692 | // TODO: This path isn't covered by unit tests |
| 693 | - $entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 693 | + $entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | unset( $gv_entry ); |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $args = gv_get_query_args(); |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - if ( get_option('permalink_structure') && ! is_preview() ) { |
|
| 712 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 713 | 713 | |
| 714 | 714 | /** |
| 715 | 715 | * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug. |
@@ -717,13 +717,13 @@ discard block |
||
| 717 | 717 | */ |
| 718 | 718 | $link_parts = explode( '?', $directory_link ); |
| 719 | 719 | |
| 720 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 720 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 721 | 721 | |
| 722 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 722 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 723 | 723 | |
| 724 | 724 | } else { |
| 725 | 725 | |
| 726 | - $args[] = array( $query_arg_name => $entry_slug ); |
|
| 726 | + $args[ ] = array( $query_arg_name => $entry_slug ); |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | /** |
@@ -731,21 +731,21 @@ discard block |
||
| 731 | 731 | */ |
| 732 | 732 | if ( $add_directory_args ) { |
| 733 | 733 | |
| 734 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 735 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 734 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 735 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
| 739 | 739 | * @since 1.7 |
| 740 | 740 | */ |
| 741 | 741 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
| 742 | - $args['sort'] = $sort; |
|
| 743 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 742 | + $args[ 'sort' ] = $sort; |
|
| 743 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - if( $post_id ) { |
|
| 748 | + if ( $post_id ) { |
|
| 749 | 749 | $passed_post = get_post( $post_id ); |
| 750 | 750 | $views = \GV\View_Collection::from_post( $passed_post ); |
| 751 | 751 | $has_multiple_views = $views->count() > 1; |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | if ( $has_multiple_views ) { |
| 757 | - $args['gvid'] = $view_id ? $view_id : gravityview_get_view_id(); |
|
| 757 | + $args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id(); |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | return add_query_arg( $args, $directory_link ); |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 829 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 829 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /** |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | $view_id = 0; |
| 850 | 850 | if ( $context->view ) { |
| 851 | 851 | $view_id = $context->view->ID; |
| 852 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 852 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 853 | 853 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | $default_css_class .= ' ' . $context->view->settings->get( 'class', '' ); |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 884 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 885 | 885 | |
| 886 | 886 | /** |
| 887 | 887 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | |
| 909 | 909 | $value = GravityView_API::field_value( $entry, $field ); |
| 910 | 910 | |
| 911 | - if( $value === '' ) { |
|
| 911 | + if ( $value === '' ) { |
|
| 912 | 912 | /** |
| 913 | 913 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 914 | 914 | * @param string $value (empty string) |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | function gv_no_results( $wpautop = true, $context = null ) { |
| 931 | - return apply_filters('gravityview/template/no_entries',GravityView_API::no_results( $wpautop, $context ),$context); |
|
| 931 | + return apply_filters( 'gravityview/template/no_entries', GravityView_API::no_results( $wpautop, $context ), $context ); |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | */ |
| 1022 | 1022 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 1023 | 1023 | |
| 1024 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 1024 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 1025 | 1025 | |
| 1026 | 1026 | // For the complete field value as generated by Gravity Forms |
| 1027 | 1027 | return $display_value; |
@@ -1055,16 +1055,16 @@ discard block |
||
| 1055 | 1055 | $terms = explode( ', ', $value ); |
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | - foreach ($terms as $term_name ) { |
|
| 1058 | + foreach ( $terms as $term_name ) { |
|
| 1059 | 1059 | |
| 1060 | 1060 | // If we're processing a category, |
| 1061 | - if( $taxonomy === 'category' ) { |
|
| 1061 | + if ( $taxonomy === 'category' ) { |
|
| 1062 | 1062 | |
| 1063 | 1063 | // Use rgexplode to prevent errors if : doesn't exist |
| 1064 | 1064 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
| 1065 | 1065 | |
| 1066 | 1066 | // The explode was succesful; we have the category ID |
| 1067 | - if( !empty( $term_id )) { |
|
| 1067 | + if ( ! empty( $term_id ) ) { |
|
| 1068 | 1068 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 1069 | 1069 | } else { |
| 1070 | 1070 | // We have to fall back to the name |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | // There's still a tag/category here. |
| 1080 | - if( $term ) { |
|
| 1080 | + if ( $term ) { |
|
| 1081 | 1081 | |
| 1082 | 1082 | $term_link = get_term_link( $term, $taxonomy ); |
| 1083 | 1083 | |
@@ -1086,11 +1086,11 @@ discard block |
||
| 1086 | 1086 | continue; |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 1089 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 1090 | 1090 | } |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | - return implode(', ', $output ); |
|
| 1093 | + return implode( ', ', $output ); |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | /** |
@@ -1104,8 +1104,8 @@ discard block |
||
| 1104 | 1104 | |
| 1105 | 1105 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 1106 | 1106 | |
| 1107 | - if( empty( $link ) ) { |
|
| 1108 | - return strip_tags( $output); |
|
| 1107 | + if ( empty( $link ) ) { |
|
| 1108 | + return strip_tags( $output ); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | return $output; |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $fe = GravityView_frontend::getInstance(); |
| 1125 | 1125 | |
| 1126 | 1126 | // Solve problem when loading content via admin-ajax.php |
| 1127 | - if( ! $fe->getGvOutputData() ) { |
|
| 1127 | + if ( ! $fe->getGvOutputData() ) { |
|
| 1128 | 1128 | |
| 1129 | 1129 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
| 1130 | 1130 | |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | // Make 100% sure that we're dealing with a properly called situation |
| 1135 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 1135 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 1136 | 1136 | |
| 1137 | 1137 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
| 1138 | 1138 | |
@@ -1363,12 +1363,12 @@ discard block |
||
| 1363 | 1363 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
| 1364 | 1364 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1365 | 1365 | |
| 1366 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1367 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1366 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1367 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1371 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1370 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1371 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | if ( is_null( $context ) ) { |
@@ -1479,21 +1479,21 @@ discard block |
||
| 1479 | 1479 | } else { |
| 1480 | 1480 | // @deprecated path |
| 1481 | 1481 | // Required fields. |
| 1482 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1482 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1483 | 1483 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
| 1484 | 1484 | return ''; |
| 1485 | 1485 | } |
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | 1488 | if ( $context instanceof \GV\Template_Context ) { |
| 1489 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1490 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1491 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1489 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1490 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1491 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1492 | 1492 | } else { |
| 1493 | 1493 | // @deprecated path |
| 1494 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1495 | - $field = $args['field']; |
|
| 1496 | - $form = $args['form']; |
|
| 1494 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1495 | + $field = $args[ 'field' ]; |
|
| 1496 | + $form = $args[ 'form' ]; |
|
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | /** |
@@ -1513,43 +1513,43 @@ discard block |
||
| 1513 | 1513 | ); |
| 1514 | 1514 | |
| 1515 | 1515 | if ( $context instanceof \GV\Template_Context ) { |
| 1516 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1516 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1517 | 1517 | } else { |
| 1518 | 1518 | // @deprecated path |
| 1519 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
| 1519 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | // If the value is empty and we're hiding empty, return empty. |
| 1523 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1523 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1524 | 1524 | return ''; |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1528 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
| 1527 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1528 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | // Get width setting, if exists |
| 1532 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
| 1532 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
| 1533 | 1533 | |
| 1534 | 1534 | // If replacing with CSS inline formatting, let's do it. |
| 1535 | - $placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
| 1535 | + $placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
| 1536 | 1536 | |
| 1537 | 1537 | // Grab the Class using `gv_class` |
| 1538 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
| 1539 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1538 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
| 1539 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1540 | 1540 | |
| 1541 | 1541 | if ( $context instanceof \GV\Template_Context ) { |
| 1542 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' ); |
|
| 1542 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' ); |
|
| 1543 | 1543 | } else { |
| 1544 | 1544 | // Default Label value |
| 1545 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
| 1545 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
| 1549 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
| 1548 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
| 1549 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
| 1550 | 1550 | |
| 1551 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
| 1552 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1551 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
| 1552 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1553 | 1553 | } |
| 1554 | 1554 | |
| 1555 | 1555 | /** |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | * @since 2.0 |
| 1561 | 1561 | * @param \GV\Template_Context $context The context. |
| 1562 | 1562 | */ |
| 1563 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
| 1563 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
| 1564 | 1564 | |
| 1565 | 1565 | /** |
| 1566 | 1566 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | foreach ( $placeholders as $tag => $value ) { |
| 1588 | 1588 | |
| 1589 | 1589 | // If the tag doesn't exist just skip it |
| 1590 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1590 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1591 | 1591 | continue; |
| 1592 | 1592 | } |
| 1593 | 1593 | |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | $value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context ); |
| 1609 | 1609 | |
| 1610 | 1610 | // Finally do the replace |
| 1611 | - $html = str_replace( $search, (string) $value, $html ); |
|
| 1611 | + $html = str_replace( $search, (string)$value, $html ); |
|
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | /** |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | return $no_entries_text; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $no_entries_option = (int) $context->view->settings->get( 'no_entries_options' ); |
|
| 127 | + $no_entries_option = (int)$context->view->settings->get( 'no_entries_options' ); |
|
| 128 | 128 | |
| 129 | 129 | ray( $context->view->settings->get( 'no_entries_options' ), $no_entries_option ); |
| 130 | 130 | |
| 131 | 131 | if ( 1 === $no_entries_option ) { |
| 132 | - $form_id = (int) $context->view->settings->get( 'no_entries_form' ); |
|
| 132 | + $form_id = (int)$context->view->settings->get( 'no_entries_form' ); |
|
| 133 | 133 | |
| 134 | 134 | if ( ! empty( $form_id ) ) { |
| 135 | 135 | |
@@ -290,19 +290,19 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | if ( ! empty( $view_id ) ) { |
| 292 | 292 | |
| 293 | - $this->context_view_id = (int) $view_id; |
|
| 293 | + $this->context_view_id = (int)$view_id; |
|
| 294 | 294 | |
| 295 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
| 295 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
| 296 | 296 | /** |
| 297 | 297 | * used on a has_multiple_views context |
| 298 | 298 | * |
| 299 | 299 | * @see GravityView_API::entry_link |
| 300 | 300 | */ |
| 301 | - $this->context_view_id = (int) $_GET['gvid']; |
|
| 301 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
| 302 | 302 | |
| 303 | 303 | } elseif ( ! $multiple_views ) { |
| 304 | 304 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 305 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
| 305 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
| 306 | 306 | unset( $array_keys ); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -344,16 +344,16 @@ discard block |
||
| 344 | 344 | $_query = wp_parse_args( $query->query ); |
| 345 | 345 | |
| 346 | 346 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 347 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 348 | - unset( $_query['pagename'] ); |
|
| 347 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 348 | + unset( $_query[ 'pagename' ] ); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // this is where will break from core WordPress |
| 352 | 352 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
| 353 | 353 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
| 354 | 354 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
| 355 | - foreach ( (array) $endpoints as $endpoint ) { |
|
| 356 | - $ignore[] = $endpoint[1]; |
|
| 355 | + foreach ( (array)$endpoints as $endpoint ) { |
|
| 356 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 357 | 357 | } |
| 358 | 358 | unset( $endpoints ); |
| 359 | 359 | |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 364 | 364 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 365 | 365 | |
| 366 | - $qv =& $query->query_vars; |
|
| 366 | + $qv = & $query->query_vars; |
|
| 367 | 367 | |
| 368 | 368 | // Prevent redirect when on the single entry endpoint |
| 369 | 369 | if ( self::is_single_entry() ) { |
@@ -372,12 +372,12 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | $query->is_page = true; |
| 374 | 374 | $query->is_home = false; |
| 375 | - $qv['page_id'] = $front_page_id; |
|
| 375 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 376 | 376 | |
| 377 | 377 | // Correct <!--nextpage--> for page_on_front |
| 378 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 379 | - $qv['page'] = $qv['paged']; |
|
| 380 | - unset( $qv['paged'] ); |
|
| 378 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 379 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 380 | + unset( $qv[ 'paged' ] ); |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | $blocks = parse_blocks( $post_content ); |
| 441 | 441 | |
| 442 | 442 | foreach ( $blocks as $block ) { |
| 443 | - if ( empty( $block['attrs']['ref'] ) ) { |
|
| 443 | + if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) { |
|
| 444 | 444 | continue; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - $block_post = get_post( $block['attrs']['ref'] ); |
|
| 447 | + $block_post = get_post( $block[ 'attrs' ][ 'ref' ] ); |
|
| 448 | 448 | |
| 449 | 449 | if ( $block_post ) { |
| 450 | 450 | $post_content .= $block_post->post_content; |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | // Don't modify the title for anything other than the current view/post. |
| 575 | 575 | // This is true for embedded shortcodes and Views. |
| 576 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 576 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 577 | 577 | return $passed_title; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | |
| 648 | 648 | $title = $view->settings->get( 'single_title', $passed_title ); |
| 649 | 649 | |
| 650 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
| 650 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
| 651 | 651 | |
| 652 | 652 | // We are allowing HTML in the fields, so no escaping the output |
| 653 | 653 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -869,9 +869,9 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - if ( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 872 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 873 | 873 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 874 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 874 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 875 | 875 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
| 876 | 876 | } |
| 877 | 877 | } |
@@ -890,19 +890,19 @@ discard block |
||
| 890 | 890 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 891 | 891 | |
| 892 | 892 | /** @since 1.19 */ |
| 893 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 893 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 894 | 894 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
| 895 | 895 | return $search_criteria; |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 898 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 899 | 899 | |
| 900 | - $search_criteria['field_filters'][] = array( |
|
| 900 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 901 | 901 | 'key' => GravityView_Entry_Approval::meta_key, |
| 902 | 902 | 'value' => GravityView_Entry_Approval_Status::APPROVED, |
| 903 | 903 | ); |
| 904 | 904 | |
| 905 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 905 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 906 | 906 | |
| 907 | 907 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
| 908 | 908 | } |
@@ -929,18 +929,18 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | public static function is_entry_approved( $entry, $args = array() ) { |
| 931 | 931 | |
| 932 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 932 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 933 | 933 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 934 | 934 | return true; |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** @since 1.19 */ |
| 938 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 938 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 939 | 939 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
| 940 | 940 | return true; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
| 943 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
| 944 | 944 | |
| 945 | 945 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
| 946 | 946 | } |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
| 965 | 965 | */ |
| 966 | 966 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
| 967 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
| 967 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
| 968 | 968 | |
| 969 | 969 | /** |
| 970 | 970 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -984,19 +984,19 @@ discard block |
||
| 984 | 984 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' => $search_criteria ) ); |
| 985 | 985 | |
| 986 | 986 | // implicity search |
| 987 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 987 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 988 | 988 | |
| 989 | 989 | // Search operator options. Options: `is` or `contains` |
| 990 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 990 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 991 | 991 | |
| 992 | - $search_criteria['field_filters'][] = array( |
|
| 992 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 993 | 993 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
| 994 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 994 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 995 | 995 | 'operator' => $operator, |
| 996 | 996 | ); |
| 997 | 997 | |
| 998 | 998 | // Lock search mode to "all" with implicit presearch filter. |
| 999 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
| 999 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | if ( $search_criteria !== $original_search_criteria ) { |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 1018 | 1018 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 1019 | 1019 | */ |
| 1020 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1020 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1021 | 1021 | |
| 1022 | 1022 | return $search_criteria; |
| 1023 | 1023 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | 'search_criteria' => $search_criteria, |
| 1134 | 1134 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
| 1135 | 1135 | 'paging' => $paging, |
| 1136 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1136 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1137 | 1137 | ); |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1183,17 +1183,17 @@ discard block |
||
| 1183 | 1183 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
| 1184 | 1184 | |
| 1185 | 1185 | // Paging & offset |
| 1186 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
| 1186 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
| 1187 | 1187 | |
| 1188 | 1188 | if ( -1 === $page_size ) { |
| 1189 | 1189 | $page_size = PHP_INT_MAX; |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1192 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1193 | 1193 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1194 | 1194 | |
| 1195 | - if ( ! empty( $args['offset'] ) ) { |
|
| 1196 | - $offset += intval( $args['offset'] ); |
|
| 1195 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
| 1196 | + $offset += intval( $args[ 'offset' ] ); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | $paging = array( |
@@ -1218,11 +1218,11 @@ discard block |
||
| 1218 | 1218 | public static function updateViewSorting( $args, $form_id ) { |
| 1219 | 1219 | $sorting = array(); |
| 1220 | 1220 | |
| 1221 | - $has_values = isset( $_GET['sort'] ); |
|
| 1221 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
| 1222 | 1222 | |
| 1223 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
| 1224 | - $sorts = array_keys( $_GET['sort'] ); |
|
| 1225 | - $dirs = array_values( $_GET['sort'] ); |
|
| 1223 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
| 1224 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
| 1225 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
| 1226 | 1226 | |
| 1227 | 1227 | if ( $has_values = array_filter( $dirs ) ) { |
| 1228 | 1228 | $sort_field_id = end( $sorts ); |
@@ -1231,11 +1231,11 @@ discard block |
||
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | if ( ! isset( $sort_field_id ) ) { |
| 1234 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
| 1234 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | if ( ! isset( $sort_direction ) ) { |
| 1238 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
| 1238 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | if ( is_array( $sort_field_id ) ) { |
@@ -1267,10 +1267,10 @@ discard block |
||
| 1267 | 1267 | $form = GFAPI::get_form( $form_id ); |
| 1268 | 1268 | |
| 1269 | 1269 | // Get the first GF_Field field ID, set as the key for entry randomization |
| 1270 | - if ( ! empty( $form['fields'] ) ) { |
|
| 1270 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
| 1271 | 1271 | |
| 1272 | 1272 | /** @var GF_Field $field */ |
| 1273 | - foreach ( $form['fields'] as $field ) { |
|
| 1273 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 1274 | 1274 | if ( ! is_a( $field, 'GF_Field' ) ) { |
| 1275 | 1275 | continue; |
| 1276 | 1276 | } |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | if ( is_array( $sort_field_id ) ) { |
| 1320 | 1320 | $modified_ids = array(); |
| 1321 | 1321 | foreach ( $sort_field_id as $_sort_field_id ) { |
| 1322 | - $modified_ids [] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
| 1322 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
| 1323 | 1323 | } |
| 1324 | 1324 | return $modified_ids; |
| 1325 | 1325 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | return $sort_field_id; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - switch ( $sort_field['type'] ) { |
|
| 1335 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1336 | 1336 | |
| 1337 | 1337 | case 'address': |
| 1338 | 1338 | // Sorting by full address |
@@ -1459,7 +1459,7 @@ discard block |
||
| 1459 | 1459 | $views = $this->getGvOutputData()->get_views(); |
| 1460 | 1460 | |
| 1461 | 1461 | foreach ( $views as $view_id => $data ) { |
| 1462 | - $view = \GV\View::by_id( $data['id'] ); |
|
| 1462 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
| 1463 | 1463 | $view_id = $view->ID; |
| 1464 | 1464 | $template_id = gravityview_get_template_id( $view->ID ); |
| 1465 | 1465 | $data = $view->as_data(); |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | * @param \GV\View The View. |
| 1490 | 1490 | */ |
| 1491 | 1491 | $js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
| 1492 | - $js_dependencies[] = $js_dependency; |
|
| 1492 | + $js_dependencies[ ] = $js_dependency; |
|
| 1493 | 1493 | |
| 1494 | 1494 | /** |
| 1495 | 1495 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | * @param \GV\View The View. |
| 1506 | 1506 | */ |
| 1507 | 1507 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
| 1508 | - $css_dependencies[] = $css_dependency; |
|
| 1508 | + $css_dependencies[ ] = $css_dependency; |
|
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | /** |
@@ -1514,8 +1514,8 @@ discard block |
||
| 1514 | 1514 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1515 | 1515 | * @since 1.15 |
| 1516 | 1516 | */ |
| 1517 | - if ( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1518 | - $css_dependencies[] = 'dashicons'; |
|
| 1517 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1518 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GV_PLUGIN_VERSION, true ); |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | |
| 1527 | 1527 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1528 | 1528 | |
| 1529 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1529 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1530 | 1530 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GV_PLUGIN_VERSION, 'all' ); |
| 1531 | 1531 | } |
| 1532 | 1532 | |
@@ -1627,7 +1627,7 @@ discard block |
||
| 1627 | 1627 | return $label; |
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1630 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1631 | 1631 | return $label; |
| 1632 | 1632 | } |
| 1633 | 1633 | |
@@ -1635,20 +1635,20 @@ discard block |
||
| 1635 | 1635 | |
| 1636 | 1636 | $class = 'gv-sort'; |
| 1637 | 1637 | |
| 1638 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1638 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1639 | 1639 | |
| 1640 | 1640 | $sort_args = array( |
| 1641 | - 'sort' => $field['id'], |
|
| 1641 | + 'sort' => $field[ 'id' ], |
|
| 1642 | 1642 | 'dir' => 'asc', |
| 1643 | 1643 | ); |
| 1644 | 1644 | |
| 1645 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1645 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1646 | 1646 | // toggle sorting direction. |
| 1647 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1648 | - $sort_args['dir'] = 'desc'; |
|
| 1647 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1648 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1649 | 1649 | $class .= ' gv-icon-sort-desc'; |
| 1650 | 1650 | } else { |
| 1651 | - $sort_args['dir'] = 'asc'; |
|
| 1651 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1652 | 1652 | $class .= ' gv-icon-sort-asc'; |
| 1653 | 1653 | } |
| 1654 | 1654 | } else { |
@@ -1704,7 +1704,7 @@ discard block |
||
| 1704 | 1704 | return false; |
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1707 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1708 | 1708 | |
| 1709 | 1709 | } |
| 1710 | 1710 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $form = false; |
| 147 | 147 | |
| 148 | 148 | if ( $entry ) { |
| 149 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
| 149 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | return $form; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - return (bool) $has_transaction_data; |
|
| 225 | + return (bool)$has_transaction_data; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
| 262 | 262 | |
| 263 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
| 263 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
| 264 | 264 | |
| 265 | 265 | return $result; |
| 266 | 266 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | 295 | foreach ( $forms as $form ) { |
| 296 | - $options[ (int) $form['id'] ] = esc_html( $form['title'] ); |
|
| 296 | + $options[ (int)$form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | return $options; |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | $has_post_fields = false; |
| 353 | 353 | |
| 354 | 354 | if ( $form ) { |
| 355 | - foreach ( $form['fields'] as $field ) { |
|
| 356 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 357 | - $fields[ "{$field['id']}" ] = array( |
|
| 355 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 356 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 357 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
| 358 | 358 | 'label' => \GV\Utils::get( $field, 'label' ), |
| 359 | 359 | 'parent' => null, |
| 360 | 360 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | ); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 367 | - foreach ( $field['inputs'] as $input ) { |
|
| 366 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 367 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 368 | 368 | |
| 369 | - if ( ! empty( $input['isHidden'] ) ) { |
|
| 369 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
| 370 | 370 | continue; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | * @hack |
| 375 | 375 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 376 | 376 | */ |
| 377 | - if ( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
| 377 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 378 | 378 | continue; |
| 379 | 379 | } |
| 380 | - $fields[ "{$input['id']}" ] = array( |
|
| 380 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
| 381 | 381 | 'label' => \GV\Utils::get( $input, 'label' ), |
| 382 | 382 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
| 383 | 383 | 'parent' => $field, |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if ( GFCommon::is_product_field( $field['type'] ) ) { |
|
| 391 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 392 | 392 | $has_product_fields = true; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * @since 1.7 |
| 403 | 403 | */ |
| 404 | 404 | if ( $has_post_fields ) { |
| 405 | - $fields['post_id'] = array( |
|
| 405 | + $fields[ 'post_id' ] = array( |
|
| 406 | 406 | 'label' => __( 'Post ID', 'gk-gravityview' ), |
| 407 | 407 | 'type' => 'post_id', |
| 408 | 408 | ); |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | $fields = array(); |
| 454 | 454 | |
| 455 | 455 | foreach ( $extra_fields as $key => $field ) { |
| 456 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 456 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 457 | 457 | $fields[ $key ] = array( |
| 458 | - 'label' => $field['label'], |
|
| 458 | + 'label' => $field[ 'label' ], |
|
| 459 | 459 | 'type' => 'entry_meta', |
| 460 | 460 | ); |
| 461 | 461 | } |
@@ -497,33 +497,33 @@ discard block |
||
| 497 | 497 | 'search_criteria' => null, |
| 498 | 498 | 'sorting' => null, |
| 499 | 499 | 'paging' => null, |
| 500 | - 'cache' => ( isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true ), |
|
| 500 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
| 501 | 501 | 'context_view_id' => null, |
| 502 | 502 | ); |
| 503 | 503 | |
| 504 | 504 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 505 | 505 | |
| 506 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 507 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 506 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 507 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 508 | 508 | |
| 509 | 509 | if ( ! is_array( $filter ) ) { |
| 510 | 510 | continue; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | // By default, we want searches to be wildcard for each field. |
| 514 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 514 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 515 | 515 | |
| 516 | 516 | /** |
| 517 | 517 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 518 | 518 | * @param string $operator Existing search operator |
| 519 | 519 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 520 | 520 | */ |
| 521 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 521 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | // don't send just the [mode] without any field filter. |
| 525 | - if ( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode', $criteria['search_criteria']['field_filters'] ) ) { |
|
| 526 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 525 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 526 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
@@ -533,37 +533,37 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | foreach ( array( 'start_date', 'end_date' ) as $key ) { |
| 535 | 535 | |
| 536 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 536 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 537 | 537 | |
| 538 | 538 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 539 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 539 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 540 | 540 | |
| 541 | 541 | if ( $date ) { |
| 542 | 542 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 543 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 543 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 544 | 544 | } else { |
| 545 | 545 | gravityview()->log->error( |
| 546 | 546 | '{key} Date format not valid:', |
| 547 | 547 | array( |
| 548 | 548 | 'key' => $key, |
| 549 | - $criteria['search_criteria'][ $key ], |
|
| 549 | + $criteria[ 'search_criteria' ][ $key ], |
|
| 550 | 550 | ) |
| 551 | 551 | ); |
| 552 | 552 | |
| 553 | 553 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 554 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 554 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
| 559 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 560 | 560 | // Calculate the context view id and send it to the advanced filter |
| 561 | 561 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 562 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 562 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 563 | 563 | } elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
| 564 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 564 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 565 | 565 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
| 566 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
| 566 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
@@ -573,9 +573,9 @@ discard block |
||
| 573 | 573 | * @param array $form_ids Forms to search |
| 574 | 574 | * @param int $view_id ID of the view being used to search |
| 575 | 575 | */ |
| 576 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 576 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 577 | 577 | |
| 578 | - return (array) $criteria; |
|
| 578 | + return (array)$criteria; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | /** Reduce # of database calls */ |
| 608 | 608 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 609 | 609 | |
| 610 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 610 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 611 | 611 | |
| 612 | 612 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 613 | 613 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | // Still update the total count when using cached results |
| 617 | 617 | if ( ! is_null( $total ) ) { |
| 618 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 618 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | $return = $entries; |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | // No entries returned from gravityview_before_get_entries |
| 640 | 640 | if ( is_null( $entries ) ) { |
| 641 | 641 | |
| 642 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 642 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 643 | 643 | |
| 644 | 644 | if ( is_wp_error( $entries ) ) { |
| 645 | 645 | gravityview()->log->error( |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 659 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 660 | 660 | |
| 661 | 661 | // Cache results |
| 662 | 662 | $Cache->set( $entries, 'entries' ); |
@@ -842,8 +842,8 @@ discard block |
||
| 842 | 842 | |
| 843 | 843 | // If both are timestamps, cast to string so we can use the > and < comparisons below. |
| 844 | 844 | if ( $timestamp_1 && $timestamp_2 ) { |
| 845 | - $val1 = (string) $timestamp_1; |
|
| 846 | - $val2 = (string) $timestamp_2; |
|
| 845 | + $val1 = (string)$timestamp_1; |
|
| 846 | + $val2 = (string)$timestamp_2; |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | switch ( $operation ) { |
@@ -877,8 +877,8 @@ discard block |
||
| 877 | 877 | if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
| 878 | 878 | |
| 879 | 879 | $json_in = false; |
| 880 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
| 881 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
| 880 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
| 881 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
| 882 | 882 | |
| 883 | 883 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
| 884 | 884 | foreach ( $json_val_1 as $item_1 ) { |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | - if ( empty( $entry['form_id'] ) ) { |
|
| 942 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 943 | 943 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
| 944 | 944 | } |
| 945 | 945 | |
@@ -954,19 +954,19 @@ discard block |
||
| 954 | 954 | |
| 955 | 955 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
| 956 | 956 | |
| 957 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
| 957 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
| 958 | 958 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | $view_form_id = $view->form->ID; |
| 962 | 962 | |
| 963 | 963 | if ( $view->joins ) { |
| 964 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
| 965 | - $view_form_id = $entry['form_id']; |
|
| 964 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
| 965 | + $view_form_id = $entry[ 'form_id' ]; |
|
| 966 | 966 | } |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
| 969 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
| 970 | 970 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
| 971 | 971 | } |
| 972 | 972 | |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | array( |
| 985 | 985 | 'key' => 'id', |
| 986 | 986 | 'operation' => 'is', |
| 987 | - 'value' => $entry['id'], |
|
| 987 | + 'value' => $entry[ 'id' ], |
|
| 988 | 988 | ), |
| 989 | 989 | ), |
| 990 | 990 | ) |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | /** @type \GF_Query $query */ |
| 996 | 996 | $query_parts = $query->_introspect(); |
| 997 | 997 | |
| 998 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
| 998 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
| 999 | 999 | |
| 1000 | 1000 | }, |
| 1001 | 1001 | 10, |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | 'gravityview_search_criteria', |
| 1008 | 1008 | $remove_pagenum = function( $criteria ) { |
| 1009 | 1009 | |
| 1010 | - $criteria['paging'] = array( |
|
| 1010 | + $criteria[ 'paging' ] = array( |
|
| 1011 | 1011 | 'offset' => 0, |
| 1012 | 1012 | 'page_size' => 25, |
| 1013 | 1013 | ); |
@@ -1027,19 +1027,19 @@ discard block |
||
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | // This entry is on a View with joins |
| 1030 | - if ( $entries[0]->is_multi() ) { |
|
| 1030 | + if ( $entries[ 0 ]->is_multi() ) { |
|
| 1031 | 1031 | |
| 1032 | 1032 | $multi_entry_ids = array(); |
| 1033 | 1033 | |
| 1034 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
| 1035 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
| 1034 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
| 1035 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
| 1038 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
| 1039 | 1039 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
| 1040 | 1040 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
| 1041 | 1041 | } |
| 1042 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
| 1042 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
| 1043 | 1043 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
| 1044 | 1044 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
| 1045 | 1045 | } |
@@ -1089,11 +1089,11 @@ discard block |
||
| 1089 | 1089 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 1090 | 1090 | |
| 1091 | 1091 | $format = \GV\Utils::get( $atts, 'format' ); |
| 1092 | - $is_human = ! empty( $atts['human'] ); |
|
| 1093 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 1094 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 1095 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 1096 | - $include_time = ! empty( $atts['time'] ); |
|
| 1092 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 1093 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 1094 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 1095 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 1096 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 1097 | 1097 | |
| 1098 | 1098 | // If we're using time diff, we want to have a different default format |
| 1099 | 1099 | if ( empty( $format ) ) { |
@@ -1211,14 +1211,14 @@ discard block |
||
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | foreach ( $matches as $shortcode ) { |
| 1214 | - if ( $tag === $shortcode[2] ) { |
|
| 1214 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 1215 | 1215 | |
| 1216 | 1216 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 1217 | - $shortcodes[] = $shortcode; |
|
| 1217 | + $shortcodes[ ] = $shortcode; |
|
| 1218 | 1218 | |
| 1219 | - } elseif ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 1219 | + } elseif ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 1220 | 1220 | foreach ( $results as $result ) { |
| 1221 | - $shortcodes[] = $result; |
|
| 1221 | + $shortcodes[ ] = $result; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | 'post_type' => 'gravityview', |
| 1251 | 1251 | 'posts_per_page' => 100, |
| 1252 | 1252 | 'meta_key' => '_gravityview_form_id', |
| 1253 | - 'meta_value' => (int) $form_id, |
|
| 1253 | + 'meta_value' => (int)$form_id, |
|
| 1254 | 1254 | ); |
| 1255 | 1255 | $args = wp_parse_args( $args, $defaults ); |
| 1256 | 1256 | $views = get_posts( $args ); |
@@ -1267,8 +1267,8 @@ discard block |
||
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | foreach ( $data as $datum ) { |
| 1270 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
| 1271 | - $joined_forms[] = $view->post_id; |
|
| 1270 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
| 1271 | + $joined_forms[ ] = $view->post_id; |
|
| 1272 | 1272 | } |
| 1273 | 1273 | } |
| 1274 | 1274 | } |
@@ -1276,10 +1276,10 @@ discard block |
||
| 1276 | 1276 | if ( $joined_forms ) { |
| 1277 | 1277 | $joined_args = array( |
| 1278 | 1278 | 'post_type' => 'gravityview', |
| 1279 | - 'posts_per_page' => $args['posts_per_page'], |
|
| 1279 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
| 1280 | 1280 | 'post__in' => $joined_forms, |
| 1281 | 1281 | ); |
| 1282 | - $views = array_merge( $views, get_posts( $joined_args ) ); |
|
| 1282 | + $views = array_merge( $views, get_posts( $joined_args ) ); |
|
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | return $views; |
@@ -1323,7 +1323,7 @@ discard block |
||
| 1323 | 1323 | |
| 1324 | 1324 | if ( class_exists( '\GV\View_Settings' ) ) { |
| 1325 | 1325 | |
| 1326 | - return wp_parse_args( (array) $settings, \GV\View_Settings::defaults() ); |
|
| 1326 | + return wp_parse_args( (array)$settings, \GV\View_Settings::defaults() ); |
|
| 1327 | 1327 | |
| 1328 | 1328 | } |
| 1329 | 1329 | |
@@ -1469,11 +1469,11 @@ discard block |
||
| 1469 | 1469 | $blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null ); |
| 1470 | 1470 | |
| 1471 | 1471 | foreach ( $fields as $id => $field ) { |
| 1472 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
| 1472 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
| 1473 | 1473 | continue; |
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | - $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field['label'] ) . '</option>'; |
|
| 1476 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1477 | 1477 | } |
| 1478 | 1478 | } |
| 1479 | 1479 | |
@@ -1518,14 +1518,14 @@ discard block |
||
| 1518 | 1518 | // TODO: Convert to using array_filter |
| 1519 | 1519 | foreach ( $fields as $id => $field ) { |
| 1520 | 1520 | |
| 1521 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
| 1521 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
| 1522 | 1522 | unset( $fields[ $id ] ); |
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | 1525 | /** |
| 1526 | 1526 | * Merge date and time subfields. |
| 1527 | 1527 | */ |
| 1528 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
| 1528 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
| 1529 | 1529 | $fields[ intval( $id ) ] = array( |
| 1530 | 1530 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
| 1531 | 1531 | 'parent' => null, |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1600 | 1600 | if ( $gv_field = GravityView_Fields::get( $type ) ) { |
| 1601 | 1601 | if ( true === $gv_field->is_numeric ) { |
| 1602 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1602 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1603 | 1603 | } |
| 1604 | 1604 | } |
| 1605 | 1605 | |
@@ -1751,12 +1751,12 @@ discard block |
||
| 1751 | 1751 | $final_atts = array_filter( $final_atts ); |
| 1752 | 1752 | |
| 1753 | 1753 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1754 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1755 | - $final_atts['href'] = $href; |
|
| 1754 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1755 | + $final_atts[ 'href' ] = $href; |
|
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | - if ( isset( $final_atts['href'] ) ) { |
|
| 1759 | - $final_atts['href'] = esc_url_raw( $final_atts['href'] ); |
|
| 1758 | + if ( isset( $final_atts[ 'href' ] ) ) { |
|
| 1759 | + $final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] ); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | 1762 | /** |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
| 1766 | 1766 | */ |
| 1767 | 1767 | if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
| 1768 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
| 1768 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | // Sort the attributes alphabetically, to help testing |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1805 | 1805 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1806 | 1806 | } elseif ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
| 1807 | - $merged[] = $value; |
|
| 1807 | + $merged[ ] = $value; |
|
| 1808 | 1808 | } else { |
| 1809 | 1809 | $merged[ $key ] = $value; |
| 1810 | 1810 | } |