@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
55 | 55 | |
56 | - if( 'field' === $field_type ) { |
|
56 | + if ( 'field' === $field_type ) { |
|
57 | 57 | |
58 | 58 | // Default options - fields |
59 | 59 | $field_options = array( |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | ); |
106 | 106 | |
107 | 107 | // Match Table as well as DataTables |
108 | - if( $is_table_layout && 'directory' === $context ) { |
|
109 | - $field_options['width'] = array( |
|
108 | + if ( $is_table_layout && 'directory' === $context ) { |
|
109 | + $field_options[ 'width' ] = array( |
|
110 | 110 | 'type' => 'number', |
111 | - 'label' => __('Percent Width', 'gravityview'), |
|
112 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
111 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
112 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
113 | 113 | 'class' => 'code widefat', |
114 | 114 | 'value' => '', |
115 | 115 | 'priority' => 200, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. |
123 | 123 | foreach ( $field_options as $key => $field_option ) { |
124 | - $field_options[ $key ]['label'] = trim( $field_options[ $key ]['label'], ':' ); |
|
124 | + $field_options[ $key ][ 'label' ] = trim( $field_options[ $key ][ 'label' ], ':' ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
148 | 148 | |
149 | - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) && ! isset( $field_options['new_window'] ) ) { |
|
150 | - $field_options['new_window'] = array( |
|
149 | + if ( 'directory' === $context && isset( $field_options[ 'show_as_link' ] ) && ! isset( $field_options[ 'new_window' ] ) ) { |
|
150 | + $field_options[ 'new_window' ] = array( |
|
151 | 151 | 'type' => 'checkbox', |
152 | 152 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
153 | 153 | 'value' => false, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | switch ( $key ) { |
169 | 169 | case 'show_as_link': |
170 | 170 | $_group = 'display'; |
171 | - $field_option['priority'] = 100; |
|
171 | + $field_option[ 'priority' ] = 100; |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | $_group = \GV\Utils::get( $field_option, 'group', 'display' ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $field_options = array(); |
186 | - foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
186 | + foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
187 | 187 | $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); |
188 | 188 | } |
189 | 189 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return 0; |
215 | 215 | } |
216 | 216 | |
217 | - return ( $a_priority < $b_priority ) ? - 1 : 1; |
|
217 | + return ( $a_priority < $b_priority ) ? -1 : 1; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
240 | 240 | ); |
241 | 241 | |
242 | - if( is_multisite() ) { |
|
243 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
242 | + if ( is_multisite() ) { |
|
243 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
254 | 254 | * @param string $input_type Optional. (textarea, list, select, etc.) |
255 | 255 | */ |
256 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
256 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
257 | 257 | |
258 | 258 | return $select_cap_choices; |
259 | 259 | } |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
282 | 282 | |
283 | - if( empty( $uniqid ) ) { |
|
283 | + if ( empty( $uniqid ) ) { |
|
284 | 284 | //generate a unique field id |
285 | - $uniqid = uniqid('', false); |
|
285 | + $uniqid = uniqid( '', false ); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $grouped = ( 'field' === $field_type ); |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | // get field/widget options |
291 | 291 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
292 | 292 | |
293 | - if( ! $grouped ) { |
|
293 | + if ( ! $grouped ) { |
|
294 | 294 | $option_groups = array( $option_groups ); |
295 | 295 | } |
296 | 296 | |
297 | 297 | $option_groups = array_filter( $option_groups ); |
298 | 298 | |
299 | 299 | // two different post arrays, depending of the field type |
300 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
300 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
301 | 301 | |
302 | 302 | // build output |
303 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
304 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
303 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
304 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
305 | 305 | |
306 | 306 | $form_title = ''; |
307 | 307 | if ( $form_id ) { |
308 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
308 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
309 | 309 | $form = GVCommon::get_form( $form_id ); |
310 | - $form_title = $form['title']; |
|
310 | + $form_title = $form[ 'title' ]; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | // If there are no options, return what we got. |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
316 | 316 | } |
317 | 317 | |
318 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
318 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
319 | 319 | |
320 | 320 | $field_details = ''; |
321 | 321 | |
322 | 322 | // Get the pretty name for the input type |
323 | 323 | $gv_field = GravityView_Fields::get( $input_type ); |
324 | 324 | |
325 | - if( $gv_field ) { |
|
325 | + if ( $gv_field ) { |
|
326 | 326 | $input_type_label = $gv_field->label; |
327 | 327 | } else { |
328 | 328 | $input_type_label = $input_type; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | if ( $grouped ) { |
339 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
339 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
340 | 340 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
341 | 341 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
342 | 342 | } |
@@ -353,15 +353,15 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | $show_if = ''; |
356 | - if ( ! empty( $option['requires'] ) ) { |
|
357 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
356 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
357 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( ! empty( $option['requires_not'] ) ) { |
|
361 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
360 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
361 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
362 | 362 | } |
363 | 363 | |
364 | - switch ( $option['type'] ) { |
|
364 | + switch ( $option[ 'type' ] ) { |
|
365 | 365 | // Hide hidden fields |
366 | 366 | case 'hidden': |
367 | 367 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -379,30 +379,30 @@ discard block |
||
379 | 379 | $item_details = ''; |
380 | 380 | $subtitle = ''; |
381 | 381 | |
382 | - if( 'field' === $field_type ) { |
|
383 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
382 | + if ( 'field' === $field_type ) { |
|
383 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
384 | 384 | |
385 | 385 | $item_details .= ' |
386 | 386 | <div class="gv-field-details--container"> |
387 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label> |
|
387 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label> |
|
388 | 388 | <section class="gv-field-details gv-field-details--closed">'; |
389 | 389 | |
390 | 390 | if ( $field_id && is_numeric( $field_id ) ) { |
391 | 391 | $item_details .= ' |
392 | 392 | <div class="gv-field-detail gv-field-detail--field"> |
393 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
393 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
394 | 394 | </div>'; |
395 | 395 | } |
396 | 396 | |
397 | 397 | $item_details .= ' |
398 | 398 | <div class="gv-field-detail gv-field-detail--type"> |
399 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
399 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
400 | 400 | </div>'; |
401 | 401 | |
402 | - if( $form_id ) { |
|
402 | + if ( $form_id ) { |
|
403 | 403 | $item_details .= ' |
404 | 404 | <div class="gv-field-detail gv-field-detail--form"> |
405 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
405 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
406 | 406 | </div>'; |
407 | 407 | } |
408 | 408 | $item_details .= ' |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | </div>'; |
411 | 411 | } else { |
412 | 412 | $widget_details_content = rgar( $item, 'description', '' ); |
413 | - if ( ! empty( $item['subtitle'] ) ) { |
|
414 | - $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item['subtitle'] : $item['subtitle']; |
|
413 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
414 | + $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item[ 'subtitle' ] : $item[ 'subtitle' ]; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | // Intentionally not escaping to allow HTML. |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | * @deprecated setting index 'default' was replaced by 'value' |
468 | 468 | * @see GravityView_FieldType::get_field_defaults |
469 | 469 | */ |
470 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
471 | - $option['value'] = $option['default']; |
|
472 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
470 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
471 | + $option[ 'value' ] = $option[ 'default' ]; |
|
472 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | // prepare to render option field type |
476 | - if( isset( $option['type'] ) ) { |
|
476 | + if ( isset( $option[ 'type' ] ) ) { |
|
477 | 477 | |
478 | 478 | $type_class = self::load_type_class( $option ); |
479 | 479 | |
480 | - if( class_exists( $type_class ) ) { |
|
480 | + if ( class_exists( $type_class ) ) { |
|
481 | 481 | |
482 | 482 | /** @type GravityView_FieldType $render_type */ |
483 | 483 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @param[in,out] string $output field class name |
495 | 495 | * @param[in] array $option option field data |
496 | 496 | */ |
497 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
497 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | } // isset option[type] |
@@ -529,27 +529,27 @@ discard block |
||
529 | 529 | * @deprecated setting index 'name' was replaced by 'label' |
530 | 530 | * @see GravityView_FieldType::get_field_defaults |
531 | 531 | */ |
532 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
533 | - $setting['label'] = $setting['name']; |
|
534 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
532 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
533 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
534 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | $name = esc_attr( sprintf( $name, $key ) ); |
538 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
539 | - $setting['tooltip'] = 'gv_' . $key; |
|
538 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
539 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
540 | 540 | |
541 | 541 | // Use default if current setting isn't set. |
542 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
542 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
543 | 543 | |
544 | 544 | // default setting type = text |
545 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
545 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
546 | 546 | |
547 | 547 | // merge tags |
548 | - if( !isset( $setting['merge_tags'] ) ) { |
|
549 | - if( $setting['type'] === 'text' ) { |
|
550 | - $setting['merge_tags'] = true; |
|
548 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
549 | + if ( $setting[ 'type' ] === 'text' ) { |
|
550 | + $setting[ 'merge_tags' ] = true; |
|
551 | 551 | } else { |
552 | - $setting['merge_tags'] = false; |
|
552 | + $setting[ 'merge_tags' ] = false; |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // render the setting |
559 | 559 | $type_class = self::load_type_class( $setting ); |
560 | - if( class_exists( $type_class ) ) { |
|
560 | + if ( class_exists( $type_class ) ) { |
|
561 | 561 | /** @type GravityView_FieldType $render_type */ |
562 | 562 | $render_type = new $type_class( $name, $setting, $curr_value ); |
563 | 563 | ob_start(); |
@@ -566,25 +566,25 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | // Check if setting is specific for a template |
569 | - if( !empty( $setting['show_in_template'] ) ) { |
|
570 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
571 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
569 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
570 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
571 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
572 | 572 | } |
573 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
573 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
574 | 574 | } else { |
575 | 575 | $show_if = ''; |
576 | 576 | } |
577 | 577 | |
578 | - if( ! empty( $setting['requires'] ) ) { |
|
579 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
578 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
579 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
580 | 580 | } |
581 | 581 | |
582 | - if( ! empty( $setting['requires_not'] ) ) { |
|
583 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
582 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
583 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | // output |
587 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
587 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
588 | 588 | |
589 | 589 | } |
590 | 590 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public static function load_type_class( $field = NULL ) { |
598 | 598 | |
599 | - if( empty( $field['type'] ) ) { |
|
599 | + if ( empty( $field[ 'type' ] ) ) { |
|
600 | 600 | return NULL; |
601 | 601 | } |
602 | 602 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
606 | 606 | * @param array $field field data |
607 | 607 | */ |
608 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
608 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
609 | 609 | |
610 | - if( class_exists( $type_class ) ) { |
|
610 | + if ( class_exists( $type_class ) ) { |
|
611 | 611 | return $type_class; |
612 | 612 | } |
613 | 613 | |
@@ -616,9 +616,9 @@ discard block |
||
616 | 616 | * @param string $field_type_include_path field class file path |
617 | 617 | * @param array $field field data |
618 | 618 | */ |
619 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
619 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
620 | 620 | |
621 | - if( $class_file && file_exists( $class_file ) ) { |
|
621 | + if ( $class_file && file_exists( $class_file ) ) { |
|
622 | 622 | require_once( $class_file ); |
623 | 623 | } |
624 | 624 | |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | |
641 | 641 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
642 | 642 | |
643 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
644 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
643 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
644 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
645 | 645 | |
646 | 646 | return $output; |
647 | 647 | } |
@@ -661,22 +661,22 @@ discard block |
||
661 | 661 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
662 | 662 | |
663 | 663 | // Show the merge tags if the field is a list view |
664 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
664 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
665 | 665 | |
666 | 666 | // Or is a single entry view |
667 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
667 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
668 | 668 | $show = ( $is_single || $is_list ); |
669 | 669 | |
670 | 670 | $class = ''; |
671 | 671 | // and $add_merge_tags is not false |
672 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
672 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
673 | 673 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
674 | 674 | } |
675 | 675 | |
676 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
677 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
676 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
677 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
678 | 678 | |
679 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
679 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -693,21 +693,21 @@ discard block |
||
693 | 693 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
694 | 694 | |
695 | 695 | // Show the merge tags if the field is a list view |
696 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
696 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
697 | 697 | |
698 | 698 | // Or is a single entry view |
699 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
699 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
700 | 700 | $show = ( $is_single || $is_list ); |
701 | 701 | |
702 | 702 | $class = ''; |
703 | 703 | // and $add_merge_tags is not false |
704 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
704 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
705 | 705 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
706 | 706 | } |
707 | 707 | |
708 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
708 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
709 | 709 | |
710 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
710 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | |
724 | 724 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
725 | 725 | |
726 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
727 | - foreach( $choices as $value => $label ) { |
|
728 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
726 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
727 | + foreach ( $choices as $value => $label ) { |
|
728 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
729 | 729 | } |
730 | 730 | $output .= '</select>'; |
731 | 731 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $this->label = esc_attr__( 'Approve Entries', 'gravityview' ); |
28 | 28 | |
29 | - $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
29 | + $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
30 | 30 | |
31 | 31 | $this->add_hooks(); |
32 | 32 | |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
50 | 50 | |
51 | - unset( $field_options['only_loggedin'] ); |
|
51 | + unset( $field_options[ 'only_loggedin' ] ); |
|
52 | 52 | |
53 | - unset( $field_options['new_window'] ); |
|
53 | + unset( $field_options[ 'new_window' ] ); |
|
54 | 54 | |
55 | - unset( $field_options['show_as_link'] ); |
|
55 | + unset( $field_options[ 'show_as_link' ] ); |
|
56 | 56 | |
57 | 57 | return $field_options; |
58 | 58 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) ); |
77 | 77 | |
78 | - add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
78 | + add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
79 | 79 | |
80 | 80 | add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 ); |
81 | 81 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function maybe_prevent_field_render( $html, $args ) { |
98 | 98 | |
99 | 99 | // If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render. |
100 | - if( $this->name === \GV\Utils::get( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
100 | + if ( $this->name === \GV\Utils::get( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function modify_search_parameters( $parameters ) { |
128 | 128 | |
129 | 129 | if ( $this->name === \GV\Utils::get( $parameters, 'sorting/key' ) ) { |
130 | - $parameters['sorting']['key'] = 'is_approved'; |
|
130 | + $parameters[ 'sorting' ][ 'key' ] = 'is_approved'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $parameters; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
150 | 150 | |
151 | - wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
151 | + wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
152 | 152 | |
153 | 153 | wp_register_script( 'gravityview-field-approval-popper', GRAVITYVIEW_URL . 'assets/lib/tippy/popper.min.js', array(), GravityView_Plugin::version, true ); |
154 | 154 | wp_register_script( 'gravityview-field-approval-tippy', GRAVITYVIEW_URL . 'assets/lib/tippy/tippy.min.js', array(), GravityView_Plugin::version, true ); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | |
157 | 157 | $style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css'; |
158 | 158 | |
159 | - if( class_exists( 'GravityView_View' ) ) { |
|
159 | + if ( class_exists( 'GravityView_View' ) ) { |
|
160 | 160 | /** |
161 | 161 | * Override CSS file by placing in your theme's /gravityview/css/ sub-directory. |
162 | 162 | */ |
163 | 163 | $style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false ); |
164 | 164 | } |
165 | 165 | |
166 | - $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
166 | + $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file. |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | $style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url ); |
174 | 174 | |
175 | - if( ! empty( $style_url ) ) { |
|
175 | + if ( ! empty( $style_url ) ) { |
|
176 | 176 | wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' ); |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | public function enqueue_and_localize_script() { |
188 | 188 | |
189 | 189 | // The script is already registered and enqueued |
190 | - if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
190 | + if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | |
201 | 201 | wp_localize_script( 'gravityview-field-approval', 'gvApproval', array( |
202 | 202 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
203 | - 'nonce' => wp_create_nonce('gravityview_entry_approval'), |
|
203 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
204 | 204 | 'status' => GravityView_Entry_Approval_Status::get_all(), |
205 | 205 | 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
206 | 206 | 'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(), |
207 | - )); |
|
207 | + ) ); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) { |
223 | 223 | |
224 | - if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) { |
|
225 | - $entry_default_fields["{$this->name}"] = array( |
|
224 | + if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) { |
|
225 | + $entry_default_fields[ "{$this->name}" ] = array( |
|
226 | 226 | 'label' => $this->label, |
227 | 227 | 'desc' => $this->description, |
228 | 228 | 'type' => $this->name, |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
77 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
78 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
77 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
78 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
79 | 79 | $form = GravityView_View::getInstance()->getForm(); |
80 | 80 | |
81 | 81 | /** @type GF_Field_Address $address_field */ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $choices = array(); |
85 | 85 | |
86 | 86 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
87 | - if( method_exists( $this, $method_name ) ) { |
|
87 | + if ( method_exists( $this, $method_name ) ) { |
|
88 | 88 | /** |
89 | 89 | * @uses GravityView_Field_Address::get_choices_country() |
90 | 90 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $choices = $this->{$method_name}( $address_field, $form ); |
93 | 93 | } |
94 | 94 | |
95 | - if( ! empty( $choices ) ) { |
|
96 | - $search_field['choices'] = $choices; |
|
97 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
95 | + if ( ! empty( $choices ) ) { |
|
96 | + $search_field[ 'choices' ] = $choices; |
|
97 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
98 | 98 | } else { |
99 | - $search_field['type'] = 'text'; |
|
100 | - $search_field['input'] = 'input_text'; |
|
99 | + $search_field[ 'type' ] = 'text'; |
|
100 | + $search_field[ 'input' ] = 'input_text'; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $country_choices = array(); |
123 | 123 | |
124 | 124 | foreach ( $countries as $key => $country ) { |
125 | - $country_choices[] = array( |
|
125 | + $country_choices[ ] = array( |
|
126 | 126 | 'value' => $country, |
127 | 127 | 'text' => $country, |
128 | 128 | ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function get_choices_state( $address_field, $form ) { |
149 | 149 | |
150 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
150 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
151 | 151 | |
152 | 152 | $state_choices = array(); |
153 | 153 | |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $states = GFCommon::get_canadian_provinces(); |
160 | 160 | break; |
161 | 161 | default: |
162 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
163 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
162 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
163 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $state_subchoices = array(); |
170 | 170 | |
171 | 171 | foreach ( $state as $key => $substate ) { |
172 | - $state_subchoices[] = array( |
|
172 | + $state_subchoices[ ] = array( |
|
173 | 173 | 'value' => is_numeric( $key ) ? $substate : $key, |
174 | 174 | 'text' => $substate, |
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | - $state_choices[] = array( |
|
178 | + $state_choices[ ] = array( |
|
179 | 179 | 'text' => $key, |
180 | 180 | 'value' => $state_subchoices, |
181 | 181 | ); |
182 | 182 | |
183 | 183 | } else { |
184 | - $state_choices[] = array( |
|
184 | + $state_choices[ ] = array( |
|
185 | 185 | 'value' => is_numeric( $key ) ? $state : $key, |
186 | 186 | 'text' => $state, |
187 | 187 | ); |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | // Use the same inputs as the "text" input type allows |
206 | 206 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
207 | 207 | |
208 | - $input_types['street'] = $text_inputs; |
|
209 | - $input_types['street2'] = $text_inputs; |
|
210 | - $input_types['city'] = $text_inputs; |
|
208 | + $input_types[ 'street' ] = $text_inputs; |
|
209 | + $input_types[ 'street2' ] = $text_inputs; |
|
210 | + $input_types[ 'city' ] = $text_inputs; |
|
211 | 211 | |
212 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
213 | - $input_types['zip'] = array( 'input_text' ); |
|
214 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
212 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
213 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
214 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
215 | 215 | |
216 | 216 | return $input_types; |
217 | 217 | } |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
233 | 233 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
234 | 234 | |
235 | - if( 'address' !== $field_type && $input_id ) { |
|
235 | + if ( 'address' !== $field_type && $input_id ) { |
|
236 | 236 | return $input_type; |
237 | 237 | } |
238 | 238 | |
239 | 239 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
240 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
240 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
241 | 241 | $input_type = $address_field_name; |
242 | 242 | } |
243 | 243 | |
@@ -284,17 +284,17 @@ discard block |
||
284 | 284 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
285 | 285 | |
286 | 286 | // If this is NOT the full address field, return default options. |
287 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
287 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
288 | 288 | return $field_options; |
289 | 289 | } |
290 | 290 | |
291 | - if( 'edit' === $context ) { |
|
291 | + if ( 'edit' === $context ) { |
|
292 | 292 | return $field_options; |
293 | 293 | } |
294 | 294 | |
295 | 295 | $add_options = array(); |
296 | 296 | |
297 | - $add_options['show_map_link'] = array( |
|
297 | + $add_options[ 'show_map_link' ] = array( |
|
298 | 298 | 'type' => 'checkbox', |
299 | 299 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
300 | 300 | 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | 'priority' => 98, |
305 | 305 | ); |
306 | 306 | |
307 | - $add_options['show_map_link_new_window'] = array( |
|
307 | + $add_options[ 'show_map_link_new_window' ] = array( |
|
308 | 308 | 'type' => 'checkbox', |
309 | 309 | 'label' => __( 'Open map link in a new tab or window?', 'gravityview' ), |
310 | 310 | 'value' => false, |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $supports = array( 'title', 'revisions' ); |
126 | 126 | |
127 | 127 | if ( $is_hierarchical ) { |
128 | - $supports[] = 'page-attributes'; |
|
128 | + $supports[ ] = 'page-attributes'; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
230 | 230 | |
231 | 231 | add_filter( 'query_vars', function( $query_vars ) { |
232 | - $query_vars[] = 'csv'; |
|
233 | - $query_vars[] = 'tsv'; |
|
232 | + $query_vars[ ] = 'csv'; |
|
233 | + $query_vars[ ] = 'tsv'; |
|
234 | 234 | return $query_vars; |
235 | 235 | } ); |
236 | 236 | |
237 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
237 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
238 | 238 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
239 | 239 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
240 | 240 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
297 | 297 | |
298 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
299 | 299 | |
300 | 300 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
301 | 301 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
324 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
324 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Editing a single entry. |
328 | 328 | */ |
329 | 329 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
330 | - if ( $entry['status'] != 'active' ) { |
|
330 | + if ( $entry[ 'status' ] != 'active' ) { |
|
331 | 331 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
332 | 332 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
341 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
341 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
342 | 342 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
343 | 343 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | foreach ( $entryset as $e ) { |
363 | 363 | |
364 | - if ( 'active' !== $e['status'] ) { |
|
364 | + if ( 'active' !== $e[ 'status' ] ) { |
|
365 | 365 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
366 | 366 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
375 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
375 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
376 | 376 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
377 | 377 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
378 | 378 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
548 | 548 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
549 | 549 | |
550 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
550 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | return $joins; |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | } |
638 | 638 | |
639 | 639 | foreach ( $_fields as $field ) { |
640 | - if ( ! empty( $field['unions'] ) ) { |
|
641 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
640 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
641 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
642 | 642 | if ( ! isset( $unions[ $form_id ] ) ) { |
643 | 643 | $unions[ $form_id ] = array(); |
644 | 644 | } |
645 | 645 | |
646 | - $unions[ $form_id ][ $field['id'] ] = |
|
646 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
647 | 647 | is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
648 | 648 | } |
649 | 649 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | if ( ! $view->form ) { |
699 | 699 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
700 | 700 | 'view_id' => $view->ID, |
701 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
701 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
702 | 702 | ) ); |
703 | 703 | } |
704 | 704 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * Remove multiple sorting before calling legacy filters. |
943 | 943 | * This allows us to fake it till we make it. |
944 | 944 | */ |
945 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
945 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
946 | 946 | $has_multisort = true; |
947 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
948 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
949 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
947 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
948 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
949 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
950 | 950 | } |
951 | 951 | } |
952 | 952 | |
@@ -955,31 +955,30 @@ discard block |
||
955 | 955 | */ |
956 | 956 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
957 | 957 | |
958 | - $parameters['context_view_id'] = $this->ID; |
|
958 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
959 | 959 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
960 | 960 | |
961 | 961 | if ( ! is_array( $parameters ) ) { |
962 | 962 | $parameters = array(); |
963 | 963 | } |
964 | 964 | |
965 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
966 | - $parameters['search_criteria'] = array(); |
|
965 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
966 | + $parameters[ 'search_criteria' ] = array(); |
|
967 | 967 | } |
968 | 968 | |
969 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
970 | - $parameters['search_criteria']['field_filters'] = array(); |
|
969 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
970 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | if ( $request instanceof REST\Request ) { |
974 | 974 | $atts = $this->settings->as_atts(); |
975 | 975 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
976 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
976 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
977 | 977 | ) ); |
978 | - $parameters['paging'] = $paging_parameters['paging']; |
|
978 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
979 | 979 | } |
980 | 980 | |
981 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
982 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
981 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
983 | 982 | |
984 | 983 | /** |
985 | 984 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -987,14 +986,14 @@ discard block |
||
987 | 986 | $unique_field_filters = array(); |
988 | 987 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
989 | 988 | if ( 'mode' === $key ) { |
990 | - $unique_field_filters['mode'] = $filter; |
|
989 | + $unique_field_filters[ 'mode' ] = $filter; |
|
991 | 990 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
992 | - $unique_field_filters[] = $filter; |
|
991 | + $unique_field_filters[ ] = $filter; |
|
993 | 992 | } |
994 | 993 | } |
995 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
994 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
996 | 995 | |
997 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
996 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
998 | 997 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
999 | 998 | } |
1000 | 999 | |
@@ -1003,7 +1002,7 @@ discard block |
||
1003 | 1002 | $query_class = $this->get_query_class(); |
1004 | 1003 | |
1005 | 1004 | /** @type \GF_Query $query */ |
1006 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1005 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1007 | 1006 | |
1008 | 1007 | /** |
1009 | 1008 | * Apply multisort. |
@@ -1014,15 +1013,15 @@ discard block |
||
1014 | 1013 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1015 | 1014 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1016 | 1015 | |
1017 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1016 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1018 | 1017 | |
1019 | - if( $has_sort_query_param ) { |
|
1020 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1018 | + if ( $has_sort_query_param ) { |
|
1019 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1021 | 1020 | } |
1022 | 1021 | |
1023 | 1022 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1024 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1025 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1023 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1024 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1026 | 1025 | } else { |
1027 | 1026 | $sort_field_ids = $view_setting_sort_field_ids; |
1028 | 1027 | $sort_directions = $view_setting_sort_directions; |
@@ -1030,7 +1029,7 @@ discard block |
||
1030 | 1029 | |
1031 | 1030 | $skip_first = false; |
1032 | 1031 | |
1033 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1032 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1034 | 1033 | |
1035 | 1034 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1036 | 1035 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1060,18 +1059,18 @@ discard block |
||
1060 | 1059 | |
1061 | 1060 | $merged_time = false; |
1062 | 1061 | |
1063 | - foreach ( $q['order'] as $oid => $order ) { |
|
1062 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1064 | 1063 | |
1065 | 1064 | $column = null; |
1066 | 1065 | |
1067 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1068 | - $column = $order[0]; |
|
1069 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1070 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
1066 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
1067 | + $column = $order[ 0 ]; |
|
1068 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
1069 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
1071 | 1070 | $orders[ $oid ] = $order; |
1072 | 1071 | continue; // Need something that resembles a single sort |
1073 | 1072 | } |
1074 | - $column = $order[0]->columns[0]; |
|
1073 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1075 | 1074 | } |
1076 | 1075 | |
1077 | 1076 | if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1085,7 +1084,7 @@ discard block |
||
1085 | 1084 | |
1086 | 1085 | $orders[ $oid ] = array( |
1087 | 1086 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1088 | - $order[1] // Mock it! |
|
1087 | + $order[ 1 ] // Mock it! |
|
1089 | 1088 | ); |
1090 | 1089 | |
1091 | 1090 | $merged_time = true; |
@@ -1096,15 +1095,15 @@ discard block |
||
1096 | 1095 | * ORDER again. |
1097 | 1096 | */ |
1098 | 1097 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1099 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1098 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1100 | 1099 | } |
1101 | 1100 | } |
1102 | 1101 | |
1103 | 1102 | return $sql; |
1104 | 1103 | } ); |
1105 | 1104 | |
1106 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1107 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1105 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1106 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1108 | 1107 | |
1109 | 1108 | /** |
1110 | 1109 | * Any joins? |
@@ -1127,7 +1126,7 @@ discard block |
||
1127 | 1126 | |
1128 | 1127 | $query_parameters = $query->_introspect(); |
1129 | 1128 | |
1130 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1129 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1131 | 1130 | } |
1132 | 1131 | |
1133 | 1132 | /** |
@@ -1161,7 +1160,7 @@ discard block |
||
1161 | 1160 | } |
1162 | 1161 | |
1163 | 1162 | $q = $query->_introspect(); |
1164 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1163 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1165 | 1164 | |
1166 | 1165 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1167 | 1166 | |
@@ -1186,7 +1185,7 @@ discard block |
||
1186 | 1185 | |
1187 | 1186 | $query_parameters = $query->_introspect(); |
1188 | 1187 | |
1189 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1188 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1190 | 1189 | } |
1191 | 1190 | } |
1192 | 1191 | |
@@ -1210,7 +1209,7 @@ discard block |
||
1210 | 1209 | $conditions = array(); |
1211 | 1210 | |
1212 | 1211 | foreach ( $condition->expressions as $_condition ) { |
1213 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1212 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1214 | 1213 | } |
1215 | 1214 | |
1216 | 1215 | return call_user_func_array( |
@@ -1239,10 +1238,10 @@ discard block |
||
1239 | 1238 | $q = new $query_class( $form_id ); |
1240 | 1239 | |
1241 | 1240 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1242 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1241 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1243 | 1242 | |
1244 | 1243 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1245 | - foreach ( $query_parameters['order'] as $order ) { |
|
1244 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1246 | 1245 | list( $column, $_order ) = $order; |
1247 | 1246 | |
1248 | 1247 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1256,15 +1255,15 @@ discard block |
||
1256 | 1255 | |
1257 | 1256 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1258 | 1257 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1259 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1258 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1260 | 1259 | |
1261 | 1260 | // Record the SQL |
1262 | - $unions_sql[] = array( |
|
1261 | + $unions_sql[ ] = array( |
|
1263 | 1262 | // Remove columns, we'll rebuild them |
1264 | 1263 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1265 | - 'from' => $sql['from'], |
|
1266 | - 'join' => $sql['join'], |
|
1267 | - 'where' => $sql['where'], |
|
1264 | + 'from' => $sql[ 'from' ], |
|
1265 | + 'join' => $sql[ 'join' ], |
|
1266 | + 'where' => $sql[ 'where' ], |
|
1268 | 1267 | // Remove order and limit |
1269 | 1268 | ); |
1270 | 1269 | |
@@ -1281,11 +1280,11 @@ discard block |
||
1281 | 1280 | |
1282 | 1281 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1283 | 1282 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1284 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1283 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1285 | 1284 | |
1286 | 1285 | // Remove columns, we'll rebuild them |
1287 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1288 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1286 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1287 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1289 | 1288 | |
1290 | 1289 | $unions = array(); |
1291 | 1290 | |
@@ -1296,30 +1295,30 @@ discard block |
||
1296 | 1295 | }; |
1297 | 1296 | |
1298 | 1297 | // Add all the order columns into the selects, so we can order by the whole union group |
1299 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1298 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1300 | 1299 | |
1301 | 1300 | $columns = array( |
1302 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1301 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1303 | 1302 | ); |
1304 | 1303 | |
1305 | 1304 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1306 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1305 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1307 | 1306 | |
1308 | 1307 | // Rewrite the order columns to the shared aliases |
1309 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1308 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1310 | 1309 | } |
1311 | 1310 | |
1312 | 1311 | $columns = array_unique( $columns ); |
1313 | 1312 | |
1314 | 1313 | // Add the columns to every UNION |
1315 | 1314 | foreach ( $unions_sql as $union_sql ) { |
1316 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1317 | - $unions []= implode( ' ', $union_sql ); |
|
1315 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1316 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1318 | 1317 | } |
1319 | 1318 | |
1320 | 1319 | // Add the columns to the main SELECT, but only grab the entry id column |
1321 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1322 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1320 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1321 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1323 | 1322 | |
1324 | 1323 | return $sql; |
1325 | 1324 | } ); |
@@ -1364,20 +1363,20 @@ discard block |
||
1364 | 1363 | } ); |
1365 | 1364 | } else { |
1366 | 1365 | $entries = $this->form->entries |
1367 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1366 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1368 | 1367 | ->offset( $this->settings->get( 'offset' ) ) |
1369 | - ->limit( $parameters['paging']['page_size'] ) |
|
1368 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1370 | 1369 | ->page( $page ); |
1371 | 1370 | |
1372 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1371 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1373 | 1372 | // Pluck off multisort arrays |
1374 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1373 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1375 | 1374 | } |
1376 | 1375 | |
1377 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1376 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1378 | 1377 | $field = new \GV\Field(); |
1379 | - $field->ID = $parameters['sorting']['key']; |
|
1380 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1378 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1379 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1381 | 1380 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1382 | 1381 | } |
1383 | 1382 | } |
@@ -1461,7 +1460,7 @@ discard block |
||
1461 | 1460 | $allowed = $headers = array(); |
1462 | 1461 | |
1463 | 1462 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1464 | - $allowed[] = $field; |
|
1463 | + $allowed[ ] = $field; |
|
1465 | 1464 | } |
1466 | 1465 | |
1467 | 1466 | $renderer = new Field_Renderer(); |
@@ -1483,17 +1482,17 @@ discard block |
||
1483 | 1482 | } ); |
1484 | 1483 | |
1485 | 1484 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1486 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1485 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1487 | 1486 | } |
1488 | 1487 | |
1489 | 1488 | foreach ( $allowed as $field ) { |
1490 | 1489 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1491 | 1490 | |
1492 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1491 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1493 | 1492 | |
1494 | 1493 | if ( ! $headers_done ) { |
1495 | 1494 | $label = $field->get_label( $view, $source, $entry ); |
1496 | - $headers[] = $label ? $label : $field->ID; |
|
1495 | + $headers[ ] = $label ? $label : $field->ID; |
|
1497 | 1496 | } |
1498 | 1497 | } |
1499 | 1498 |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
166 | 166 | |
167 | 167 | if ( $enable_custom_class ) { |
168 | - $settings['custom_class'] = array( |
|
168 | + $settings[ 'custom_class' ] = array( |
|
169 | 169 | 'type' => 'text', |
170 | 170 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
171 | 171 | 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | '1-1' => array( |
224 | 224 | array( |
225 | 225 | 'areaid' => 'top', |
226 | - 'title' => __( 'Top', 'gravityview' ) , |
|
226 | + 'title' => __( 'Top', 'gravityview' ), |
|
227 | 227 | 'subtitle' => '' |
228 | 228 | ), |
229 | 229 | ), |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | '1-2' => array( |
233 | 233 | array( |
234 | 234 | 'areaid' => 'left', |
235 | - 'title' => __( 'Left', 'gravityview' ) , |
|
235 | + 'title' => __( 'Left', 'gravityview' ), |
|
236 | 236 | 'subtitle' => '' |
237 | 237 | ), |
238 | 238 | ), |
239 | 239 | '2-2' => array( |
240 | 240 | array( |
241 | 241 | 'areaid' => 'right', |
242 | - 'title' => __( 'Right', 'gravityview' ) , |
|
242 | + 'title' => __( 'Right', 'gravityview' ), |
|
243 | 243 | 'subtitle' => '' |
244 | 244 | ), |
245 | 245 | ), |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | $widgets[ $this->get_widget_id() ] = array( |
277 | - 'label' => $this->widget_label , |
|
277 | + 'label' => $this->widget_label, |
|
278 | 278 | 'description' => $this->widget_description, |
279 | 279 | 'subtitle' => $this->widget_subtitle, |
280 | 280 | 'icon' => $this->icon, |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
298 | 298 | if ( $this->get_widget_id() === $widget ) { |
299 | - if( $settings = $this->get_settings() ) { |
|
299 | + if ( $settings = $this->get_settings() ) { |
|
300 | 300 | $options = array_merge( $options, $settings ); |
301 | 301 | } |
302 | 302 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return; |
351 | 351 | } |
352 | 352 | |
353 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
353 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |