@@ -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 |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 213 | 213 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 214 | 214 | |
| 215 | - 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 ); |
|
| 215 | + 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 ); |
|
| 216 | 216 | |
| 217 | 217 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 218 | 218 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 235 | 235 | */ |
| 236 | 236 | public function register_no_conflict( $allowed ) { |
| 237 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 237 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 238 | 238 | return $allowed; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -247,24 +247,24 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public static function get_searchable_fields() { |
| 249 | 249 | |
| 250 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 250 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 251 | 251 | exit( '0' ); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $form = ''; |
| 255 | 255 | |
| 256 | 256 | // Fetch the form for the current View |
| 257 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 257 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 258 | 258 | |
| 259 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 259 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 260 | 260 | |
| 261 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 261 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 262 | 262 | |
| 263 | - $form = (int) $_POST['formid']; |
|
| 263 | + $form = (int)$_POST[ 'formid' ]; |
|
| 264 | 264 | |
| 265 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 265 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 266 | 266 | |
| 267 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 267 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 268 | 268 | |
| 269 | 269 | } |
| 270 | 270 | |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | ) |
| 310 | 310 | ); |
| 311 | 311 | |
| 312 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 313 | - $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'] ); |
|
| 312 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 313 | + $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' ] ); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // Get fields with sub-inputs and no parent |
@@ -332,13 +332,13 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | foreach ( $fields as $id => $field ) { |
| 334 | 334 | |
| 335 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 335 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 336 | 336 | continue; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 339 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 340 | 340 | |
| 341 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 341 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 361 | 361 | |
| 362 | 362 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 363 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 363 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 364 | 364 | $input_type = 'boolean'; // on/off checkbox |
| 365 | 365 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 366 | 366 | $input_type = 'multi'; //multiselect |
@@ -402,19 +402,19 @@ discard block |
||
| 402 | 402 | $post_id = 0; |
| 403 | 403 | |
| 404 | 404 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 405 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 406 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 405 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 406 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 407 | 407 | } |
| 408 | 408 | // We're in the WordPress Widget context, and the base View ID should be used |
| 409 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 410 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 409 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 410 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 414 | 414 | |
| 415 | 415 | // Add hidden fields to the search form |
| 416 | 416 | foreach ( $args as $key => $value ) { |
| 417 | - $search_fields[] = array( |
|
| 417 | + $search_fields[ ] = array( |
|
| 418 | 418 | 'name' => $key, |
| 419 | 419 | 'input' => 'hidden', |
| 420 | 420 | 'value' => $value, |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | public function filter_entries( $search_criteria ) { |
| 437 | 437 | |
| 438 | - if( 'post' === $this->search_method ) { |
|
| 438 | + if ( 'post' === $this->search_method ) { |
|
| 439 | 439 | $get = $_POST; |
| 440 | 440 | } else { |
| 441 | 441 | $get = $_GET; |
@@ -452,15 +452,15 @@ discard block |
||
| 452 | 452 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 453 | 453 | |
| 454 | 454 | // add free search |
| 455 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 455 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 456 | 456 | |
| 457 | 457 | // Search for a piece |
| 458 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 458 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 459 | 459 | |
| 460 | 460 | $words = array_filter( $words ); |
| 461 | 461 | |
| 462 | 462 | foreach ( $words as $word ) { |
| 463 | - $search_criteria['field_filters'][] = array( |
|
| 463 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 464 | 464 | 'key' => null, // The field ID to search |
| 465 | 465 | 'value' => $word, // The value to search |
| 466 | 466 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | //start date & end date |
| 472 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 473 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 472 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 473 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 474 | 474 | |
| 475 | 475 | /** |
| 476 | 476 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -485,16 +485,16 @@ discard block |
||
| 485 | 485 | /** |
| 486 | 486 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 487 | 487 | */ |
| 488 | - if( !empty( $curr_start ) ) { |
|
| 489 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 488 | + if ( ! empty( $curr_start ) ) { |
|
| 489 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 490 | 490 | } |
| 491 | - if( !empty( $curr_end ) ) { |
|
| 492 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 491 | + if ( ! empty( $curr_end ) ) { |
|
| 492 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // search for a specific entry ID |
| 496 | 496 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 497 | - $search_criteria['field_filters'][] = array( |
|
| 497 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 498 | 498 | 'key' => 'id', |
| 499 | 499 | 'value' => absint( $get[ 'gv_id' ] ), |
| 500 | 500 | 'operator' => '=', |
@@ -503,36 +503,36 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | // search for a specific Created_by ID |
| 505 | 505 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 506 | - $search_criteria['field_filters'][] = array( |
|
| 506 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 507 | 507 | 'key' => 'created_by', |
| 508 | - 'value' => absint( $get['gv_by'] ), |
|
| 508 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 509 | 509 | 'operator' => '=', |
| 510 | 510 | ); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
| 514 | 514 | // Get search mode passed in URL |
| 515 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 515 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 516 | 516 | |
| 517 | 517 | // get the other search filters |
| 518 | 518 | foreach ( $get as $key => $value ) { |
| 519 | 519 | |
| 520 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 520 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 521 | 521 | continue; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | // could return simple filter or multiple filters |
| 525 | 525 | $filter = $this->prepare_field_filter( $key, $value ); |
| 526 | 526 | |
| 527 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 528 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 527 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 528 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 529 | 529 | |
| 530 | 530 | // if date range type, set search mode to ALL |
| 531 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 531 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 532 | 532 | $mode = 'all'; |
| 533 | 533 | } |
| 534 | - } elseif( !empty( $filter ) ) { |
|
| 535 | - $search_criteria['field_filters'][] = $filter; |
|
| 534 | + } elseif ( ! empty( $filter ) ) { |
|
| 535 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | * @since 1.5.1 |
| 542 | 542 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 543 | 543 | */ |
| 544 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 544 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 545 | 545 | |
| 546 | 546 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 547 | 547 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | $field_id = str_replace( 'filter_', '', $key ); |
| 568 | 568 | |
| 569 | 569 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 570 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 570 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 571 | 571 | $field_id = str_replace( '_', '.', $field_id ); |
| 572 | 572 | } |
| 573 | 573 | |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | 'value' => $value, |
| 582 | 582 | ); |
| 583 | 583 | |
| 584 | - switch ( $form_field['type'] ) { |
|
| 584 | + switch ( $form_field[ 'type' ] ) { |
|
| 585 | 585 | |
| 586 | 586 | case 'select': |
| 587 | 587 | case 'radio': |
| 588 | - $filter['operator'] = 'is'; |
|
| 588 | + $filter[ 'operator' ] = 'is'; |
|
| 589 | 589 | break; |
| 590 | 590 | |
| 591 | 591 | case 'post_category': |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | foreach ( $value as $val ) { |
| 601 | 601 | $cat = get_term( $val, 'category' ); |
| 602 | - $filter[] = array( |
|
| 602 | + $filter[ ] = array( |
|
| 603 | 603 | 'key' => $field_id, |
| 604 | 604 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 605 | 605 | 'operator' => 'is', |
@@ -618,18 +618,18 @@ discard block |
||
| 618 | 618 | $filter = array(); |
| 619 | 619 | |
| 620 | 620 | foreach ( $value as $val ) { |
| 621 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 621 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | break; |
| 625 | 625 | |
| 626 | 626 | case 'checkbox': |
| 627 | 627 | // convert checkbox on/off into the correct search filter |
| 628 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 629 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 630 | - if ( $input['id'] == $field_id ) { |
|
| 631 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 632 | - $filter['operator'] = 'is'; |
|
| 628 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 629 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 630 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 631 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 632 | + $filter[ 'operator' ] = 'is'; |
|
| 633 | 633 | break; |
| 634 | 634 | } |
| 635 | 635 | } |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $filter = array(); |
| 640 | 640 | |
| 641 | 641 | foreach ( $value as $val ) { |
| 642 | - $filter[] = array( |
|
| 642 | + $filter[ ] = array( |
|
| 643 | 643 | 'key' => $field_id, |
| 644 | 644 | 'value' => $val, |
| 645 | 645 | 'operator' => 'is', |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | foreach ( $words as $word ) { |
| 661 | 661 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 662 | 662 | // Keep the same key for each filter |
| 663 | - $filter['value'] = $word; |
|
| 663 | + $filter[ 'value' ] = $word; |
|
| 664 | 664 | // Add a search for the value |
| 665 | - $filters[] = $filter; |
|
| 665 | + $filters[ ] = $filter; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -689,19 +689,19 @@ discard block |
||
| 689 | 689 | * @since 1.16.3 |
| 690 | 690 | * Safeguard until GF implements '<=' operator |
| 691 | 691 | */ |
| 692 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 692 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 693 | 693 | $operator = '<'; |
| 694 | 694 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $filter[] = array( |
|
| 697 | + $filter[ ] = array( |
|
| 698 | 698 | 'key' => $field_id, |
| 699 | 699 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 700 | 700 | 'operator' => $operator, |
| 701 | 701 | ); |
| 702 | 702 | } |
| 703 | 703 | } else { |
| 704 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 704 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | break; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | 'ymd_dot' => 'Y.m.d', |
| 733 | 733 | ); |
| 734 | 734 | |
| 735 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 735 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 736 | 736 | $format = $datepicker[ $field->dateFormat ]; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | public function add_template_path( $file_paths ) { |
| 764 | 764 | |
| 765 | 765 | // Index 100 is the default GravityView template path. |
| 766 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 766 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 767 | 767 | |
| 768 | 768 | return $file_paths; |
| 769 | 769 | } |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $has_date = false; |
| 783 | 783 | |
| 784 | 784 | foreach ( $search_fields as $k => $field ) { |
| 785 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 785 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 786 | 786 | $has_date = true; |
| 787 | 787 | break; |
| 788 | 788 | } |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // get configured search fields |
| 812 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 812 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 813 | 813 | |
| 814 | 814 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 815 | 815 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -824,34 +824,34 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 826 | 826 | |
| 827 | - switch ( $field['field'] ) { |
|
| 827 | + switch ( $field[ 'field' ] ) { |
|
| 828 | 828 | |
| 829 | 829 | case 'search_all': |
| 830 | - $updated_field['key'] = 'search_all'; |
|
| 831 | - $updated_field['input'] = 'search_all'; |
|
| 832 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 830 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 831 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 832 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 833 | 833 | break; |
| 834 | 834 | |
| 835 | 835 | case 'entry_date': |
| 836 | - $updated_field['key'] = 'entry_date'; |
|
| 837 | - $updated_field['input'] = 'entry_date'; |
|
| 838 | - $updated_field['value'] = array( |
|
| 836 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 837 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 838 | + $updated_field[ 'value' ] = array( |
|
| 839 | 839 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 840 | 840 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 841 | 841 | ); |
| 842 | 842 | break; |
| 843 | 843 | |
| 844 | 844 | case 'entry_id': |
| 845 | - $updated_field['key'] = 'entry_id'; |
|
| 846 | - $updated_field['input'] = 'entry_id'; |
|
| 847 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 845 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 846 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 847 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 848 | 848 | break; |
| 849 | 849 | |
| 850 | 850 | case 'created_by': |
| 851 | - $updated_field['key'] = 'created_by'; |
|
| 852 | - $updated_field['name'] = 'gv_by'; |
|
| 853 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 854 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 851 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 852 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 853 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 854 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 855 | 855 | break; |
| 856 | 856 | } |
| 857 | 857 | |
@@ -869,16 +869,16 @@ discard block |
||
| 869 | 869 | */ |
| 870 | 870 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 871 | 871 | |
| 872 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 872 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 873 | 873 | |
| 874 | 874 | /** @since 1.14 */ |
| 875 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 875 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 876 | 876 | |
| 877 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 877 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 878 | 878 | |
| 879 | 879 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 880 | 880 | |
| 881 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 881 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 882 | 882 | |
| 883 | 883 | if ( $this->has_date_field( $search_fields ) ) { |
| 884 | 884 | // enqueue datepicker stuff only if needed! |
@@ -900,10 +900,10 @@ discard block |
||
| 900 | 900 | public static function get_search_class( $custom_class = '' ) { |
| 901 | 901 | $gravityview_view = GravityView_View::getInstance(); |
| 902 | 902 | |
| 903 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 903 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 904 | 904 | |
| 905 | - if ( ! empty( $custom_class ) ) { |
|
| 906 | - $search_class .= ' '.$custom_class; |
|
| 905 | + if ( ! empty( $custom_class ) ) { |
|
| 906 | + $search_class .= ' ' . $custom_class; |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -945,11 +945,11 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | $label = rgget( 'label', $field ); |
| 947 | 947 | |
| 948 | - if( '' === $label ) { |
|
| 948 | + if ( '' === $label ) { |
|
| 949 | 949 | |
| 950 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 950 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 951 | 951 | |
| 952 | - switch( $field['field'] ) { |
|
| 952 | + switch ( $field[ 'field' ] ) { |
|
| 953 | 953 | case 'search_all': |
| 954 | 954 | $label = __( 'Search Entries:', 'gravityview' ); |
| 955 | 955 | break; |
@@ -961,10 +961,10 @@ discard block |
||
| 961 | 961 | break; |
| 962 | 962 | default: |
| 963 | 963 | // If this is a field input, not a field |
| 964 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 964 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 965 | 965 | |
| 966 | 966 | // Get the label for the field in question, which returns an array |
| 967 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 967 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 968 | 968 | |
| 969 | 969 | // Get the item with the `label` key |
| 970 | 970 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1003,32 +1003,32 @@ discard block |
||
| 1003 | 1003 | $form = $gravityview_view->getForm(); |
| 1004 | 1004 | |
| 1005 | 1005 | // for advanced field ids (eg, first name / last name ) |
| 1006 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1006 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1007 | 1007 | |
| 1008 | 1008 | // get searched value from $_GET/$_POST (string or array) |
| 1009 | 1009 | $value = $this->rgget_or_rgpost( $name ); |
| 1010 | 1010 | |
| 1011 | 1011 | // get form field details |
| 1012 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1012 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1013 | 1013 | |
| 1014 | 1014 | $filter = array( |
| 1015 | - 'key' => $field['field'], |
|
| 1015 | + 'key' => $field[ 'field' ], |
|
| 1016 | 1016 | 'name' => $name, |
| 1017 | 1017 | 'label' => self::get_field_label( $field, $form_field ), |
| 1018 | - 'input' => $field['input'], |
|
| 1018 | + 'input' => $field[ 'input' ], |
|
| 1019 | 1019 | 'value' => $value, |
| 1020 | - 'type' => $form_field['type'], |
|
| 1020 | + 'type' => $form_field[ 'type' ], |
|
| 1021 | 1021 | ); |
| 1022 | 1022 | |
| 1023 | 1023 | // collect choices |
| 1024 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1025 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1026 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1027 | - $filter['choices'] = $form_field['choices']; |
|
| 1024 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1025 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1026 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1027 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1031 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1030 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1031 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | return $filter; |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | $choices = array(); |
| 1054 | 1054 | foreach ( $users as $user ) { |
| 1055 | - $choices[] = array( |
|
| 1055 | + $choices[ ] = array( |
|
| 1056 | 1056 | 'value' => $user->ID, |
| 1057 | 1057 | 'text' => $user->display_name, |
| 1058 | 1058 | ); |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | */ |
| 1108 | 1108 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1109 | 1109 | |
| 1110 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1110 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1111 | 1111 | |
| 1112 | 1112 | return $js_dependencies; |
| 1113 | 1113 | } |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | 'isRTL' => is_rtl(), |
| 1152 | 1152 | ), $view_data ); |
| 1153 | 1153 | |
| 1154 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1154 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1155 | 1155 | |
| 1156 | 1156 | return $localizations; |
| 1157 | 1157 | |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * @return void |
| 1181 | 1181 | */ |
| 1182 | 1182 | private function maybe_enqueue_flexibility() { |
| 1183 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1183 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1184 | 1184 | wp_enqueue_script( 'gv-flexibility' ); |
| 1185 | 1185 | } |
| 1186 | 1186 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1203 | 1203 | |
| 1204 | 1204 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1205 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1205 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1206 | 1206 | |
| 1207 | 1207 | /** |
| 1208 | 1208 | * @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 | /** |
@@ -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 |
@@ -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 | |
@@ -301,6 +301,7 @@ |
||
| 301 | 301 | * Make protected public |
| 302 | 302 | * @inheritDoc |
| 303 | 303 | * @access public |
| 304 | + * @param string $setting_name |
|
| 304 | 305 | */ |
| 305 | 306 | public function get_app_setting( $setting_name ) { |
| 306 | 307 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! class_exists('GFAddOn') ) { |
|
| 3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
| 4 | 4 | return; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
| 77 | 77 | |
| 78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
| 78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
| 79 | 79 | return parent::__construct(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self( 'get_instance' ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function current_user_can_any( $caps ) { |
| 108 | 108 | |
| 109 | - if( empty( $caps ) ) { |
|
| 109 | + if ( empty( $caps ) ) { |
|
| 110 | 110 | $caps = array( 'gravityview_full_access' ); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ), |
| 161 | 161 | 'found-other' => array( |
| 162 | 162 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
| 163 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 163 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
| 164 | 164 | ), |
| 165 | 165 | 'other' => array( |
| 166 | 166 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | }); |
| 248 | 248 | |
| 249 | 249 | function gv_feedback_append_error_message() { |
| 250 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 250 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 251 | 251 | } |
| 252 | 252 | }); |
| 253 | 253 | </script> |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | </ul> |
| 265 | 265 | <div class="gv-followup widefat"> |
| 266 | 266 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
| 267 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
| 267 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
| 268 | 268 | </div> |
| 269 | 269 | <div class="scale-description"> |
| 270 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 270 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 271 | 271 | <ul class="inline"> |
| 272 | 272 | <?php |
| 273 | 273 | $i = 0; |
| 274 | - while( $i < 11 ) { |
|
| 275 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
| 274 | + while ( $i < 11 ) { |
|
| 275 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
| 276 | 276 | $i++; |
| 277 | 277 | } |
| 278 | 278 | ?> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | </div> |
| 282 | 282 | |
| 283 | 283 | <div class="gv-form-field-wrapper"> |
| 284 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
| 284 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
| 285 | 285 | </div> |
| 286 | 286 | |
| 287 | 287 | <div class="submit"> |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
| 296 | 296 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
| 297 | 297 | <p><?php echo gravityview_get_floaty(); ?> |
| 298 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 298 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 299 | 299 | </p> |
| 300 | 300 | <div class="wp-clearfix"></div> |
| 301 | 301 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
| 370 | 370 | |
| 371 | 371 | /** @since 1.7.6 */ |
| 372 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 372 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 373 | 373 | |
| 374 | 374 | parent::init_admin(); |
| 375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 385 | 385 | |
| 386 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
| 386 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 387 | 387 | |
| 388 | 388 | return $setting_tabs; |
| 389 | 389 | } |
@@ -400,11 +400,11 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | private function _load_license_handler() { |
| 402 | 402 | |
| 403 | - if( !empty( $this->License_Handler ) ) { |
|
| 403 | + if ( ! empty( $this->License_Handler ) ) { |
|
| 404 | 404 | return; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
| 407 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
| 408 | 408 | |
| 409 | 409 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
| 410 | 410 | } |
@@ -416,42 +416,42 @@ discard block |
||
| 416 | 416 | function license_key_notice() { |
| 417 | 417 | |
| 418 | 418 | // Only show on GravityView pages |
| 419 | - if( ! gravityview_is_admin_page() ) { |
|
| 419 | + if ( ! gravityview_is_admin_page() ) { |
|
| 420 | 420 | return; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - $license_status = self::getSetting('license_key_status'); |
|
| 424 | - $license_key = self::getSetting('license_key'); |
|
| 425 | - if( '' === $license_key ) { |
|
| 423 | + $license_status = self::getSetting( 'license_key_status' ); |
|
| 424 | + $license_key = self::getSetting( 'license_key' ); |
|
| 425 | + if ( '' === $license_key ) { |
|
| 426 | 426 | $license_status = 'inactive'; |
| 427 | 427 | } |
| 428 | 428 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 429 | 429 | |
| 430 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
| 430 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 431 | 431 | |
| 432 | 432 | /** |
| 433 | 433 | * I wanted to remove the period from after the buttons in the string, |
| 434 | 434 | * but didn't want to mess up the translation strings for the translators. |
| 435 | 435 | */ |
| 436 | 436 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
| 437 | - $title = __('Inactive License', 'gravityview'); |
|
| 437 | + $title = __( 'Inactive License', 'gravityview' ); |
|
| 438 | 438 | $status = ''; |
| 439 | 439 | $update_below = false; |
| 440 | 440 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
| 441 | 441 | switch ( $license_status ) { |
| 442 | 442 | /** @since 1.17 */ |
| 443 | 443 | case 'expired': |
| 444 | - $title = __('Expired License', 'gravityview'); |
|
| 444 | + $title = __( 'Expired License', 'gravityview' ); |
|
| 445 | 445 | $status = 'expired'; |
| 446 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
| 446 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
| 447 | 447 | break; |
| 448 | 448 | case 'invalid': |
| 449 | - $title = __('Invalid License', 'gravityview'); |
|
| 450 | - $status = __('is invalid', 'gravityview'); |
|
| 449 | + $title = __( 'Invalid License', 'gravityview' ); |
|
| 450 | + $status = __( 'is invalid', 'gravityview' ); |
|
| 451 | 451 | break; |
| 452 | 452 | case 'deactivated': |
| 453 | - $status = __('is inactive', 'gravityview'); |
|
| 454 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 453 | + $status = __( 'is inactive', 'gravityview' ); |
|
| 454 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 455 | 455 | break; |
| 456 | 456 | /** @noinspection PhpMissingBreakStatementInspection */ |
| 457 | 457 | case '': |
@@ -459,27 +459,27 @@ discard block |
||
| 459 | 459 | // break intentionally left blank |
| 460 | 460 | case 'inactive': |
| 461 | 461 | case 'site_inactive': |
| 462 | - $status = __('has not been activated', 'gravityview'); |
|
| 463 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 462 | + $status = __( 'has not been activated', 'gravityview' ); |
|
| 463 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 464 | 464 | break; |
| 465 | 465 | } |
| 466 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
| 466 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
| 467 | 467 | |
| 468 | 468 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
| 469 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 469 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 470 | 470 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
| 471 | 471 | } else { |
| 472 | 472 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - if( !empty( $status ) ) { |
|
| 475 | + if ( ! empty( $status ) ) { |
|
| 476 | 476 | GravityView_Admin_Notices::add_notice( array( |
| 477 | 477 | 'message' => $message, |
| 478 | 478 | 'class' => 'updated', |
| 479 | 479 | 'title' => $title, |
| 480 | 480 | 'cap' => 'gravityview_edit_settings', |
| 481 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
| 482 | - )); |
|
| 481 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
| 482 | + ) ); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | $styles = parent::styles(); |
| 493 | 493 | |
| 494 | - $styles[] = array( |
|
| 494 | + $styles[ ] = array( |
|
| 495 | 495 | 'handle' => 'gravityview_settings', |
| 496 | 496 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 497 | 497 | 'version' => GravityView_Plugin::version, |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * @return void |
| 515 | 515 | */ |
| 516 | 516 | public function add_network_menu() { |
| 517 | - if( GravityView_Plugin::is_network_activated() ) { |
|
| 517 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
| 518 | 518 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
| 519 | 519 | } |
| 520 | 520 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | * If multisite and not network admin, we don't want the settings to show. |
| 532 | 532 | * @since 1.7.6 |
| 533 | 533 | */ |
| 534 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 534 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 535 | 535 | |
| 536 | 536 | /** |
| 537 | 537 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
| 542 | 542 | |
| 543 | - if( $show_submenu ) { |
|
| 543 | + if ( $show_submenu ) { |
|
| 544 | 544 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | /** |
| 580 | 580 | * Backward compatibility with Redux |
| 581 | 581 | */ |
| 582 | - if( $setting_name === 'license' ) { |
|
| 582 | + if ( $setting_name === 'license' ) { |
|
| 583 | 583 | return array( |
| 584 | 584 | 'license' => parent::get_app_setting( 'license_key' ), |
| 585 | 585 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | $return = $text . $activation; |
| 645 | 645 | |
| 646 | - if( $echo ) { |
|
| 646 | + if ( $echo ) { |
|
| 647 | 647 | echo $return; |
| 648 | 648 | } |
| 649 | 649 | |
@@ -670,15 +670,15 @@ discard block |
||
| 670 | 670 | */ |
| 671 | 671 | public function settings_submit( $field, $echo = true ) { |
| 672 | 672 | |
| 673 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
| 673 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 674 | 674 | |
| 675 | 675 | $attributes = $this->get_field_attributes( $field ); |
| 676 | 676 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
| 677 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
| 677 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
| 678 | 678 | |
| 679 | 679 | |
| 680 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
| 681 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
| 680 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
| 681 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 682 | 682 | |
| 683 | 683 | if ( empty( $value ) ) { |
| 684 | 684 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $attributes = $this->get_field_attributes( $field ); |
| 688 | 688 | |
| 689 | 689 | $html = '<input |
| 690 | - type="' . $field['type'] . '" |
|
| 690 | + type="' . $field[ 'type' ] . '" |
|
| 691 | 691 | name="' . esc_attr( $name ) . '" |
| 692 | 692 | value="' . $value . '" ' . |
| 693 | 693 | implode( ' ', $attributes ) . |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | * @return string |
| 710 | 710 | */ |
| 711 | 711 | public function settings_save( $field, $echo = true ) { |
| 712 | - $field['type'] = 'submit'; |
|
| 713 | - $field['name'] = 'gform-settings-save'; |
|
| 714 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
| 712 | + $field[ 'type' ] = 'submit'; |
|
| 713 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 714 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
| 715 | 715 | |
| 716 | 716 | if ( ! rgar( $field, 'value' ) ) { |
| 717 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
| 717 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | $output = $this->settings_submit( $field, false ); |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $this->app_settings_uninstall_tab(); |
| 724 | 724 | $output .= ob_get_clean(); |
| 725 | 725 | |
| 726 | - if( $echo ) { |
|
| 726 | + if ( $echo ) { |
|
| 727 | 727 | echo $output; |
| 728 | 728 | } |
| 729 | 729 | |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | parent::single_setting_label( $field ); |
| 742 | 742 | |
| 743 | 743 | // Added by GravityView |
| 744 | - if ( isset( $field['description'] ) ) { |
|
| 745 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
| 744 | + if ( isset( $field[ 'description' ] ) ) { |
|
| 745 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | } |
@@ -804,11 +804,11 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
| 806 | 806 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 807 | - if( $local_key !== $response_key ) { |
|
| 807 | + if ( $local_key !== $response_key ) { |
|
| 808 | 808 | |
| 809 | - unset( $posted_settings['license_key_response'] ); |
|
| 810 | - unset( $posted_settings['license_key_status'] ); |
|
| 811 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 809 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 810 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 811 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | return $posted_settings; |
@@ -843,25 +843,25 @@ discard block |
||
| 843 | 843 | 'label' => __( 'License Key', 'gravityview' ), |
| 844 | 844 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
| 845 | 845 | 'type' => 'edd_license', |
| 846 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
| 847 | - 'default_value' => $default_settings['license_key'], |
|
| 846 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
| 847 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 848 | 848 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 849 | 849 | ), |
| 850 | 850 | array( |
| 851 | 851 | 'name' => 'license_key_response', |
| 852 | - 'default_value' => $default_settings['license_key_response'], |
|
| 852 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 853 | 853 | 'type' => 'hidden', |
| 854 | 854 | ), |
| 855 | 855 | array( |
| 856 | 856 | 'name' => 'license_key_status', |
| 857 | - 'default_value' => $default_settings['license_key_status'], |
|
| 857 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 858 | 858 | 'type' => 'hidden', |
| 859 | 859 | ), |
| 860 | 860 | array( |
| 861 | 861 | 'name' => 'support-email', |
| 862 | 862 | 'type' => 'text', |
| 863 | 863 | 'validate' => 'email', |
| 864 | - 'default_value' => $default_settings['support-email'], |
|
| 864 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 865 | 865 | 'label' => __( 'Support Email', 'gravityview' ), |
| 866 | 866 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 867 | 867 | 'class' => 'code regular-text', |
@@ -873,38 +873,38 @@ discard block |
||
| 873 | 873 | 'name' => 'support_port', |
| 874 | 874 | 'type' => 'radio', |
| 875 | 875 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 876 | - 'default_value' => $default_settings['support_port'], |
|
| 876 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 877 | 877 | 'horizontal' => 1, |
| 878 | 878 | 'choices' => array( |
| 879 | 879 | array( |
| 880 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
| 880 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
| 881 | 881 | 'value' => '1', |
| 882 | 882 | ), |
| 883 | 883 | array( |
| 884 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
| 884 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
| 885 | 885 | 'value' => '0', |
| 886 | 886 | ), |
| 887 | 887 | ), |
| 888 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
| 888 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
| 889 | 889 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
| 890 | 890 | ), |
| 891 | 891 | array( |
| 892 | 892 | 'name' => 'no-conflict-mode', |
| 893 | 893 | 'type' => 'radio', |
| 894 | 894 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 895 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 895 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 896 | 896 | 'horizontal' => 1, |
| 897 | 897 | 'choices' => array( |
| 898 | 898 | array( |
| 899 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
| 899 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
| 900 | 900 | 'value' => '1', |
| 901 | 901 | ), |
| 902 | 902 | array( |
| 903 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
| 903 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
| 904 | 904 | 'value' => '0', |
| 905 | 905 | ), |
| 906 | 906 | ), |
| 907 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
| 907 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
| 908 | 908 | ), |
| 909 | 909 | ) ); |
| 910 | 910 | |
@@ -915,20 +915,20 @@ discard block |
||
| 915 | 915 | * @since 1.7.4 |
| 916 | 916 | */ |
| 917 | 917 | foreach ( $fields as &$field ) { |
| 918 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
| 919 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
| 920 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
| 921 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
| 918 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
| 919 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
| 920 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
| 921 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
| 922 | 922 | |
| 923 | - if( $disabled_attribute ) { |
|
| 924 | - $field['disabled'] = $disabled_attribute; |
|
| 923 | + if ( $disabled_attribute ) { |
|
| 924 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 925 | 925 | } |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | |
| 929 | 929 | $sections = array( |
| 930 | 930 | array( |
| 931 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 931 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
| 932 | 932 | 'fields' => $fields, |
| 933 | 933 | ) |
| 934 | 934 | ); |
@@ -939,8 +939,8 @@ discard block |
||
| 939 | 939 | 'type' => 'save', |
| 940 | 940 | ); |
| 941 | 941 | |
| 942 | - if( $disabled_attribute ) { |
|
| 943 | - $button['disabled'] = $disabled_attribute; |
|
| 942 | + if ( $disabled_attribute ) { |
|
| 943 | + $button[ 'disabled' ] = $disabled_attribute; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | |
@@ -960,20 +960,20 @@ discard block |
||
| 960 | 960 | // If there are extensions, add a section for them |
| 961 | 961 | if ( ! empty( $extension_sections ) ) { |
| 962 | 962 | |
| 963 | - if( $disabled_attribute ) { |
|
| 963 | + if ( $disabled_attribute ) { |
|
| 964 | 964 | foreach ( $extension_sections as &$section ) { |
| 965 | - foreach ( $section['fields'] as &$field ) { |
|
| 966 | - $field['disabled'] = $disabled_attribute; |
|
| 965 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 966 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $k = count( $extension_sections ) - 1 ; |
|
| 972 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 971 | + $k = count( $extension_sections ) - 1; |
|
| 972 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
| 973 | 973 | $sections = array_merge( $sections, $extension_sections ); |
| 974 | 974 | } else { |
| 975 | 975 | // add the 'update settings' button to the general section |
| 976 | - $sections[0]['fields'][] = $button; |
|
| 976 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | return $sections; |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Uninstall all traces of GravityView |
|
| 126 | - * |
|
| 127 | - * Note: method is public because parent method is public |
|
| 128 | - * |
|
| 125 | + * Uninstall all traces of GravityView |
|
| 126 | + * |
|
| 127 | + * Note: method is public because parent method is public |
|
| 128 | + * |
|
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | 131 | public function uninstall() { |
@@ -137,53 +137,53 @@ discard block |
||
| 137 | 137 | $uninstaller->fire_everything(); |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | - * @see GFAddOn::uninstall_addon |
|
| 142 | - * @uses deactivate_plugins() |
|
| 143 | - */ |
|
| 140 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | + * @see GFAddOn::uninstall_addon |
|
| 142 | + * @uses deactivate_plugins() |
|
| 143 | + */ |
|
| 144 | 144 | $this->_path = GRAVITYVIEW_FILE; |
| 145 | 145 | |
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | - * |
|
| 152 | - * @since 1.17.5 |
|
| 153 | - * |
|
| 150 | + * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | + * |
|
| 152 | + * @since 1.17.5 |
|
| 153 | + * |
|
| 154 | 154 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
| 155 | 155 | */ |
| 156 | 156 | private function get_uninstall_reasons() { |
| 157 | 157 | |
| 158 | 158 | $reasons = array( |
| 159 | 159 | 'will-continue' => array( |
| 160 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | - ), |
|
| 160 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | + ), |
|
| 162 | 162 | 'no-longer-need' => array( |
| 163 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | - ), |
|
| 163 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | + ), |
|
| 165 | 165 | 'doesnt-work' => array( |
| 166 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | - ), |
|
| 166 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | + ), |
|
| 168 | 168 | 'found-other' => array( |
| 169 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | - ), |
|
| 169 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | + 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | + ), |
|
| 172 | 172 | 'other' => array( |
| 173 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | - ), |
|
| 173 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | + ), |
|
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | shuffle( $reasons ); |
| 178 | 178 | |
| 179 | 179 | return $reasons; |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Display a feedback form when the plugin is uninstalled |
|
| 184 | - * |
|
| 185 | - * @since 1.17.5 |
|
| 186 | - * |
|
| 183 | + * Display a feedback form when the plugin is uninstalled |
|
| 184 | + * |
|
| 185 | + * @since 1.17.5 |
|
| 186 | + * |
|
| 187 | 187 | * @return string HTML of the uninstallation form |
| 188 | 188 | */ |
| 189 | 189 | public function uninstall_form() { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
| 264 | 264 | <ul> |
| 265 | 265 | <?php |
| 266 | - $reasons = $this->get_uninstall_reasons(); |
|
| 266 | + $reasons = $this->get_uninstall_reasons(); |
|
| 267 | 267 | foreach ( $reasons as $reason ) { |
| 268 | 268 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) ); |
| 269 | 269 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $license_key = self::getSetting('license_key'); |
| 432 | 432 | if( '' === $license_key ) { |
| 433 | 433 | $license_status = 'inactive'; |
| 434 | - } |
|
| 434 | + } |
|
| 435 | 435 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 436 | 436 | |
| 437 | 437 | $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | public function app_settings_tab() { |
| 572 | - parent::app_settings_tab(); |
|
| 572 | + parent::app_settings_tab(); |
|
| 573 | 573 | |
| 574 | 574 | if ( $this->maybe_uninstall() ) { |
| 575 | - echo $this->uninstall_form(); |
|
| 575 | + echo $this->uninstall_form(); |
|
| 576 | 576 | } |
| 577 | - } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | 579 | /** |
| 580 | 580 | * Make protected public |
@@ -697,8 +697,8 @@ discard block |
||
| 697 | 697 | type="' . $field['type'] . '" |
| 698 | 698 | name="' . esc_attr( $name ) . '" |
| 699 | 699 | value="' . $value . '" ' . |
| 700 | - implode( ' ', $attributes ) . |
|
| 701 | - ' />'; |
|
| 700 | + implode( ' ', $attributes ) . |
|
| 701 | + ' />'; |
|
| 702 | 702 | |
| 703 | 703 | if ( $echo ) { |
| 704 | 704 | echo $html; |
@@ -933,36 +933,36 @@ discard block |
||
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
| 936 | - $sections = array( |
|
| 937 | - array( |
|
| 938 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 939 | - 'fields' => $fields, |
|
| 940 | - ) |
|
| 941 | - ); |
|
| 936 | + $sections = array( |
|
| 937 | + array( |
|
| 938 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 939 | + 'fields' => $fields, |
|
| 940 | + ) |
|
| 941 | + ); |
|
| 942 | 942 | |
| 943 | - // custom 'update settings' button |
|
| 944 | - $button = array( |
|
| 945 | - 'class' => 'button button-primary button-hero', |
|
| 946 | - 'type' => 'save', |
|
| 947 | - ); |
|
| 943 | + // custom 'update settings' button |
|
| 944 | + $button = array( |
|
| 945 | + 'class' => 'button button-primary button-hero', |
|
| 946 | + 'type' => 'save', |
|
| 947 | + ); |
|
| 948 | 948 | |
| 949 | 949 | if( $disabled_attribute ) { |
| 950 | 950 | $button['disabled'] = $disabled_attribute; |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | |
| 954 | - /** |
|
| 955 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 956 | - * Extensions can tap in here to insert their own section and settings. |
|
| 957 | - * <code> |
|
| 958 | - * $sections[] = array( |
|
| 959 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 960 | - * 'fields' => $settings, |
|
| 961 | - * ); |
|
| 962 | - * </code> |
|
| 963 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
| 964 | - */ |
|
| 965 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 954 | + /** |
|
| 955 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 956 | + * Extensions can tap in here to insert their own section and settings. |
|
| 957 | + * <code> |
|
| 958 | + * $sections[] = array( |
|
| 959 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 960 | + * 'fields' => $settings, |
|
| 961 | + * ); |
|
| 962 | + * </code> |
|
| 963 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
| 964 | + */ |
|
| 965 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 966 | 966 | |
| 967 | 967 | // If there are extensions, add a section for them |
| 968 | 968 | if ( ! empty( $extension_sections ) ) { |
@@ -975,13 +975,13 @@ discard block |
||
| 975 | 975 | } |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | - $k = count( $extension_sections ) - 1 ; |
|
| 979 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 978 | + $k = count( $extension_sections ) - 1 ; |
|
| 979 | + $extension_sections[ $k ]['fields'][] = $button; |
|
| 980 | 980 | $sections = array_merge( $sections, $extension_sections ); |
| 981 | 981 | } else { |
| 982 | - // add the 'update settings' button to the general section |
|
| 983 | - $sections[0]['fields'][] = $button; |
|
| 984 | - } |
|
| 982 | + // add the 'update settings' button to the general section |
|
| 983 | + $sections[0]['fields'][] = $button; |
|
| 984 | + } |
|
| 985 | 985 | |
| 986 | 986 | return $sections; |
| 987 | 987 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * Alias for get_instance() |
| 79 | 79 | * |
| 80 | - * @param $field_name |
|
| 80 | + * @param string $field_name |
|
| 81 | 81 | * |
| 82 | 82 | * @return GravityView_Field|false |
| 83 | 83 | */ |
@@ -88,7 +88,6 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Alias for get_instance() |
| 90 | 90 | * |
| 91 | - * @param string|GF_Field $field_name Gravity Forms field class or the class name type |
|
| 92 | 91 | * |
| 93 | 92 | * @return GravityView_Field |
| 94 | 93 | */ |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return GravityView_Field | bool |
| 43 | 43 | */ |
| 44 | 44 | public static function create( $properties ) { |
| 45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
| 46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
| 45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
| 46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
| 47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
| 48 | 48 | return new GravityView_Field( $properties ); |
| 49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return bool True: yes, it exists; False: nope |
| 63 | 63 | */ |
| 64 | 64 | public static function exists( $field_name ) { |
| 65 | - return isset( self::$_fields["{$field_name}"] ); |
|
| 65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
| 98 | 98 | |
| 99 | - foreach( self::$_fields as $field ) { |
|
| 100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
| 99 | + foreach ( self::$_fields as $field ) { |
|
| 100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
| 101 | 101 | return $field; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function get_all( $group = '' ) { |
| 118 | 118 | |
| 119 | - if( '' !== $group ) { |
|
| 119 | + if ( '' !== $group ) { |
|
| 120 | 120 | $return_fields = self::$_fields; |
| 121 | 121 | foreach ( $return_fields as $key => $field ) { |
| 122 | - if( $group !== $field->group ) { |
|
| 122 | + if ( $group !== $field->group ) { |
|
| 123 | 123 | unset( $return_fields[ $key ] ); |
| 124 | 124 | } |
| 125 | 125 | } |