@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** |
| 244 | 244 | * Add admin script to the no-conflict scripts whitelist |
| 245 | 245 | * @param array $allowed Scripts allowed in no-conflict mode |
| 246 | - * @return array Scripts allowed in no-conflict mode, plus the search widget script |
|
| 246 | + * @return string[] Scripts allowed in no-conflict mode, plus the search widget script |
|
| 247 | 247 | */ |
| 248 | 248 | public function register_no_conflict( $allowed ) { |
| 249 | 249 | $allowed[] = 'gravityview_searchwidget_admin'; |
@@ -709,7 +709,6 @@ discard block |
||
| 709 | 709 | * Dropin for the legacy flat filters when \GF_Query is available. |
| 710 | 710 | * |
| 711 | 711 | * @param \GF_Query $query The current query object reference |
| 712 | - * @param \GV\View $this The current view object |
|
| 713 | 712 | * @param \GV\Request $request The request object |
| 714 | 713 | */ |
| 715 | 714 | public function gf_query_filter( &$query, $view, $request ) { |
@@ -1199,7 +1198,7 @@ discard block |
||
| 1199 | 1198 | /** |
| 1200 | 1199 | * Get the label for a search form field |
| 1201 | 1200 | * @param array $field Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys |
| 1202 | - * @param array $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 1201 | + * @param GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 1203 | 1202 | * @return string Label for the search form |
| 1204 | 1203 | */ |
| 1205 | 1204 | private static function get_field_label( $field, $form_field = array() ) { |
@@ -1364,7 +1363,7 @@ discard block |
||
| 1364 | 1363 | /** |
| 1365 | 1364 | * Require the datepicker script for the frontend GV script |
| 1366 | 1365 | * @param array $js_dependencies Array of existing required scripts for the fe-views.js script |
| 1367 | - * @return array Array required scripts, with `jquery-ui-datepicker` added |
|
| 1366 | + * @return string[] Array required scripts, with `jquery-ui-datepicker` added |
|
| 1368 | 1367 | */ |
| 1369 | 1368 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1370 | 1369 | |
@@ -1376,7 +1375,7 @@ discard block |
||
| 1376 | 1375 | /** |
| 1377 | 1376 | * Modify the array passed to wp_localize_script() |
| 1378 | 1377 | * |
| 1379 | - * @param array $js_localization The data padded to the Javascript file |
|
| 1378 | + * @param array $localizations The data padded to the Javascript file |
|
| 1380 | 1379 | * @param array $view_data View data array with View settings |
| 1381 | 1380 | * |
| 1382 | 1381 | * @return array |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'type' => 'radio', |
| 65 | 65 | 'full_width' => true, |
| 66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 68 | 68 | 'value' => 'any', |
| 69 | 69 | 'class' => 'hide-if-js', |
| 70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
| 88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
| 89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
| 89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
| 90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
| 91 | 91 | |
| 92 | 92 | // ajax - get the searchable fields |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 228 | 228 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 229 | 229 | |
| 230 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
| 230 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
| 231 | 231 | |
| 232 | 232 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 233 | 233 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 250 | 250 | */ |
| 251 | 251 | public function register_no_conflict( $allowed ) { |
| 252 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 252 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 253 | 253 | return $allowed; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -262,24 +262,24 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public static function get_searchable_fields() { |
| 264 | 264 | |
| 265 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 265 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 266 | 266 | exit( '0' ); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $form = ''; |
| 270 | 270 | |
| 271 | 271 | // Fetch the form for the current View |
| 272 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 272 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 273 | 273 | |
| 274 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 274 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 275 | 275 | |
| 276 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 276 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 277 | 277 | |
| 278 | - $form = (int) $_POST['formid']; |
|
| 278 | + $form = (int)$_POST[ 'formid' ]; |
|
| 279 | 279 | |
| 280 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 280 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 281 | 281 | |
| 282 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 282 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 283 | 283 | |
| 284 | 284 | } |
| 285 | 285 | |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | 331 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
| 332 | - $custom_fields['is_approved'] = array( |
|
| 332 | + $custom_fields[ 'is_approved' ] = array( |
|
| 333 | 333 | 'text' => esc_html__( 'Approval Status', 'gravityview' ), |
| 334 | 334 | 'type' => 'multi', |
| 335 | 335 | ); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 339 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 338 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 339 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // Get fields with sub-inputs and no parent |
@@ -358,13 +358,13 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | foreach ( $fields as $id => $field ) { |
| 360 | 360 | |
| 361 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 361 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 362 | 362 | continue; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 365 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 366 | 366 | |
| 367 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 367 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
| 388 | 388 | |
| 389 | 389 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 390 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 390 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 391 | 391 | $input_type = 'boolean'; // on/off checkbox |
| 392 | 392 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 393 | 393 | $input_type = 'multi'; //multiselect |
@@ -431,19 +431,19 @@ discard block |
||
| 431 | 431 | $post_id = 0; |
| 432 | 432 | |
| 433 | 433 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 434 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 435 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 434 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 435 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 436 | 436 | } |
| 437 | 437 | // We're in the WordPress Widget context, and the base View ID should be used |
| 438 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 439 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 438 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 439 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 443 | 443 | |
| 444 | 444 | // Add hidden fields to the search form |
| 445 | 445 | foreach ( $args as $key => $value ) { |
| 446 | - $search_fields[] = array( |
|
| 446 | + $search_fields[ ] = array( |
|
| 447 | 447 | 'name' => $key, |
| 448 | 448 | 'input' => 'hidden', |
| 449 | 449 | 'value' => $value, |
@@ -482,22 +482,22 @@ discard block |
||
| 482 | 482 | /** |
| 483 | 483 | * Include the sidebar Widgets. |
| 484 | 484 | */ |
| 485 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
| 485 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
| 486 | 486 | |
| 487 | 487 | foreach ( $widgets as $widget ) { |
| 488 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
| 489 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
| 488 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
| 489 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
| 490 | 490 | foreach ( $_fields as $field ) { |
| 491 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 491 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
| 498 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 498 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 499 | 499 | foreach ( $_fields as $field ) { |
| 500 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 500 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | } |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - if( 'post' === $this->search_method ) { |
|
| 530 | + if ( 'post' === $this->search_method ) { |
|
| 531 | 531 | $get = $_POST; |
| 532 | 532 | } else { |
| 533 | 533 | $get = $_GET; |
@@ -546,14 +546,14 @@ discard block |
||
| 546 | 546 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 547 | 547 | |
| 548 | 548 | // Make sure array key is set up |
| 549 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 549 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 550 | 550 | |
| 551 | 551 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
| 552 | 552 | |
| 553 | 553 | // add free search |
| 554 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 554 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 555 | 555 | |
| 556 | - $search_all_value = trim( $get['gv_search'] ); |
|
| 556 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
| 557 | 557 | |
| 558 | 558 | /** |
| 559 | 559 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | foreach ( $words as $word ) { |
| 581 | - $search_criteria['field_filters'][] = array( |
|
| 581 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 582 | 582 | 'key' => null, // The field ID to search |
| 583 | 583 | 'value' => $word, // The value to search |
| 584 | 584 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -591,14 +591,14 @@ discard block |
||
| 591 | 591 | /** |
| 592 | 592 | * Get and normalize the dates according to the input format. |
| 593 | 593 | */ |
| 594 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
| 595 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 594 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
| 595 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 596 | 596 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
| 601 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 600 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
| 601 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 602 | 602 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
| 603 | 603 | } |
| 604 | 604 | } |
@@ -633,22 +633,22 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | if ( ! empty( $curr_start ) ) { |
| 635 | 635 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
| 636 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 636 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if ( ! empty( $curr_end ) ) { |
| 640 | 640 | // Fast-forward 24 hour on the end time |
| 641 | 641 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
| 642 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 643 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 644 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
| 642 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 643 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 644 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | // search for a specific entry ID |
| 650 | 650 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
| 651 | - $search_criteria['field_filters'][] = array( |
|
| 651 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 652 | 652 | 'key' => 'id', |
| 653 | 653 | 'value' => absint( $get[ 'gv_id' ] ), |
| 654 | 654 | 'operator' => '=', |
@@ -657,41 +657,41 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | // search for a specific Created_by ID |
| 659 | 659 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
| 660 | - $search_criteria['field_filters'][] = array( |
|
| 660 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 661 | 661 | 'key' => 'created_by', |
| 662 | - 'value' => $get['gv_by'], |
|
| 662 | + 'value' => $get[ 'gv_by' ], |
|
| 663 | 663 | 'operator' => '=', |
| 664 | 664 | ); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // Get search mode passed in URL |
| 668 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 668 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 669 | 669 | |
| 670 | 670 | // get the other search filters |
| 671 | 671 | foreach ( $get as $key => $value ) { |
| 672 | 672 | |
| 673 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
| 673 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
| 674 | 674 | continue; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
| 678 | 678 | |
| 679 | 679 | // could return simple filter or multiple filters |
| 680 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
| 680 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
| 681 | 681 | continue; |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
| 685 | 685 | |
| 686 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 687 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 686 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 687 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 688 | 688 | |
| 689 | 689 | // if date range type, set search mode to ALL |
| 690 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 690 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 691 | 691 | $mode = 'all'; |
| 692 | 692 | } |
| 693 | - } elseif( !empty( $filter ) ) { |
|
| 694 | - $search_criteria['field_filters'][] = $filter; |
|
| 693 | + } elseif ( ! empty( $filter ) ) { |
|
| 694 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 695 | 695 | } |
| 696 | 696 | } |
| 697 | 697 | |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | * @since 1.5.1 |
| 701 | 701 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 702 | 702 | */ |
| 703 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 703 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 704 | 704 | |
| 705 | 705 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
| 706 | 706 | |
@@ -725,16 +725,16 @@ discard block |
||
| 725 | 725 | */ |
| 726 | 726 | $search_criteria = $this->filter_entries( array(), null, array( 'id' => $view->ID ), true /** force search_criteria */ ); |
| 727 | 727 | |
| 728 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
| 728 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
| 729 | 729 | return; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | $widgets = $view->widgets->by_id( $this->widget_id ); |
| 733 | 733 | if ( $widgets->count() ) { |
| 734 | 734 | $widgets = $widgets->all(); |
| 735 | - $widget = $widgets[0]; |
|
| 735 | + $widget = $widgets[ 0 ]; |
|
| 736 | 736 | foreach ( $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) as $search_field ) { |
| 737 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
| 737 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
| 738 | 738 | $created_by_text_mode = true; |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -742,19 +742,19 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | $extra_conditions = array(); |
| 744 | 744 | |
| 745 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
| 745 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
| 746 | 746 | if ( ! is_array( $filter ) ) { |
| 747 | 747 | continue; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // Construct a manual query for unapproved statuses |
| 751 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'], true ) ) { |
|
| 752 | - $_tmp_query = new GF_Query( $view->form->ID, array( |
|
| 751 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ], true ) ) { |
|
| 752 | + $_tmp_query = new GF_Query( $view->form->ID, array( |
|
| 753 | 753 | 'field_filters' => array( |
| 754 | 754 | array( |
| 755 | 755 | 'operator' => 'in', |
| 756 | 756 | 'key' => 'is_approved', |
| 757 | - 'value' => $filter['value'], |
|
| 757 | + 'value' => $filter[ 'value' ], |
|
| 758 | 758 | ), |
| 759 | 759 | array( |
| 760 | 760 | 'operator' => 'is', |
@@ -766,25 +766,25 @@ discard block |
||
| 766 | 766 | ) ); |
| 767 | 767 | $_tmp_query_parts = $_tmp_query->_introspect(); |
| 768 | 768 | |
| 769 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
| 769 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
| 770 | 770 | |
| 771 | 771 | $filter = false; |
| 772 | 772 | continue; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | // Construct manual query for text mode creator search |
| 776 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
| 777 | - $extra_conditions[] = new GravityView_Widget_Search_GF_Query_Condition( $filter, $view ); |
|
| 776 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
| 777 | + $extra_conditions[ ] = new GravityView_Widget_Search_GF_Query_Condition( $filter, $view ); |
|
| 778 | 778 | $filter = false; |
| 779 | 779 | continue; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | // By default, we want searches to be wildcard for each field. |
| 783 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 783 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 784 | 784 | |
| 785 | 785 | // For multichoice, let's have an in (OR) search. |
| 786 | - if ( is_array( $filter['value'] ) ) { |
|
| 787 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
| 786 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
| 787 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | /** |
@@ -792,10 +792,10 @@ discard block |
||
| 792 | 792 | * @param string $operator Existing search operator |
| 793 | 793 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 794 | 794 | */ |
| 795 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 795 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - $search_criteria['field_filters'] = array_filter( $search_criteria['field_filters'] ); |
|
| 798 | + $search_criteria[ 'field_filters' ] = array_filter( $search_criteria[ 'field_filters' ] ); |
|
| 799 | 799 | |
| 800 | 800 | /** |
| 801 | 801 | * Parse the filter criteria to generate the needed |
@@ -808,12 +808,12 @@ discard block |
||
| 808 | 808 | /** |
| 809 | 809 | * Grab the current clauses. We'll be combining them shortly. |
| 810 | 810 | */ |
| 811 | - $query_parts = $query->_introspect(); |
|
| 811 | + $query_parts = $query->_introspect(); |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | 814 | * Combine the parts as a new WHERE clause. |
| 815 | 815 | */ |
| 816 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'], $_tmp_query_parts['where'] ), $extra_conditions ) ); |
|
| 816 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ], $_tmp_query_parts[ 'where' ] ), $extra_conditions ) ); |
|
| 817 | 817 | $query->where( $where ); |
| 818 | 818 | } |
| 819 | 819 | |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $field_id = str_replace( 'filter_', '', $key ); |
| 837 | 837 | |
| 838 | 838 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 839 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 839 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 840 | 840 | $field_id = str_replace( '_', '.', $field_id ); |
| 841 | 841 | } |
| 842 | 842 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | case 'select': |
| 873 | 873 | case 'radio': |
| 874 | - $filter['operator'] = 'is'; |
|
| 874 | + $filter[ 'operator' ] = 'is'; |
|
| 875 | 875 | break; |
| 876 | 876 | |
| 877 | 877 | case 'post_category': |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | foreach ( $value as $val ) { |
| 887 | 887 | $cat = get_term( $val, 'category' ); |
| 888 | - $filter[] = array( |
|
| 888 | + $filter[ ] = array( |
|
| 889 | 889 | 'key' => $filter_key, |
| 890 | 890 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 891 | 891 | 'operator' => 'is', |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | $filter = array(); |
| 905 | 905 | |
| 906 | 906 | foreach ( $value as $val ) { |
| 907 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 907 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | break; |
@@ -913,9 +913,9 @@ discard block |
||
| 913 | 913 | // convert checkbox on/off into the correct search filter |
| 914 | 914 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
| 915 | 915 | foreach ( $form_field->inputs as $k => $input ) { |
| 916 | - if ( $input['id'] == $filter_key ) { |
|
| 917 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
| 918 | - $filter['operator'] = 'is'; |
|
| 916 | + if ( $input[ 'id' ] == $filter_key ) { |
|
| 917 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
| 918 | + $filter[ 'operator' ] = 'is'; |
|
| 919 | 919 | break; |
| 920 | 920 | } |
| 921 | 921 | } |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | $filter = array(); |
| 926 | 926 | |
| 927 | 927 | foreach ( $value as $val ) { |
| 928 | - $filter[] = array( |
|
| 928 | + $filter[ ] = array( |
|
| 929 | 929 | 'key' => $filter_key, |
| 930 | 930 | 'value' => $val, |
| 931 | 931 | 'operator' => 'is', |
@@ -946,9 +946,9 @@ discard block |
||
| 946 | 946 | foreach ( $words as $word ) { |
| 947 | 947 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 948 | 948 | // Keep the same key for each filter |
| 949 | - $filter['value'] = $word; |
|
| 949 | + $filter[ 'value' ] = $word; |
|
| 950 | 950 | // Add a search for the value |
| 951 | - $filters[] = $filter; |
|
| 951 | + $filters[ ] = $filter; |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
@@ -962,19 +962,19 @@ discard block |
||
| 962 | 962 | |
| 963 | 963 | foreach ( $searchable_fields as $searchable_field ) { |
| 964 | 964 | |
| 965 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
| 965 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
| 966 | 966 | continue; |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | // Only exact-match dropdowns, not text search |
| 970 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
| 970 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
| 971 | 971 | continue; |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
| 975 | 975 | |
| 976 | 976 | if ( 4 === $input_id ) { |
| 977 | - $filter['operator'] = 'is'; |
|
| 977 | + $filter[ 'operator' ] = 'is'; |
|
| 978 | 978 | }; |
| 979 | 979 | } |
| 980 | 980 | } |
@@ -1001,12 +1001,12 @@ discard block |
||
| 1001 | 1001 | * @since 1.16.3 |
| 1002 | 1002 | * Safeguard until GF implements '<=' operator |
| 1003 | 1003 | */ |
| 1004 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 1004 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 1005 | 1005 | $operator = '<'; |
| 1006 | 1006 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - $filter[] = array( |
|
| 1009 | + $filter[ ] = array( |
|
| 1010 | 1010 | 'key' => $filter_key, |
| 1011 | 1011 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
| 1012 | 1012 | 'operator' => $operator, |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | } |
| 1015 | 1015 | } else { |
| 1016 | 1016 | $date = $value; |
| 1017 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 1017 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | break; |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | 'ymd_dot' => 'Y.m.d', |
| 1046 | 1046 | ); |
| 1047 | 1047 | |
| 1048 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 1048 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 1049 | 1049 | $format = $datepicker[ $field->dateFormat ]; |
| 1050 | 1050 | } |
| 1051 | 1051 | |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | public function add_template_path( $file_paths ) { |
| 1083 | 1083 | |
| 1084 | 1084 | // Index 100 is the default GravityView template path. |
| 1085 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 1085 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 1086 | 1086 | |
| 1087 | 1087 | return $file_paths; |
| 1088 | 1088 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | $has_date = false; |
| 1102 | 1102 | |
| 1103 | 1103 | foreach ( $search_fields as $k => $field ) { |
| 1104 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1104 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1105 | 1105 | $has_date = true; |
| 1106 | 1106 | break; |
| 1107 | 1107 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | // get configured search fields |
| 1131 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 1131 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 1132 | 1132 | |
| 1133 | 1133 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 1134 | 1134 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1143,40 +1143,40 @@ discard block |
||
| 1143 | 1143 | |
| 1144 | 1144 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 1145 | 1145 | |
| 1146 | - switch ( $field['field'] ) { |
|
| 1146 | + switch ( $field[ 'field' ] ) { |
|
| 1147 | 1147 | |
| 1148 | 1148 | case 'search_all': |
| 1149 | - $updated_field['key'] = 'search_all'; |
|
| 1150 | - $updated_field['input'] = 'search_all'; |
|
| 1151 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1149 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 1150 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 1151 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1152 | 1152 | break; |
| 1153 | 1153 | |
| 1154 | 1154 | case 'entry_date': |
| 1155 | - $updated_field['key'] = 'entry_date'; |
|
| 1156 | - $updated_field['input'] = 'entry_date'; |
|
| 1157 | - $updated_field['value'] = array( |
|
| 1155 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 1156 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 1157 | + $updated_field[ 'value' ] = array( |
|
| 1158 | 1158 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 1159 | 1159 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 1160 | 1160 | ); |
| 1161 | 1161 | break; |
| 1162 | 1162 | |
| 1163 | 1163 | case 'entry_id': |
| 1164 | - $updated_field['key'] = 'entry_id'; |
|
| 1165 | - $updated_field['input'] = 'entry_id'; |
|
| 1166 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1164 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 1165 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 1166 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1167 | 1167 | break; |
| 1168 | 1168 | |
| 1169 | 1169 | case 'created_by': |
| 1170 | - $updated_field['key'] = 'created_by'; |
|
| 1171 | - $updated_field['name'] = 'gv_by'; |
|
| 1172 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1173 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 1170 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 1171 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 1172 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1173 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 1174 | 1174 | break; |
| 1175 | 1175 | |
| 1176 | 1176 | case 'is_approved': |
| 1177 | - $updated_field['key'] = 'is_approved'; |
|
| 1178 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1179 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
| 1177 | + $updated_field[ 'key' ] = 'is_approved'; |
|
| 1178 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1179 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
| 1180 | 1180 | break; |
| 1181 | 1181 | } |
| 1182 | 1182 | |
@@ -1195,16 +1195,16 @@ discard block |
||
| 1195 | 1195 | */ |
| 1196 | 1196 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
| 1197 | 1197 | |
| 1198 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 1198 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 1199 | 1199 | |
| 1200 | 1200 | /** @since 1.14 */ |
| 1201 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 1201 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 1202 | 1202 | |
| 1203 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 1203 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 1204 | 1204 | |
| 1205 | 1205 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 1206 | 1206 | |
| 1207 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 1207 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 1208 | 1208 | |
| 1209 | 1209 | if ( $this->has_date_field( $search_fields ) ) { |
| 1210 | 1210 | // enqueue datepicker stuff only if needed! |
@@ -1226,10 +1226,10 @@ discard block |
||
| 1226 | 1226 | public static function get_search_class( $custom_class = '' ) { |
| 1227 | 1227 | $gravityview_view = GravityView_View::getInstance(); |
| 1228 | 1228 | |
| 1229 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 1229 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 1230 | 1230 | |
| 1231 | - if ( ! empty( $custom_class ) ) { |
|
| 1232 | - $search_class .= ' '.$custom_class; |
|
| 1231 | + if ( ! empty( $custom_class ) ) { |
|
| 1232 | + $search_class .= ' ' . $custom_class; |
|
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | 1235 | /** |
@@ -1273,9 +1273,9 @@ discard block |
||
| 1273 | 1273 | |
| 1274 | 1274 | if ( ! $label ) { |
| 1275 | 1275 | |
| 1276 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 1276 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 1277 | 1277 | |
| 1278 | - switch( $field['field'] ) { |
|
| 1278 | + switch ( $field[ 'field' ] ) { |
|
| 1279 | 1279 | case 'search_all': |
| 1280 | 1280 | $label = __( 'Search Entries:', 'gravityview' ); |
| 1281 | 1281 | break; |
@@ -1287,10 +1287,10 @@ discard block |
||
| 1287 | 1287 | break; |
| 1288 | 1288 | default: |
| 1289 | 1289 | // If this is a field input, not a field |
| 1290 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 1290 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 1291 | 1291 | |
| 1292 | 1292 | // Get the label for the field in question, which returns an array |
| 1293 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 1293 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 1294 | 1294 | |
| 1295 | 1295 | // Get the item with the `label` key |
| 1296 | 1296 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1329,32 +1329,32 @@ discard block |
||
| 1329 | 1329 | $form = $gravityview_view->getForm(); |
| 1330 | 1330 | |
| 1331 | 1331 | // for advanced field ids (eg, first name / last name ) |
| 1332 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1332 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1333 | 1333 | |
| 1334 | 1334 | // get searched value from $_GET/$_POST (string or array) |
| 1335 | 1335 | $value = $this->rgget_or_rgpost( $name ); |
| 1336 | 1336 | |
| 1337 | 1337 | // get form field details |
| 1338 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1338 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1339 | 1339 | |
| 1340 | 1340 | $filter = array( |
| 1341 | - 'key' => $field['field'], |
|
| 1341 | + 'key' => $field[ 'field' ], |
|
| 1342 | 1342 | 'name' => $name, |
| 1343 | 1343 | 'label' => self::get_field_label( $field, $form_field ), |
| 1344 | - 'input' => $field['input'], |
|
| 1344 | + 'input' => $field[ 'input' ], |
|
| 1345 | 1345 | 'value' => $value, |
| 1346 | - 'type' => $form_field['type'], |
|
| 1346 | + 'type' => $form_field[ 'type' ], |
|
| 1347 | 1347 | ); |
| 1348 | 1348 | |
| 1349 | 1349 | // collect choices |
| 1350 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1351 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1352 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1353 | - $filter['choices'] = $form_field['choices']; |
|
| 1350 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1351 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1352 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1353 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1357 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1356 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1357 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 1360 | return $filter; |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | |
| 1379 | 1379 | $choices = array(); |
| 1380 | 1380 | foreach ( $users as $user ) { |
| 1381 | - $choices[] = array( |
|
| 1381 | + $choices[ ] = array( |
|
| 1382 | 1382 | 'value' => $user->ID, |
| 1383 | 1383 | 'text' => $user->display_name, |
| 1384 | 1384 | ); |
@@ -1398,9 +1398,9 @@ discard block |
||
| 1398 | 1398 | |
| 1399 | 1399 | $choices = array(); |
| 1400 | 1400 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
| 1401 | - $choices[] = array( |
|
| 1402 | - 'value' => $status['value'], |
|
| 1403 | - 'text' => $status['label'], |
|
| 1401 | + $choices[ ] = array( |
|
| 1402 | + 'value' => $status[ 'value' ], |
|
| 1403 | + 'text' => $status[ 'label' ], |
|
| 1404 | 1404 | ); |
| 1405 | 1405 | } |
| 1406 | 1406 | |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | */ |
| 1453 | 1453 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1454 | 1454 | |
| 1455 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1455 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1456 | 1456 | |
| 1457 | 1457 | return $js_dependencies; |
| 1458 | 1458 | } |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | 'isRTL' => is_rtl(), |
| 1497 | 1497 | ), $view_data ); |
| 1498 | 1498 | |
| 1499 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1499 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1500 | 1500 | |
| 1501 | 1501 | return $localizations; |
| 1502 | 1502 | |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | * @return void |
| 1524 | 1524 | */ |
| 1525 | 1525 | private function maybe_enqueue_flexibility() { |
| 1526 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1526 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1527 | 1527 | wp_enqueue_script( 'gv-flexibility' ); |
| 1528 | 1528 | } |
| 1529 | 1529 | } |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1546 | 1546 | |
| 1547 | 1547 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1548 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1548 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1549 | 1549 | |
| 1550 | 1550 | /** |
| 1551 | 1551 | * @filter `gravityview_search_datepicker_class` |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | */ |
| 1629 | 1629 | class GravityView_Widget_Search_GF_Query_Condition extends \GF_Query_Condition { |
| 1630 | 1630 | public function __construct( $filter, $view ) { |
| 1631 | - $this->value = $filter['value']; |
|
| 1631 | + $this->value = $filter[ 'value' ]; |
|
| 1632 | 1632 | $this->view = $view; |
| 1633 | 1633 | } |
| 1634 | 1634 | |
@@ -1662,11 +1662,11 @@ discard block |
||
| 1662 | 1662 | $conditions = array(); |
| 1663 | 1663 | |
| 1664 | 1664 | foreach ( $user_fields as $user_field ) { |
| 1665 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1665 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | foreach ( $user_meta_fields as $meta_field ) { |
| 1669 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1669 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Try subkeys after split. |
| 92 | 92 | */ |
| 93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
| 94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
| 94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function gf_query_debug( $query ) { |
| 146 | 146 | $introspect = $query->_introspect(); |
| 147 | 147 | return array( |
| 148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
| 148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | $KWS_GF_Change_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
| 30 | 30 | |
| 31 | 31 | // Now, no validation is required in the methods; let's hook in. |
| 32 | - remove_action('admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
| 32 | + remove_action( 'admin_init', array( $KWS_GF_Change_Lead_Creator, 'set_screen_mode' ) ); |
|
| 33 | 33 | |
| 34 | - remove_action("gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
| 34 | + remove_action( "gform_entry_info", array( $KWS_GF_Change_Lead_Creator, 'add_select' ), 10 ); |
|
| 35 | 35 | |
| 36 | - remove_action("gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 36 | + remove_action( "gform_after_update_entry", array( $KWS_GF_Change_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -10,17 +10,17 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @since 1.5.1 |
| 12 | 12 | */ |
| 13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
| 13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
| 14 | 14 | |
| 15 | 15 | // ONLY ADMIN FROM HERE ON. |
| 16 | - if( !is_admin() ) { return; } |
|
| 16 | + if ( ! is_admin() ) { return; } |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
| 20 | 20 | * @since 1.7.4 |
| 21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
| 22 | 22 | */ |
| 23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
| 23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * Use `init` to fix bbPress warning |
| 29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
| 30 | 30 | */ |
| 31 | - add_action('init', array( $this, 'load'), 100 ); |
|
| 31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
| 32 | 32 | |
| 33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
| 33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -56,20 +56,20 @@ discard block |
||
| 56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
| 57 | 57 | |
| 58 | 58 | // If filter returns false, do not process |
| 59 | - if( empty( $assign_to_lead ) ) { |
|
| 59 | + if ( empty( $assign_to_lead ) ) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
| 64 | - $result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true ); |
|
| 64 | + $result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true ); |
|
| 65 | 65 | |
| 66 | 66 | if ( false === $result ) { |
| 67 | - $status = __('Error', 'gravityview'); |
|
| 67 | + $status = __( 'Error', 'gravityview' ); |
|
| 68 | 68 | global $wpdb; |
| 69 | 69 | $note = sprintf( '%s: Failed to assign User ID #%d as the entry creator (Last database error: "%s")', $status, $user_id, $wpdb->last_error ); |
| 70 | 70 | } else { |
| 71 | - $status = __('Success', 'gravityview'); |
|
| 72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
| 71 | + $status = __( 'Success', 'gravityview' ); |
|
| 72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | gravityview()->log->debug( 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - {note}', array( 'note' => $note ) ); |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | * @since 1.21.5 |
| 80 | 80 | * @param boolean $disable Disable the Change Entry Creator note. Default: false. |
| 81 | 81 | */ |
| 82 | - if( apply_filters('gravityview_disable_change_entry_creator_note', false ) ) { |
|
| 82 | + if ( apply_filters( 'gravityview_disable_change_entry_creator_note', false ) ) { |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
| 86 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | // Plugin that was provided here: |
| 97 | 97 | // @link https://gravityview.co/support/documentation/201991205/ |
| 98 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
| 99 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
| 98 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
| 99 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,26 +107,26 @@ discard block |
||
| 107 | 107 | function load() { |
| 108 | 108 | |
| 109 | 109 | // Does GF exist? |
| 110 | - if( !class_exists('GFCommon') ) { |
|
| 110 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Can the user edit entries? |
| 115 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 115 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 116 | 116 | return; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // If screen mode isn't set, then we're in the wrong place. |
| 120 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
| 120 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Now, no validation is required in the methods; let's hook in. |
| 125 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 125 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 126 | 126 | |
| 127 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
| 127 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
| 128 | 128 | |
| 129 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
| 129 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | function set_screen_mode() { |
| 138 | 138 | |
| 139 | 139 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
| 140 | - if( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
|
| 141 | - $_POST["screen_mode"] = 'edit'; |
|
| 140 | + if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
|
| 141 | + $_POST[ "screen_mode" ] = 'edit'; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | } |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | * @param int $entry_id Entry ID |
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | - function update_entry_creator($form, $entry_id) { |
|
| 152 | + function update_entry_creator( $form, $entry_id ) { |
|
| 153 | 153 | global $current_user; |
| 154 | 154 | |
| 155 | 155 | // Update the entry |
| 156 | - $created_by = absint( \GV\Utils::_POST( 'created_by') ); |
|
| 156 | + $created_by = absint( \GV\Utils::_POST( 'created_by' ) ); |
|
| 157 | 157 | |
| 158 | 158 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
| 159 | 159 | |
@@ -161,30 +161,30 @@ discard block |
||
| 161 | 161 | $originally_created_by = \GV\Utils::_POST( 'originally_created_by' ); |
| 162 | 162 | |
| 163 | 163 | // If there's no owner and there didn't used to be, keep going |
| 164 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 164 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // If the values have changed |
| 169 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 169 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 170 | 170 | |
| 171 | - $user_data = get_userdata($current_user->ID); |
|
| 171 | + $user_data = get_userdata( $current_user->ID ); |
|
| 172 | 172 | |
| 173 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
| 173 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
| 174 | 174 | |
| 175 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
| 175 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
| 176 | 176 | |
| 177 | - if( !empty( $originally_created_by ) ) { |
|
| 178 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
| 177 | + if ( ! empty( $originally_created_by ) ) { |
|
| 178 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
| 179 | 179 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if( !empty( $created_by ) ) { |
|
| 183 | - $created_by_user_data = get_userdata($created_by); |
|
| 182 | + if ( ! empty( $created_by ) ) { |
|
| 183 | + $created_by_user_data = get_userdata( $created_by ); |
|
| 184 | 184 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
| 187 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | } |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | * @param array $entry GF entry array |
| 196 | 196 | * @return void |
| 197 | 197 | */ |
| 198 | - function add_select($form_id, $entry ) { |
|
| 198 | + function add_select( $form_id, $entry ) { |
|
| 199 | 199 | |
| 200 | - if( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) { |
|
| 200 | + if ( \GV\Utils::_POST( 'screen_mode' ) !== 'edit' ) { |
|
| 201 | 201 | return; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -216,23 +216,23 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | $output = '<label for="change_created_by">'; |
| 219 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
| 219 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
| 220 | 220 | $output .= '</label>'; |
| 221 | 221 | |
| 222 | 222 | // If there are users who are not being shown, show a warning. |
| 223 | 223 | // TODO: Use AJAX instead of <select> |
| 224 | 224 | $count_users = count_users(); |
| 225 | - if( sizeof( $users ) < $count_users['total_users'] ) { |
|
| 225 | + if ( sizeof( $users ) < $count_users[ 'total_users' ] ) { |
|
| 226 | 226 | $output .= '<p><i class="dashicons dashicons-warning"></i> ' . sprintf( esc_html__( 'The displayed list of users has been trimmed due to the large number of users. %sLearn how to remove this limit%s.', 'gravityview' ), '<a href="https://docs.gravityview.co/article/251-i-only-see-some-users-in-the-change-entry-creator-dropdown" rel="external">', '</a>' ) . '</p>'; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $output .= '<select name="created_by" id="change_created_by" class="widefat">'; |
| 230 | - $output .= '<option value="' . selected( $entry['created_by'], '0', false ) . '"> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
| 231 | - foreach($users as $user) { |
|
| 232 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
| 230 | + $output .= '<option value="' . selected( $entry[ 'created_by' ], '0', false ) . '"> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
| 231 | + foreach ( $users as $user ) { |
|
| 232 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
| 233 | 233 | } |
| 234 | 234 | $output .= '</select>'; |
| 235 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
| 235 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
| 236 | 236 | |
| 237 | 237 | unset( $is_created_by_in_users, $created_by_user, $users, $created_by_id, $count_users ); |
| 238 | 238 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $supports = array( 'title', 'revisions' ); |
| 109 | 109 | |
| 110 | 110 | if ( $is_hierarchical ) { |
| 111 | - $supports[] = 'page-attributes'; |
|
| 111 | + $supports[ ] = 'page-attributes'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | $rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' ); |
| 211 | 211 | |
| 212 | 212 | add_filter( 'query_vars', function( $query_vars ) { |
| 213 | - $query_vars[] = 'csv'; |
|
| 213 | + $query_vars[ ] = 'csv'; |
|
| 214 | 214 | return $query_vars; |
| 215 | 215 | } ); |
| 216 | 216 | |
| 217 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) { |
|
| 217 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) { |
|
| 218 | 218 | call_user_func_array( 'add_rewrite_rule', $rule ); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | return $content; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 286 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | 289 | * Editing a single entry. |
| 290 | 290 | */ |
| 291 | 291 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
| 292 | - if ( $entry['status'] != 'active' ) { |
|
| 292 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 293 | 293 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 294 | 294 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 303 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 303 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 304 | 304 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 305 | 305 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 306 | 306 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * Viewing a single entry. |
| 314 | 314 | */ |
| 315 | 315 | } else if ( $entry = $request->is_entry( $view->form ? $view->form->ID : 0 ) ) { |
| 316 | - if ( $entry['status'] != 'active' ) { |
|
| 316 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 317 | 317 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 318 | 318 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 319 | 319 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 327 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 327 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 328 | 328 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 329 | 329 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 330 | 330 | } |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column ); |
| 499 | 499 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column ); |
| 500 | 500 | |
| 501 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 501 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | return $joins; |
@@ -540,10 +540,10 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | list( $join, $join_column, $join_on, $join_on_column ) = $meta; |
| 542 | 542 | |
| 543 | - $forms_ids [] = GF_Form::by_id( $join_on ); |
|
| 543 | + $forms_ids [ ] = GF_Form::by_id( $join_on ); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - return ( !empty( $forms_ids) ) ? $forms_ids : null; |
|
| 546 | + return ( ! empty( $forms_ids ) ) ? $forms_ids : null; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | if ( ! $view->form ) { |
| 582 | 582 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
| 583 | 583 | 'view_id' => $view->ID, |
| 584 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
| 584 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
| 585 | 585 | ) ); |
| 586 | 586 | } |
| 587 | 587 | |
@@ -814,34 +814,33 @@ discard block |
||
| 814 | 814 | * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead |
| 815 | 815 | */ |
| 816 | 816 | $parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID ); |
| 817 | - $parameters['context_view_id'] = $this->ID; |
|
| 817 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
| 818 | 818 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
| 819 | 819 | |
| 820 | 820 | if ( $request instanceof REST\Request ) { |
| 821 | 821 | $atts = $this->settings->as_atts(); |
| 822 | 822 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
| 823 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
| 823 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
| 824 | 824 | ) ); |
| 825 | - $parameters['paging'] = $paging_parameters['paging']; |
|
| 825 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
| 829 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
| 828 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
| 830 | 829 | |
| 831 | 830 | /** |
| 832 | 831 | * Cleanup duplicate field_filter parameters to simplify the query. |
| 833 | 832 | */ |
| 834 | 833 | $unique_field_filters = array(); |
| 835 | - foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) { |
|
| 834 | + foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) { |
|
| 836 | 835 | if ( 'mode' === $key ) { |
| 837 | - $unique_field_filters['mode'] = $filter; |
|
| 836 | + $unique_field_filters[ 'mode' ] = $filter; |
|
| 838 | 837 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
| 839 | - $unique_field_filters[] = $filter; |
|
| 838 | + $unique_field_filters[ ] = $filter; |
|
| 840 | 839 | } |
| 841 | 840 | } |
| 842 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
| 841 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
| 843 | 842 | |
| 844 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
| 843 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 845 | 844 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
| 846 | 845 | } |
| 847 | 846 | |
@@ -849,10 +848,10 @@ discard block |
||
| 849 | 848 | /** |
| 850 | 849 | * New \GF_Query stuff :) |
| 851 | 850 | */ |
| 852 | - $query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] ); |
|
| 851 | + $query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] ); |
|
| 853 | 852 | |
| 854 | - $query->limit( $parameters['paging']['page_size'] ) |
|
| 855 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
| 853 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 854 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
| 856 | 855 | |
| 857 | 856 | /** |
| 858 | 857 | * Any joins? |
@@ -894,15 +893,15 @@ discard block |
||
| 894 | 893 | } ); |
| 895 | 894 | } else { |
| 896 | 895 | $entries = $this->form->entries |
| 897 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
| 896 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
| 898 | 897 | ->offset( $this->settings->get( 'offset' ) ) |
| 899 | - ->limit( $parameters['paging']['page_size'] ) |
|
| 898 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 900 | 899 | ->page( $page ); |
| 901 | 900 | |
| 902 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
| 901 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
| 903 | 902 | $field = new \GV\Field(); |
| 904 | - $field->ID = $parameters['sorting']['key']; |
|
| 905 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 903 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
| 904 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 906 | 905 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
| 907 | 906 | } |
| 908 | 907 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
| 56 | - $items[] = 'gravityview-admin-installer'; |
|
| 56 | + $items[ ] = 'gravityview-admin-installer'; |
|
| 57 | 57 | |
| 58 | 58 | return $items; |
| 59 | 59 | } |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
| 75 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
| 76 | 76 | foreach ( $downloads_data as $extension ) { |
| 77 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
| 77 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - return (object) array( |
|
| 82 | - 'slug' => $extension['info']['slug'], |
|
| 83 | - 'name' => $extension['info']['title'], |
|
| 84 | - 'version' => $extension['licensing']['version'], |
|
| 85 | - 'download_link' => $extension['files'][0]['file'], |
|
| 81 | + return (object)array( |
|
| 82 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
| 83 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
| 84 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
| 85 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | foreach ( $all_plugins as $path => $plugin ) { |
| 146 | 146 | |
| 147 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
| 147 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
| 151 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
| 152 | 152 | 'path' => $path, |
| 153 | - 'version' => $plugin['Version'], |
|
| 153 | + 'version' => $plugin[ 'Version' ], |
|
| 154 | 154 | 'activated' => is_plugin_active( $path ) |
| 155 | 155 | ); |
| 156 | 156 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | return $downloads_data; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if( \GV\Plugin::is_network_activated() ) { |
|
| 211 | + if ( \GV\Plugin::is_network_activated() ) { |
|
| 212 | 212 | $home_url = network_home_url(); |
| 213 | 213 | } else { |
| 214 | 214 | $home_url = home_url(); |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 238 | 238 | |
| 239 | - if ( empty( $downloads_data['products'] ) ) { |
|
| 239 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
| 240 | 240 | return array(); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
| 243 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
| 244 | 244 | |
| 245 | - return $downloads_data['products']; |
|
| 245 | + return $downloads_data[ 'products' ]; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | foreach ( $downloads_data as $extension ) { |
| 317 | 317 | |
| 318 | - if ( empty( $extension['info'] ) ) { |
|
| 318 | + if ( empty( $extension[ 'info' ] ) ) { |
|
| 319 | 319 | continue; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -344,29 +344,29 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
| 346 | 346 | |
| 347 | - $download_info = $details['download_info']; |
|
| 347 | + $download_info = $details[ 'download_info' ]; |
|
| 348 | 348 | |
| 349 | 349 | ?> |
| 350 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
| 350 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
| 351 | 351 | <div class="addon-inner"> |
| 352 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
| 353 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
| 352 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
| 353 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
| 354 | 354 | <div> |
| 355 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
| 356 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
| 357 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
| 355 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
| 356 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
| 357 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
| 358 | 358 | </div> |
| 359 | 359 | <?php } ?> |
| 360 | 360 | |
| 361 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
| 362 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
| 363 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
| 361 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
| 362 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
| 363 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
| 364 | 364 | </a> |
| 365 | 365 | </div> |
| 366 | 366 | |
| 367 | 367 | <div class="addon-excerpt"><?php |
| 368 | 368 | |
| 369 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 369 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
| 370 | 370 | |
| 371 | 371 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
| 372 | 372 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | private function get_download_display_details( $download, $wp_plugins ) { |
| 408 | 408 | |
| 409 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
| 409 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
| 410 | 410 | 'thumbnail' => '', |
| 411 | 411 | 'title' => '', |
| 412 | 412 | 'textdomain' => '', |
@@ -418,9 +418,9 @@ discard block |
||
| 418 | 418 | 'installer_excerpt' => null, // May not be defined |
| 419 | 419 | ) ); |
| 420 | 420 | |
| 421 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
| 421 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
| 422 | 422 | |
| 423 | - $has_access = ! empty( $download['files'] ); |
|
| 423 | + $has_access = ! empty( $download[ 'files' ] ); |
|
| 424 | 424 | $spinner = true; |
| 425 | 425 | $href = $plugin_path = '#'; |
| 426 | 426 | $status = $item_class = $button_title = $button_class = ''; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
| 431 | 431 | |
| 432 | 432 | // The license is not active - no matter what level, this should not work |
| 433 | - if( ! $is_active && empty( $base_price ) ) { |
|
| 433 | + if ( ! $is_active && empty( $base_price ) ) { |
|
| 434 | 434 | $spinner = false; |
| 435 | 435 | $status_label = ''; |
| 436 | 436 | $button_class = 'disabled disabled-license'; |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | $status_label = ''; |
| 444 | 444 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
| 445 | 445 | $button_class = 'button-primary button-large'; |
| 446 | - $href = $download_info['link']; |
|
| 446 | + $href = $download_info[ 'link' ]; |
|
| 447 | 447 | $item_class = 'featured'; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 459 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
| 460 | 460 | $spinner = false; |
| 461 | 461 | $status = 'notinstalled'; |
| 462 | 462 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | $href = add_query_arg( |
| 472 | 472 | array( |
| 473 | 473 | 'action' => 'install-plugin', |
| 474 | - 'plugin' => $download_info['slug'], |
|
| 475 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
| 474 | + 'plugin' => $download_info[ 'slug' ], |
|
| 475 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
| 476 | 476 | ), |
| 477 | 477 | self_admin_url( 'update.php' ) |
| 478 | 478 | ); |
@@ -484,25 +484,25 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | // Access and the plugin is installed but not active |
| 487 | - elseif ( false === $wp_plugin['activated'] ) { |
|
| 487 | + elseif ( false === $wp_plugin[ 'activated' ] ) { |
|
| 488 | 488 | $status = 'inactive'; |
| 489 | 489 | $status_label = __( 'Inactive', 'gravityview' ); |
| 490 | 490 | $button_label = __( 'Activate', 'gravityview' ); |
| 491 | - $plugin_path = $wp_plugin['path']; |
|
| 491 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 492 | 492 | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Access and the plugin is installed and active |
| 496 | 496 | else { |
| 497 | 497 | |
| 498 | - $plugin_path = $wp_plugin['path']; |
|
| 498 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 499 | 499 | $status = 'active'; |
| 500 | 500 | $status_label = __( 'Active', 'gravityview' ); |
| 501 | 501 | $button_label = __( 'Deactivate', 'gravityview' ); |
| 502 | 502 | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 505 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | /** |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
| 518 | 518 | $base_price = \GFCommon::to_number( $base_price ); |
| 519 | 519 | |
| 520 | - unset( $download['pricing']['amount'] ); |
|
| 520 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
| 521 | 521 | |
| 522 | 522 | // Price options array, not single price |
| 523 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
| 524 | - $base_price = array_shift( $download['pricing'] ); |
|
| 523 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
| 524 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | return floatval( $base_price ); |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | public function activate_download() { |
| 536 | 536 | $data = \GV\Utils::_POST( 'data', array() ); |
| 537 | 537 | |
| 538 | - if ( empty( $data['path'] ) ) { |
|
| 538 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 539 | 539 | return; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $result = activate_plugin( $data['path'] ); |
|
| 542 | + $result = activate_plugin( $data[ 'path' ] ); |
|
| 543 | 543 | |
| 544 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
| 544 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
| 545 | 545 | wp_send_json_error( array( |
| 546 | 546 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
| 547 | 547 | ) ); |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | public function deactivate_download() { |
| 559 | 559 | $data = \GV\Utils::_POST( 'data', array() ); |
| 560 | 560 | |
| 561 | - if ( empty( $data['path'] ) ) { |
|
| 561 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 562 | 562 | return; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - deactivate_plugins( $data['path'] ); |
|
| 565 | + deactivate_plugins( $data[ 'path' ] ); |
|
| 566 | 566 | |
| 567 | - if( is_plugin_active( $data['path'] ) ) { |
|
| 567 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
| 568 | 568 | wp_send_json_error( array( |
| 569 | 569 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
| 570 | 570 | ) ); |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { |
| 41 | 41 | |
| 42 | 42 | if ( in_array( $source_field, array( 'date_created', 'date_updated', 'payment_date' ), true ) ) { |
| 43 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
| 44 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
| 43 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
| 44 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ( $source_field instanceof GF_Field && $source_field->type == 'date' ) { |
| 48 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
| 49 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
| 48 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
| 49 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if ( in_array( $_operation = str_replace( ' ', '_', trim( $operation ) ), array( 'in', 'not_in' ) ) ) { |
| 53 | - return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $_operation ); |
|
| 53 | + return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $_operation ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form ); |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $post_data = self::get_post_fields( $form, $entry ); |
| 76 | 76 | |
| 77 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 77 | + $media = get_attached_media( 'image', $entry[ 'post_id' ] ); |
|
| 78 | 78 | |
| 79 | 79 | $post_images = array(); |
| 80 | 80 | |
| 81 | 81 | foreach ( $media as $media_item ) { |
| 82 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 83 | - if( |
|
| 82 | + foreach ( (array)$post_data[ 'images' ] as $post_data_item ) { |
|
| 83 | + if ( |
|
| 84 | 84 | \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
| 85 | 85 | \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
| 86 | 86 | \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
| 87 | 87 | ) { |
| 88 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 88 | + $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * If the method changes to public, use Gravity Forms' method |
| 114 | 114 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 115 | 115 | */ |
| 116 | - if( $reflection->isPublic() ) { |
|
| 116 | + if ( $reflection->isPublic() ) { |
|
| 117 | 117 | return parent::get_post_fields( $form, $entry ); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * If the method changes to public, use Gravity Forms' method |
| 141 | 141 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 142 | 142 | */ |
| 143 | - if( $reflection->isPublic() ) { |
|
| 143 | + if ( $reflection->isPublic() ) { |
|
| 144 | 144 | return parent::copy_post_image( $url, $post_id ); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * If the method changes to public, use Gravity Forms' method |
| 176 | 176 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 177 | 177 | */ |
| 178 | - if( $reflection->isPublic() ) { |
|
| 178 | + if ( $reflection->isPublic() ) { |
|
| 179 | 179 | return parent::media_handle_upload( $url, $post_id, $post_data ); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -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 ); |
@@ -39,29 +39,29 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $label = ''; |
| 41 | 41 | |
| 42 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
| 42 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
| 43 | 43 | |
| 44 | - $label = $field['label']; |
|
| 44 | + $label = $field[ 'label' ]; |
|
| 45 | 45 | |
| 46 | 46 | // Support Gravity Forms 1.9+ |
| 47 | - if( class_exists( 'GF_Field' ) ) { |
|
| 47 | + if ( class_exists( 'GF_Field' ) ) { |
|
| 48 | 48 | |
| 49 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 49 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 50 | 50 | |
| 51 | - if( $field_object ) { |
|
| 51 | + if ( $field_object ) { |
|
| 52 | 52 | |
| 53 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
| 53 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
| 54 | 54 | |
| 55 | 55 | // This is a complex field, with labels on a per-input basis |
| 56 | - if( $input ) { |
|
| 56 | + if ( $input ) { |
|
| 57 | 57 | |
| 58 | 58 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
| 59 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 59 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 60 | 60 | |
| 61 | 61 | } else { |
| 62 | 62 | |
| 63 | 63 | // This is a field with one label |
| 64 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
| 64 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
| 73 | - if ( !empty( $field['custom_label'] ) ) { |
|
| 73 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 74 | 74 | |
| 75 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
| 75 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
| 76 | 76 | |
| 77 | 77 | } |
| 78 | 78 | |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $width = NULL; |
| 136 | 136 | |
| 137 | - if( !empty( $field['width'] ) ) { |
|
| 138 | - $width = absint( $field['width'] ); |
|
| 137 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
| 138 | + $width = absint( $field[ 'width' ] ); |
|
| 139 | 139 | |
| 140 | 140 | // If using percentages, limit to 100% |
| 141 | - if( '%d%%' === $format && $width > 100 ) { |
|
| 141 | + if ( '%d%%' === $format && $width > 100 ) { |
|
| 142 | 142 | $width = 100; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -159,42 +159,42 @@ discard block |
||
| 159 | 159 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
| 160 | 160 | $classes = array(); |
| 161 | 161 | |
| 162 | - if( !empty( $field['custom_class'] ) ) { |
|
| 162 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
| 163 | 163 | |
| 164 | - $custom_class = $field['custom_class']; |
|
| 164 | + $custom_class = $field[ 'custom_class' ]; |
|
| 165 | 165 | |
| 166 | - if( !empty( $entry ) ) { |
|
| 166 | + if ( ! empty( $entry ) ) { |
|
| 167 | 167 | |
| 168 | 168 | // We want the merge tag to be formatted as a class. The merge tag may be |
| 169 | 169 | // replaced by a multiple-word value that should be output as a single class. |
| 170 | 170 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
| 171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 171 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 172 | 172 | |
| 173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
| 174 | 174 | |
| 175 | 175 | // And then we want life to return to normal |
| 176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 176 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // And now we want the spaces to be handled nicely. |
| 180 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
| 180 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
| 181 | 181 | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if(!empty($field['id'])) { |
|
| 185 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
| 186 | - $form_id = '-'.$form['id']; |
|
| 184 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
| 185 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 186 | + $form_id = '-' . $form[ 'id' ]; |
|
| 187 | 187 | } else { |
| 188 | 188 | // @deprecated path. Form should always be given. |
| 189 | 189 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
| 190 | 190 | $gravityview_view = GravityView_View::getInstance(); |
| 191 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
| 191 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
| 194 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - return esc_attr(implode(' ', $classes)); |
|
| 197 | + return esc_attr( implode( ' ', $classes ) ); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @return string Sanitized unique HTML `id` attribute for the field |
| 211 | 211 | */ |
| 212 | 212 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
| 213 | - $id = $field['id']; |
|
| 213 | + $id = $field[ 'id' ]; |
|
| 214 | 214 | |
| 215 | 215 | if ( ! empty( $id ) ) { |
| 216 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
| 217 | - $form_id = '-' . $form['id']; |
|
| 216 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 217 | + $form_id = '-' . $form[ 'id' ]; |
|
| 218 | 218 | } else { |
| 219 | 219 | // @deprecated path. Form should always be given. |
| 220 | 220 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
| 225 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return esc_attr( $id ); |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
| 264 | 264 | |
| 265 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 265 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 266 | 266 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
| 267 | 267 | return NULL; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $href = self::entry_link( $entry, $base_id ); |
| 271 | 271 | |
| 272 | - if( '' === $href ) { |
|
| 272 | + if ( '' === $href ) { |
|
| 273 | 273 | return NULL; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } else { |
| 307 | 307 | $gravityview_view = GravityView_View::getInstance(); |
| 308 | 308 | |
| 309 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 309 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 310 | 310 | $is_search = true; |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // If we've saved the permalink in memory, use it |
| 405 | 405 | // @since 1.3 |
| 406 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 406 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 407 | 407 | |
| 408 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
| 408 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
| 409 | 409 | $link = home_url(); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | // If not yet saved, cache the permalink. |
| 416 | 416 | // @since 1.3 |
| 417 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 417 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Deal with returning to proper pagination for embedded views |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | $args = array(); |
| 424 | 424 | |
| 425 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 426 | - $args['pagenum'] = intval( $pagenum ); |
|
| 425 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 426 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 430 | - $args['sort'] = $sort; |
|
| 431 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 429 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 430 | + $args[ 'sort' ] = $sort; |
|
| 431 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $link = add_query_arg( $args, $link ); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 466 | 466 | |
| 467 | 467 | // Generate an unique hash to use as the default value |
| 468 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 468 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 469 | 469 | |
| 470 | 470 | /** |
| 471 | 471 | * @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}` |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 477 | 477 | |
| 478 | 478 | // Make sure we have something - use the original ID as backup. |
| 479 | - if( empty( $slug ) ) { |
|
| 479 | + if ( empty( $slug ) ) { |
|
| 480 | 480 | $slug = $id; |
| 481 | 481 | } |
| 482 | 482 | |
@@ -570,15 +570,15 @@ discard block |
||
| 570 | 570 | * @param boolean $custom Should we process the custom entry slug? |
| 571 | 571 | */ |
| 572 | 572 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 573 | - if( $custom ) { |
|
| 573 | + if ( $custom ) { |
|
| 574 | 574 | // create the gravityview_unique_id and save it |
| 575 | 575 | |
| 576 | 576 | // Get the entry hash |
| 577 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 577 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 578 | 578 | |
| 579 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 579 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
| 580 | 580 | |
| 581 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 581 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 582 | 582 | |
| 583 | 583 | } |
| 584 | 584 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | |
| 598 | 598 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
| 599 | 599 | $entry = GVCommon::get_entry( $entry ); |
| 600 | - } else if( empty( $entry ) ) { |
|
| 600 | + } else if ( empty( $entry ) ) { |
|
| 601 | 601 | // @deprecated path |
| 602 | 602 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 603 | 603 | } |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
| 619 | 619 | |
| 620 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 620 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 621 | 621 | |
| 622 | - if ( get_option('permalink_structure') && !is_preview() ) { |
|
| 622 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 623 | 623 | |
| 624 | 624 | $args = array(); |
| 625 | 625 | |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | $link_parts = explode( '?', $directory_link ); |
| 631 | 631 | |
| 632 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 632 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 633 | 633 | |
| 634 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 634 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 635 | 635 | |
| 636 | 636 | } else { |
| 637 | 637 | |
@@ -643,21 +643,21 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | if ( $add_directory_args ) { |
| 645 | 645 | |
| 646 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 647 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 646 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 647 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /** |
| 651 | 651 | * @since 1.7 |
| 652 | 652 | */ |
| 653 | 653 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
| 654 | - $args['sort'] = $sort; |
|
| 655 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 654 | + $args[ 'sort' ] = $sort; |
|
| 655 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | - if( $post_id ) { |
|
| 660 | + if ( $post_id ) { |
|
| 661 | 661 | $passed_post = get_post( $post_id ); |
| 662 | 662 | $views = \GV\View_Collection::from_post( $passed_post ); |
| 663 | 663 | $has_multiple_views = $views->count() > 1; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | if ( $has_multiple_views ) { |
| 669 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 669 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | return add_query_arg( $args, $directory_link ); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 690 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 690 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | /** |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | $view_id = 0; |
| 711 | 711 | if ( $context->view ) { |
| 712 | 712 | $view_id = $context->view->ID; |
| 713 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 713 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 714 | 714 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
| 715 | 715 | } |
| 716 | 716 | } |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | $default_css_class .= ' gv-container-no-results'; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 741 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 742 | 742 | |
| 743 | 743 | /** |
| 744 | 744 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | |
| 766 | 766 | $value = GravityView_API::field_value( $entry, $field ); |
| 767 | 767 | |
| 768 | - if( $value === '' ) { |
|
| 768 | + if ( $value === '' ) { |
|
| 769 | 769 | /** |
| 770 | 770 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 771 | 771 | * @param string $value (empty string) |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | */ |
| 879 | 879 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 880 | 880 | |
| 881 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 881 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 882 | 882 | |
| 883 | 883 | // For the complete field value as generated by Gravity Forms |
| 884 | 884 | return $display_value; |
@@ -912,16 +912,16 @@ discard block |
||
| 912 | 912 | $terms = explode( ', ', $value ); |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - foreach ($terms as $term_name ) { |
|
| 915 | + foreach ( $terms as $term_name ) { |
|
| 916 | 916 | |
| 917 | 917 | // If we're processing a category, |
| 918 | - if( $taxonomy === 'category' ) { |
|
| 918 | + if ( $taxonomy === 'category' ) { |
|
| 919 | 919 | |
| 920 | 920 | // Use rgexplode to prevent errors if : doesn't exist |
| 921 | 921 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
| 922 | 922 | |
| 923 | 923 | // The explode was succesful; we have the category ID |
| 924 | - if( !empty( $term_id )) { |
|
| 924 | + if ( ! empty( $term_id ) ) { |
|
| 925 | 925 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 926 | 926 | } else { |
| 927 | 927 | // We have to fall back to the name |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | // There's still a tag/category here. |
| 937 | - if( $term ) { |
|
| 937 | + if ( $term ) { |
|
| 938 | 938 | |
| 939 | 939 | $term_link = get_term_link( $term, $taxonomy ); |
| 940 | 940 | |
@@ -943,11 +943,11 @@ discard block |
||
| 943 | 943 | continue; |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 946 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 947 | 947 | } |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - return implode(', ', $output ); |
|
| 950 | + return implode( ', ', $output ); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | /** |
@@ -961,8 +961,8 @@ discard block |
||
| 961 | 961 | |
| 962 | 962 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 963 | 963 | |
| 964 | - if( empty( $link ) ) { |
|
| 965 | - return strip_tags( $output); |
|
| 964 | + if ( empty( $link ) ) { |
|
| 965 | + return strip_tags( $output ); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | return $output; |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | $fe = GravityView_frontend::getInstance(); |
| 982 | 982 | |
| 983 | 983 | // Solve problem when loading content via admin-ajax.php |
| 984 | - if( ! $fe->getGvOutputData() ) { |
|
| 984 | + if ( ! $fe->getGvOutputData() ) { |
|
| 985 | 985 | |
| 986 | 986 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
| 987 | 987 | |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | // Make 100% sure that we're dealing with a properly called situation |
| 992 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 992 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 993 | 993 | |
| 994 | 994 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
| 995 | 995 | |
@@ -1211,12 +1211,12 @@ discard block |
||
| 1211 | 1211 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
| 1212 | 1212 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1213 | 1213 | |
| 1214 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1215 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1214 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1215 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1219 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1218 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1219 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | if ( is_null( $context ) ) { |
@@ -1319,21 +1319,21 @@ discard block |
||
| 1319 | 1319 | } else { |
| 1320 | 1320 | // @deprecated path |
| 1321 | 1321 | // Required fields. |
| 1322 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1322 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1323 | 1323 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
| 1324 | 1324 | return ''; |
| 1325 | 1325 | } |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | if ( $context instanceof \GV\Template_Context ) { |
| 1329 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1330 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1331 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1329 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1330 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1331 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1332 | 1332 | } else { |
| 1333 | 1333 | // @deprecated path |
| 1334 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1335 | - $field = $args['field']; |
|
| 1336 | - $form = $args['form']; |
|
| 1334 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1335 | + $field = $args[ 'field' ]; |
|
| 1336 | + $form = $args[ 'form' ]; |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | /** |
@@ -1353,43 +1353,43 @@ discard block |
||
| 1353 | 1353 | ); |
| 1354 | 1354 | |
| 1355 | 1355 | if ( $context instanceof \GV\Template_Context ) { |
| 1356 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1356 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1357 | 1357 | } else { |
| 1358 | 1358 | // @deprecated path |
| 1359 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
| 1359 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | // If the value is empty and we're hiding empty, return empty. |
| 1363 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1363 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1364 | 1364 | return ''; |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1368 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
| 1367 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1368 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | 1371 | // Get width setting, if exists |
| 1372 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
| 1372 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
| 1373 | 1373 | |
| 1374 | 1374 | // If replacing with CSS inline formatting, let's do it. |
| 1375 | - $placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
| 1375 | + $placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
| 1376 | 1376 | |
| 1377 | 1377 | // Grab the Class using `gv_class` |
| 1378 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
| 1379 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1378 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
| 1379 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1380 | 1380 | |
| 1381 | 1381 | if ( $context instanceof \GV\Template_Context ) { |
| 1382 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label' ); |
|
| 1382 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' ); |
|
| 1383 | 1383 | } else { |
| 1384 | 1384 | // Default Label value |
| 1385 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
| 1385 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | - $placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders['label_value'] ) ) ) ); |
|
| 1389 | - $placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] ); |
|
| 1388 | + $placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '> ', '>', $placeholders[ 'label_value' ] ) ) ) ); |
|
| 1389 | + $placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] ); |
|
| 1390 | 1390 | |
| 1391 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
| 1392 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1391 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
| 1392 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | /** |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | * @since 2.0 |
| 1401 | 1401 | * @param \GV\Template_Context $context The context. |
| 1402 | 1402 | */ |
| 1403 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
| 1403 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
| 1404 | 1404 | |
| 1405 | 1405 | /** |
| 1406 | 1406 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | foreach ( $placeholders as $tag => $value ) { |
| 1428 | 1428 | |
| 1429 | 1429 | // If the tag doesn't exist just skip it |
| 1430 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1430 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1431 | 1431 | continue; |
| 1432 | 1432 | } |
| 1433 | 1433 | |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | /** Call all lazy callbacks. */ |
| 106 | 106 | foreach ( $this->callbacks as $callback ) { |
| 107 | - if ( $callback[0] != 'count' ) { |
|
| 107 | + if ( $callback[ 0 ] != 'count' ) { |
|
| 108 | 108 | continue; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $total += $callback[1]( $this->filters ); |
|
| 111 | + $total += $callback[ 1 ]( $this->filters ); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if ( ! $total ) { |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | /** Call all lazy callbacks. */ |
| 187 | 187 | foreach ( $this->callbacks as $i => $callback ) { |
| 188 | - if ( $callback[0] != 'fetch' ) { |
|
| 188 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
| 189 | 189 | continue; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
| 192 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $this->fetched = parent::count(); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | return; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $this->callbacks []= array( $type, $callback ); |
|
| 348 | + $this->callbacks [ ] = array( $type, $callback ); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |