@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | do_action( 'gravityview_search_widget_fields_before', $this ); |
| 25 | 25 | |
| 26 | - foreach( $this->search_fields as $search_field ) { |
|
| 26 | + foreach ( $this->search_fields as $search_field ) { |
|
| 27 | 27 | $gravityview_view->search_field = $search_field; |
| 28 | - $this->render( 'search-field', $search_field['input'], false ); |
|
| 28 | + $this->render( 'search-field', $search_field[ 'input' ], false ); |
|
| 29 | 29 | |
| 30 | 30 | // show/hide the search button if there are input type fields |
| 31 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
| 31 | + if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) { |
|
| 32 | 32 | $has_inputs = true; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | do_action( 'gravityview_search_widget_fields_after', $this ); |
| 41 | 41 | |
| 42 | - if( $has_inputs ) { ?> |
|
| 42 | + if ( $has_inputs ) { ?> |
|
| 43 | 43 | <div class="gv-search-box gv-search-box-submit"> |
| 44 | 44 | <?php |
| 45 | 45 | |
@@ -622,7 +622,7 @@ |
||
| 622 | 622 | 'ymd_dot' => 'Y.m.d', |
| 623 | 623 | ); |
| 624 | 624 | |
| 625 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 625 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 626 | 626 | $format = $datepicker[ $field->dateFormat ]; |
| 627 | 627 | } |
| 628 | 628 | |
@@ -386,14 +386,14 @@ |
||
| 386 | 386 | $curr_start = esc_attr( rgget( 'gv_start' ) ); |
| 387 | 387 | $curr_end = esc_attr( rgget( 'gv_end' ) ); |
| 388 | 388 | |
| 389 | - /** |
|
| 390 | - * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | - * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | - * @since 1.12 |
|
| 393 | - * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | - * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | - */ |
|
| 396 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 389 | + /** |
|
| 390 | + * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | + * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | + * @since 1.12 |
|
| 393 | + * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | + * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | + */ |
|
| 396 | + $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 397 | 397 | |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | /** |
| 202 | 202 | * Add admin script to the no-conflict scripts whitelist |
| 203 | 203 | * @param array $allowed Scripts allowed in no-conflict mode |
| 204 | - * @return array Scripts allowed in no-conflict mode, plus the search widget script |
|
| 204 | + * @return string[] Scripts allowed in no-conflict mode, plus the search widget script |
|
| 205 | 205 | */ |
| 206 | 206 | public function register_no_conflict( $allowed ) { |
| 207 | 207 | $allowed[] = 'gravityview_searchwidget_admin'; |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | /** |
| 890 | 890 | * Get the label for a search form field |
| 891 | 891 | * @param array $field Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys |
| 892 | - * @param array $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 892 | + * @param GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()` |
|
| 893 | 893 | * @return string Label for the search form |
| 894 | 894 | */ |
| 895 | 895 | private static function get_field_label( $field, $form_field = array() ) { |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | /** |
| 1059 | 1059 | * Require the datepicker script for the frontend GV script |
| 1060 | 1060 | * @param array $js_dependencies Array of existing required scripts for the fe-views.js script |
| 1061 | - * @return array Array required scripts, with `jquery-ui-datepicker` added |
|
| 1061 | + * @return string[] Array required scripts, with `jquery-ui-datepicker` added |
|
| 1062 | 1062 | */ |
| 1063 | 1063 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1064 | 1064 | |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | /** |
| 1071 | 1071 | * Modify the array passed to wp_localize_script() |
| 1072 | 1072 | * |
| 1073 | - * @param array $js_localization The data padded to the Javascript file |
|
| 1073 | + * @param array $localizations The data padded to the Javascript file |
|
| 1074 | 1074 | * @param array $view_data View data array with View settings |
| 1075 | 1075 | * |
| 1076 | 1076 | * @return array |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'type' => 'radio', |
| 64 | 64 | 'full_width' => true, |
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 67 | 67 | 'value' => 'any', |
| 68 | 68 | 'class' => 'hide-if-js', |
| 69 | 69 | 'options' => array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
| 87 | 87 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
| 88 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
| 88 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
| 89 | 89 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
| 90 | 90 | |
| 91 | 91 | // ajax - get the searchable fields |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 150 | 150 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 151 | 151 | |
| 152 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 152 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 205 | 205 | */ |
| 206 | 206 | public function register_no_conflict( $allowed ) { |
| 207 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 207 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 208 | 208 | return $allowed; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -217,24 +217,24 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public static function get_searchable_fields() { |
| 219 | 219 | |
| 220 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 220 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 221 | 221 | exit( '0' ); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | $form = ''; |
| 225 | 225 | |
| 226 | 226 | // Fetch the form for the current View |
| 227 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 227 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 228 | 228 | |
| 229 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 229 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 230 | 230 | |
| 231 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 231 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 232 | 232 | |
| 233 | - $form = (int) $_POST['formid']; |
|
| 233 | + $form = (int)$_POST[ 'formid' ]; |
|
| 234 | 234 | |
| 235 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 235 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 236 | 236 | |
| 237 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 237 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 283 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 282 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 283 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Get fields with sub-inputs and no parent |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | foreach ( $fields as $id => $field ) { |
| 304 | 304 | |
| 305 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 305 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 306 | 306 | continue; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 309 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 310 | 310 | |
| 311 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 311 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 331 | 331 | |
| 332 | 332 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 333 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 333 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 334 | 334 | $input_type = 'boolean'; // on/off checkbox |
| 335 | 335 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 336 | 336 | $input_type = 'multi'; //multiselect |
@@ -372,19 +372,19 @@ discard block |
||
| 372 | 372 | $post_id = 0; |
| 373 | 373 | |
| 374 | 374 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 375 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 376 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 375 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 376 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 377 | 377 | } |
| 378 | 378 | // We're in the WordPress Widget context, and the base View ID should be used |
| 379 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 380 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 379 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 380 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 384 | 384 | |
| 385 | 385 | // Add hidden fields to the search form |
| 386 | 386 | foreach ( $args as $key => $value ) { |
| 387 | - $search_fields[] = array( |
|
| 387 | + $search_fields[ ] = array( |
|
| 388 | 388 | 'name' => $key, |
| 389 | 389 | 'input' => 'hidden', |
| 390 | 390 | 'value' => $value, |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function filter_entries( $search_criteria ) { |
| 407 | 407 | |
| 408 | - if( 'post' === $this->search_method ) { |
|
| 408 | + if ( 'post' === $this->search_method ) { |
|
| 409 | 409 | $get = $_POST; |
| 410 | 410 | } else { |
| 411 | 411 | $get = $_GET; |
@@ -422,15 +422,15 @@ discard block |
||
| 422 | 422 | $get = gv_map_deep( $get, 'urldecode' ); |
| 423 | 423 | |
| 424 | 424 | // add free search |
| 425 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 425 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 426 | 426 | |
| 427 | 427 | // Search for a piece |
| 428 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 428 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 429 | 429 | |
| 430 | 430 | $words = array_filter( $words ); |
| 431 | 431 | |
| 432 | 432 | foreach ( $words as $word ) { |
| 433 | - $search_criteria['field_filters'][] = array( |
|
| 433 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 434 | 434 | 'key' => null, // The field ID to search |
| 435 | 435 | 'value' => $word, // The value to search |
| 436 | 436 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | //start date & end date |
| 442 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 443 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 442 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 443 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 444 | 444 | |
| 445 | 445 | /** |
| 446 | 446 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -455,16 +455,16 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 457 | 457 | */ |
| 458 | - if( !empty( $curr_start ) ) { |
|
| 459 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 458 | + if ( ! empty( $curr_start ) ) { |
|
| 459 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 460 | 460 | } |
| 461 | - if( !empty( $curr_end ) ) { |
|
| 462 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 461 | + if ( ! empty( $curr_end ) ) { |
|
| 462 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // search for a specific entry ID |
| 466 | 466 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 467 | - $search_criteria['field_filters'][] = array( |
|
| 467 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 468 | 468 | 'key' => 'id', |
| 469 | 469 | 'value' => absint( $get[ 'gv_id' ] ), |
| 470 | 470 | 'operator' => '=', |
@@ -473,36 +473,36 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | // search for a specific Created_by ID |
| 475 | 475 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 476 | - $search_criteria['field_filters'][] = array( |
|
| 476 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 477 | 477 | 'key' => 'created_by', |
| 478 | - 'value' => absint( $get['gv_by'] ), |
|
| 478 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 479 | 479 | 'operator' => '=', |
| 480 | 480 | ); |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | |
| 484 | 484 | // Get search mode passed in URL |
| 485 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 485 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 486 | 486 | |
| 487 | 487 | // get the other search filters |
| 488 | 488 | foreach ( $get as $key => $value ) { |
| 489 | 489 | |
| 490 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 490 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 491 | 491 | continue; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // could return simple filter or multiple filters |
| 495 | 495 | $filter = $this->prepare_field_filter( $key, $value ); |
| 496 | 496 | |
| 497 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 498 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 497 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 498 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 499 | 499 | |
| 500 | 500 | // if date range type, set search mode to ALL |
| 501 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 501 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 502 | 502 | $mode = 'all'; |
| 503 | 503 | } |
| 504 | - } elseif( !empty( $filter ) ) { |
|
| 505 | - $search_criteria['field_filters'][] = $filter; |
|
| 504 | + } elseif ( ! empty( $filter ) ) { |
|
| 505 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * @since 1.5.1 |
| 512 | 512 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 513 | 513 | */ |
| 514 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 514 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 515 | 515 | |
| 516 | 516 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 517 | 517 | |
@@ -549,11 +549,11 @@ discard block |
||
| 549 | 549 | 'value' => $value, |
| 550 | 550 | ); |
| 551 | 551 | |
| 552 | - switch ( $form_field['type'] ) { |
|
| 552 | + switch ( $form_field[ 'type' ] ) { |
|
| 553 | 553 | |
| 554 | 554 | case 'select': |
| 555 | 555 | case 'radio': |
| 556 | - $filter['operator'] = 'is'; |
|
| 556 | + $filter[ 'operator' ] = 'is'; |
|
| 557 | 557 | break; |
| 558 | 558 | |
| 559 | 559 | case 'post_category': |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | foreach ( $value as $val ) { |
| 569 | 569 | $cat = get_term( $val, 'category' ); |
| 570 | - $filter[] = array( |
|
| 570 | + $filter[ ] = array( |
|
| 571 | 571 | 'key' => $field_id, |
| 572 | 572 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 573 | 573 | 'operator' => 'is', |
@@ -586,18 +586,18 @@ discard block |
||
| 586 | 586 | $filter = array(); |
| 587 | 587 | |
| 588 | 588 | foreach ( $value as $val ) { |
| 589 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 589 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | break; |
| 593 | 593 | |
| 594 | 594 | case 'checkbox': |
| 595 | 595 | // convert checkbox on/off into the correct search filter |
| 596 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 597 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 598 | - if ( $input['id'] == $field_id ) { |
|
| 599 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 600 | - $filter['operator'] = 'is'; |
|
| 596 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 597 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 598 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 599 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 600 | + $filter[ 'operator' ] = 'is'; |
|
| 601 | 601 | break; |
| 602 | 602 | } |
| 603 | 603 | } |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | $filter = array(); |
| 608 | 608 | |
| 609 | 609 | foreach ( $value as $val ) { |
| 610 | - $filter[] = array( |
|
| 610 | + $filter[ ] = array( |
|
| 611 | 611 | 'key' => $field_id, |
| 612 | 612 | 'value' => $val, |
| 613 | 613 | 'operator' => 'is', |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | foreach ( $words as $word ) { |
| 629 | 629 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 630 | 630 | // Keep the same key for each filter |
| 631 | - $filter['value'] = $word; |
|
| 631 | + $filter[ 'value' ] = $word; |
|
| 632 | 632 | // Add a search for the value |
| 633 | - $filters[] = $filter; |
|
| 633 | + $filters[ ] = $filter; |
|
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 | |
@@ -657,19 +657,19 @@ discard block |
||
| 657 | 657 | * @since 1.16.3 |
| 658 | 658 | * Safeguard until GF implements '<=' operator |
| 659 | 659 | */ |
| 660 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 660 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 661 | 661 | $operator = '<'; |
| 662 | 662 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - $filter[] = array( |
|
| 665 | + $filter[ ] = array( |
|
| 666 | 666 | 'key' => $field_id, |
| 667 | 667 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 668 | 668 | 'operator' => $operator, |
| 669 | 669 | ); |
| 670 | 670 | } |
| 671 | 671 | } else { |
| 672 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 672 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | break; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | 'ymd_dot' => 'Y.m.d', |
| 701 | 701 | ); |
| 702 | 702 | |
| 703 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 703 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 704 | 704 | $format = $datepicker[ $field->dateFormat ]; |
| 705 | 705 | } |
| 706 | 706 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | public function add_template_path( $file_paths ) { |
| 732 | 732 | |
| 733 | 733 | // Index 100 is the default GravityView template path. |
| 734 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 734 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 735 | 735 | |
| 736 | 736 | return $file_paths; |
| 737 | 737 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | // get configured search fields |
| 757 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 757 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 758 | 758 | |
| 759 | 759 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 760 | 760 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -768,24 +768,24 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $updated_field = $field; |
| 770 | 770 | |
| 771 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 771 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 772 | 772 | $has_date = true; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 776 | 776 | |
| 777 | - switch ( $field['field'] ) { |
|
| 777 | + switch ( $field[ 'field' ] ) { |
|
| 778 | 778 | |
| 779 | 779 | case 'search_all': |
| 780 | - $updated_field['key'] = 'search_all'; |
|
| 781 | - $updated_field['input'] = 'search_all'; |
|
| 782 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 780 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 781 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 782 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 783 | 783 | break; |
| 784 | 784 | |
| 785 | 785 | case 'entry_date': |
| 786 | - $updated_field['key'] = 'entry_date'; |
|
| 787 | - $updated_field['input'] = 'entry_date'; |
|
| 788 | - $updated_field['value'] = array( |
|
| 786 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 787 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 788 | + $updated_field[ 'value' ] = array( |
|
| 789 | 789 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 790 | 790 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 791 | 791 | ); |
@@ -793,16 +793,16 @@ discard block |
||
| 793 | 793 | break; |
| 794 | 794 | |
| 795 | 795 | case 'entry_id': |
| 796 | - $updated_field['key'] = 'entry_id'; |
|
| 797 | - $updated_field['input'] = 'entry_id'; |
|
| 798 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 796 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 797 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 798 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 799 | 799 | break; |
| 800 | 800 | |
| 801 | 801 | case 'created_by': |
| 802 | - $updated_field['key'] = 'created_by'; |
|
| 803 | - $updated_field['name'] = 'gv_by'; |
|
| 804 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 805 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 802 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 803 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 804 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 805 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 806 | 806 | break; |
| 807 | 807 | } |
| 808 | 808 | |
@@ -820,16 +820,16 @@ discard block |
||
| 820 | 820 | */ |
| 821 | 821 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 822 | 822 | |
| 823 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 823 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 824 | 824 | |
| 825 | 825 | /** @since 1.14 */ |
| 826 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 826 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 827 | 827 | |
| 828 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 828 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 829 | 829 | |
| 830 | 830 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 831 | 831 | |
| 832 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 832 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 833 | 833 | |
| 834 | 834 | if ( $has_date ) { |
| 835 | 835 | // enqueue datepicker stuff only if needed! |
@@ -851,10 +851,10 @@ discard block |
||
| 851 | 851 | public static function get_search_class( $custom_class = '' ) { |
| 852 | 852 | $gravityview_view = GravityView_View::getInstance(); |
| 853 | 853 | |
| 854 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 854 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 855 | 855 | |
| 856 | - if ( ! empty( $custom_class ) ) { |
|
| 857 | - $search_class .= ' '.$custom_class; |
|
| 856 | + if ( ! empty( $custom_class ) ) { |
|
| 857 | + $search_class .= ' ' . $custom_class; |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
@@ -896,11 +896,11 @@ discard block |
||
| 896 | 896 | |
| 897 | 897 | $label = rgget( 'label', $field ); |
| 898 | 898 | |
| 899 | - if( '' === $label ) { |
|
| 899 | + if ( '' === $label ) { |
|
| 900 | 900 | |
| 901 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 901 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 902 | 902 | |
| 903 | - switch( $field['field'] ) { |
|
| 903 | + switch ( $field[ 'field' ] ) { |
|
| 904 | 904 | case 'search_all': |
| 905 | 905 | $label = __( 'Search Entries:', 'gravityview' ); |
| 906 | 906 | break; |
@@ -918,10 +918,10 @@ discard block |
||
| 918 | 918 | break; |
| 919 | 919 | default: |
| 920 | 920 | // If this is a field input, not a field |
| 921 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 921 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 922 | 922 | |
| 923 | 923 | // Get the label for the field in question, which returns an array |
| 924 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 924 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 925 | 925 | |
| 926 | 926 | // Get the item with the `label` key |
| 927 | 927 | $values = wp_list_pluck( $items, 'label' ); |
@@ -958,32 +958,32 @@ discard block |
||
| 958 | 958 | $form = $gravityview_view->getForm(); |
| 959 | 959 | |
| 960 | 960 | // for advanced field ids (eg, first name / last name ) |
| 961 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 961 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 962 | 962 | |
| 963 | 963 | // get searched value from $_GET/$_POST (string or array) |
| 964 | 964 | $value = $this->rgget_or_rgpost( $name ); |
| 965 | 965 | |
| 966 | 966 | // get form field details |
| 967 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 967 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 968 | 968 | |
| 969 | 969 | $filter = array( |
| 970 | - 'key' => $field['field'], |
|
| 970 | + 'key' => $field[ 'field' ], |
|
| 971 | 971 | 'name' => $name, |
| 972 | 972 | 'label' => self::get_field_label( $field, $form_field ), |
| 973 | - 'input' => $field['input'], |
|
| 973 | + 'input' => $field[ 'input' ], |
|
| 974 | 974 | 'value' => $value, |
| 975 | - 'type' => $form_field['type'], |
|
| 975 | + 'type' => $form_field[ 'type' ], |
|
| 976 | 976 | ); |
| 977 | 977 | |
| 978 | 978 | // collect choices |
| 979 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 980 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 981 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 982 | - $filter['choices'] = $form_field['choices']; |
|
| 979 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 980 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 981 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 982 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 986 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 985 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 986 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | return $filter; |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | |
| 1008 | 1008 | $choices = array(); |
| 1009 | 1009 | foreach ( $users as $user ) { |
| 1010 | - $choices[] = array( |
|
| 1010 | + $choices[ ] = array( |
|
| 1011 | 1011 | 'value' => $user->ID, |
| 1012 | 1012 | 'text' => $user->display_name, |
| 1013 | 1013 | ); |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | */ |
| 1063 | 1063 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1064 | 1064 | |
| 1065 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1065 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1066 | 1066 | |
| 1067 | 1067 | return $js_dependencies; |
| 1068 | 1068 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | 'isRTL' => is_rtl(), |
| 1107 | 1107 | ), $view_data ); |
| 1108 | 1108 | |
| 1109 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1109 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1110 | 1110 | |
| 1111 | 1111 | return $localizations; |
| 1112 | 1112 | |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | * @return void |
| 1136 | 1136 | */ |
| 1137 | 1137 | private function maybe_enqueue_flexibility() { |
| 1138 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1138 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1139 | 1139 | wp_enqueue_script( 'gv-flexibility' ); |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1158 | 1158 | |
| 1159 | 1159 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1160 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1160 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1161 | 1161 | |
| 1162 | 1162 | /** |
| 1163 | 1163 | * @filter `gravityview_search_datepicker_class` |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 20 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 21 | 21 | |
| 22 | 22 | $default_values = array( |
| 23 | 23 | 'header' => 1, |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | ), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
| 45 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 48 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 49 | 49 | |
| 50 | - if( !$this->pre_render_frontend() ) { |
|
| 50 | + if ( ! $this->pre_render_frontend() ) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if( !empty( $widget_args['title'] ) ) { |
|
| 55 | - echo $widget_args['title']; |
|
| 54 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 55 | + echo $widget_args[ 'title' ]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // Make sure the class is loaded in DataTables |
| 60 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
| 60 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
| 61 | 61 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $widget_args['content'] = trim( rtrim( $widget_args['content'] ) ); |
|
| 64 | + $widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) ); |
|
| 65 | 65 | |
| 66 | 66 | // No custom content |
| 67 | - if( empty( $widget_args['content'] ) ) { |
|
| 68 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) ); |
|
| 67 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
| 68 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) ); |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Add paragraphs? |
| 73 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
| 74 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
| 73 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
| 74 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $content = $widget_args['content']; |
|
| 77 | + $content = $widget_args[ 'content' ]; |
|
| 78 | 78 | |
| 79 | 79 | $content = GravityView_Merge_Tags::replace_variables( $content ); |
| 80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // Add custom class |
| 87 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 87 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 88 | 88 | $class = gravityview_sanitize_html_class( $class ); |
| 89 | 89 | |
| 90 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
| 90 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | function __construct() { |
| 18 | 18 | |
| 19 | - $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
| 19 | + $this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
| 20 | 20 | |
| 21 | 21 | $default_values = array( |
| 22 | 22 | 'header' => 1, |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $settings = array(); |
| 27 | 27 | |
| 28 | - parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings ); |
|
| 28 | + parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 31 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 32 | 32 | $gravityview_view = GravityView_View::getInstance(); |
| 33 | 33 | |
| 34 | - if( !$this->pre_render_frontend() ) { |
|
| 34 | + if ( ! $this->pre_render_frontend() ) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if( !empty( $widget_args['title'] ) ) { |
|
| 39 | - echo $widget_args['title']; |
|
| 38 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 39 | + echo $widget_args[ 'title' ]; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $pagination_counts = $gravityview_view->getPaginationCounts(); |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $output = ''; |
| 47 | 47 | |
| 48 | - if( ! empty( $pagination_counts ) ) { |
|
| 48 | + if ( ! empty( $pagination_counts ) ) { |
|
| 49 | 49 | |
| 50 | - $first = $pagination_counts['first']; |
|
| 51 | - $last = $pagination_counts['last']; |
|
| 52 | - $total = $pagination_counts['total']; |
|
| 50 | + $first = $pagination_counts[ 'first' ]; |
|
| 51 | + $last = $pagination_counts[ 'last' ]; |
|
| 52 | + $total = $pagination_counts[ 'total' ]; |
|
| 53 | 53 | |
| 54 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 54 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 55 | 55 | $class = gravityview_sanitize_html_class( $class ); |
| 56 | 56 | |
| 57 | - $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
| 57 | + $output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -11,38 +11,38 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | function __construct() { |
| 13 | 13 | |
| 14 | - $this->widget_description = __('Links to multiple pages of results.', 'gravityview' ); |
|
| 14 | + $this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' ); |
|
| 15 | 15 | |
| 16 | 16 | $default_values = array( 'header' => 1, 'footer' => 1 ); |
| 17 | 17 | $settings = array( 'show_all' => array( |
| 18 | 18 | 'type' => 'checkbox', |
| 19 | 19 | 'label' => __( 'Show each page number', 'gravityview' ), |
| 20 | - 'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'), |
|
| 20 | + 'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ), |
|
| 21 | 21 | 'value' => false |
| 22 | - )); |
|
| 23 | - parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings ); |
|
| 22 | + ) ); |
|
| 23 | + parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings ); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 27 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 28 | 28 | $gravityview_view = GravityView_View::getInstance(); |
| 29 | 29 | |
| 30 | - if( !$this->pre_render_frontend() ) { |
|
| 30 | + if ( ! $this->pre_render_frontend() ) { |
|
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $page_size = $gravityview_view->paging['page_size']; |
|
| 34 | + $page_size = $gravityview_view->paging[ 'page_size' ]; |
|
| 35 | 35 | $total = $gravityview_view->total_entries; |
| 36 | 36 | |
| 37 | 37 | $atts = shortcode_atts( array( |
| 38 | - 'show_all' => !empty( $this->settings['show_all']['default'] ), |
|
| 38 | + 'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ), |
|
| 39 | 39 | ), $widget_args, 'gravityview_widget_page_links' ); |
| 40 | 40 | |
| 41 | 41 | // displaying info |
| 42 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 42 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 43 | 43 | |
| 44 | 44 | $page_link_args = array( |
| 45 | - 'base' => add_query_arg('pagenum','%#%', gv_directory_link() ), |
|
| 45 | + 'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ), |
|
| 46 | 46 | 'format' => '&pagenum=%#%', |
| 47 | 47 | 'add_args' => array(), // |
| 48 | 48 | 'prev_text' => '«', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'mid_size' => 2, |
| 53 | 53 | 'total' => empty( $page_size ) ? 0 : ceil( $total / $page_size ), |
| 54 | 54 | 'current' => $curr_page, |
| 55 | - 'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice |
|
| 55 | + 'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | * @since 1.1.4 |
| 61 | 61 | * @param array $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/) |
| 62 | 62 | */ |
| 63 | - $page_link_args = apply_filters('gravityview_page_links_args', $page_link_args ); |
|
| 63 | + $page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args ); |
|
| 64 | 64 | |
| 65 | 65 | $page_links = paginate_links( $page_link_args ); |
| 66 | 66 | |
| 67 | - if( !empty( $page_links )) { |
|
| 68 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 67 | + if ( ! empty( $page_links ) ) { |
|
| 68 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 69 | 69 | $class = gravityview_sanitize_html_class( $class ); |
| 70 | - echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>'; |
|
| 70 | + echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>'; |
|
| 71 | 71 | } else { |
| 72 | 72 | do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' ); |
| 73 | 73 | } |
@@ -170,25 +170,25 @@ discard block |
||
| 170 | 170 | public function get_output() { |
| 171 | 171 | |
| 172 | 172 | // No Entries |
| 173 | - if( empty( $this->entries ) ) { |
|
| 174 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
| 173 | + if ( empty( $this->entries ) ) { |
|
| 174 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $output = ''; |
| 178 | 178 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
| 179 | 179 | |
| 180 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
| 180 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
| 181 | 181 | |
| 182 | - foreach( $this->entries as $entry ) { |
|
| 182 | + foreach ( $this->entries as $entry ) { |
|
| 183 | 183 | |
| 184 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 184 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $output .= $this->get_item_output( $entry ); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
| 191 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | private function skip_entry( $entry, $current_entry ) { |
| 212 | 212 | |
| 213 | 213 | // If skip entry is off, or there's no current entry, return false |
| 214 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 214 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // If in Single or Edit mode, $current_entry will be an array. |
| 219 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
| 219 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
| 220 | 220 | |
| 221 | 221 | // If the entry ID matches the current entry, yes: skip |
| 222 | - if( $entry['id'] === $current_entry_id ) { |
|
| 222 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $item_output = gravityview_get_link( $link, $this->link_format ); |
| 248 | 248 | |
| 249 | - if( !empty( $this->after_link ) ) { |
|
| 249 | + if ( ! empty( $this->after_link ) ) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | * @param array $entry Gravity Forms entry array |
| 256 | 256 | * @param GravityView_Entry_List $this The current class instance |
| 257 | 257 | */ |
| 258 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
| 258 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
| 259 | 259 | |
| 260 | 260 | $item_output .= $after_link; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
| 264 | 264 | |
| 265 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
| 265 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
| 50 | 50 | |
| 51 | 51 | // Get details about the current View |
| 52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
| 53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
| 52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
| 53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $atts = array(); |
| 92 | 92 | |
| 93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 94 | 94 | |
| 95 | 95 | // Allow using {get} merge tags in shortcode attributes |
| 96 | 96 | $passed_value = GravityView_Merge_Tags::replace_get_variables( $passed_value ); |
| 97 | 97 | |
| 98 | - switch( $defaults[ $key ]['type'] ) { |
|
| 98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 104 | 104 | */ |
| 105 | 105 | case 'number': |
| 106 | - if( is_numeric( $passed_value ) ) { |
|
| 106 | + if ( is_numeric( $passed_value ) ) { |
|
| 107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
| 108 | 108 | } |
| 109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | case 'select': |
| 120 | 120 | case 'radio': |
| 121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 123 | 123 | $atts[ $key ] = $passed_value; |
| 124 | 124 | } |
| 125 | 125 | break; |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
| 149 | 149 | $return = ''; |
| 150 | 150 | |
| 151 | - switch( $detail ) { |
|
| 151 | + switch ( $detail ) { |
|
| 152 | 152 | case 'total_entries': |
| 153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
| 154 | 154 | break; |
| 155 | 155 | case 'first_entry': |
| 156 | 156 | $paging = $gravityview_view->getPaginationCounts(); |
| 157 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['first'] ); |
|
| 157 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'first' ] ); |
|
| 158 | 158 | break; |
| 159 | 159 | case 'last_entry': |
| 160 | 160 | $paging = $gravityview_view->getPaginationCounts(); |
| 161 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['last'] ); |
|
| 161 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'last' ] ); |
|
| 162 | 162 | break; |
| 163 | 163 | case 'page_size': |
| 164 | 164 | $paging = $gravityview_view->getPaging(); |
| 165 | - $return = number_format_i18n( $paging['page_size'] ); |
|
| 165 | + $return = number_format_i18n( $paging[ 'page_size' ] ); |
|
| 166 | 166 | break; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'post_category'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
| 15 | 15 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 30 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 29 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 30 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'radio'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 15 | 15 | |