@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
50 | 50 | |
51 | 51 | /** @type GF_Field $field */ |
52 | - foreach( $fields as &$field ) { |
|
52 | + foreach ( $fields as &$field ) { |
|
53 | 53 | |
54 | 54 | if ( 'hidden' === $field->type ) { |
55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field ); |
64 | 64 | |
65 | - if( ! $reveal_hidden_field ) { |
|
65 | + if ( ! $reveal_hidden_field ) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | public function edit_entry_fix_uid_fields( $fields ) { |
51 | 51 | |
52 | 52 | /** @type \GF_Field $field */ |
53 | - foreach( $fields as &$field ) { |
|
53 | + foreach ( $fields as &$field ) { |
|
54 | 54 | if ( 'uid' === $field->type ) { |
55 | 55 | |
56 | 56 | // Replace GF_Field with GF_Field_Text, copying all the data from $field |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
167 | 167 | */ |
168 | 168 | public static function from_configuration( $configuration ) { |
169 | - if ( empty( $configuration['id'] ) ) { |
|
169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
170 | 170 | $field = new self(); |
171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | } else { |
180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
181 | 181 | } |
182 | - $trace = $trace[1]; |
|
183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
182 | + $trace = $trace[ 1 ]; |
|
183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
184 | 184 | $field = new self(); |
185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** @type \GV\GF_Field|\GV\Internal_Field $field_class Determine the field implementation to use, and try to use. */ |
191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | public function update_configuration( $configuration ) { |
228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
229 | 229 | |
230 | - if ( $this->ID != $configuration['id'] ) { |
|
230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
231 | 231 | /** Smelling trouble here... */ |
232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
233 | 233 | } |
234 | 234 | |
235 | - $this->ID = $configuration['id']; |
|
236 | - $this->label = $configuration['label']; |
|
237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
238 | - $this->custom_label = $configuration['custom_label']; |
|
239 | - $this->custom_class = $configuration['custom_class']; |
|
240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
235 | + $this->ID = $configuration[ 'id' ]; |
|
236 | + $this->label = $configuration[ 'label' ]; |
|
237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
243 | 243 | |
244 | 244 | /** Shared among all field types (sort of). */ |
245 | 245 | $shared_configuration_keys = array( |
246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
248 | 248 | ); |
249 | 249 | |
250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | /** A custom label is available. */ |
275 | 275 | if ( ! empty( $this->custom_label ) ) { |
276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return ''; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
360 | 360 | */ |
361 | 361 | public function __get( $key ) { |
362 | - switch( $key ) { |
|
362 | + switch ( $key ) { |
|
363 | 363 | default: |
364 | 364 | if ( isset( $this->configuration[ $key ] ) ) { |
365 | 365 | return $this->configuration[ $key ]; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return boolean Whether this $key is set or not. |
378 | 378 | */ |
379 | 379 | public function __isset( $key ) { |
380 | - switch( $key ) { |
|
380 | + switch ( $key ) { |
|
381 | 381 | default: |
382 | 382 | return isset( $this->configuration[ $key ] ); |
383 | 383 | } |
@@ -532,7 +532,7 @@ |
||
532 | 532 | * @since 1.16.4 |
533 | 533 | * @param int $entry_id ID of the Gravity Forms entry |
534 | 534 | * @param array $entry Deleted entry array |
535 | - */ |
|
535 | + */ |
|
536 | 536 | do_action( 'gravityview/delete-entry/deleted', $entry_id, $entry ); |
537 | 537 | } |
538 | 538 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function add_reserved_arg( $args ) { |
114 | 114 | |
115 | - $args[] = 'delete'; |
|
115 | + $args[ ] = 'delete'; |
|
116 | 116 | |
117 | 117 | return $args; |
118 | 118 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | // Index 100 is the default GravityView template path. |
184 | 184 | // Index 110 is Edit Entry link |
185 | - $file_paths[115] = self::$file; |
|
185 | + $file_paths[ 115 ] = self::$file; |
|
186 | 186 | |
187 | 187 | return $file_paths; |
188 | 188 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | $attributes = array( |
299 | 299 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
300 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
300 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
301 | 301 | 'onclick' => self::get_confirm_dialog(), |
302 | 302 | ); |
303 | 303 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | ); |
343 | 343 | |
344 | 344 | // If the form is not submitted, return early |
345 | - if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) { |
|
345 | + if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) { |
|
346 | 346 | return; |
347 | 347 | } |
348 | 348 | |
349 | 349 | // Make sure it's a GravityView request |
350 | - $valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) ); |
|
350 | + $valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) ); |
|
351 | 351 | |
352 | 352 | if ( ! $valid_nonce_key ) { |
353 | 353 | gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' ); |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | // Get the entry slug |
359 | - $entry_slug = esc_attr( $get_fields['entry_id'] ); |
|
359 | + $entry_slug = esc_attr( $get_fields[ 'entry_id' ] ); |
|
360 | 360 | |
361 | 361 | // Redirect after deleting the entry. |
362 | - $view = \GV\View::by_id( $get_fields['view_id'] ); |
|
362 | + $view = \GV\View::by_id( $get_fields[ 'view_id' ] ); |
|
363 | 363 | |
364 | 364 | // See if there's an entry there |
365 | 365 | $entry = gravityview_get_entry( $entry_slug, true, false, $view ); |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | $this->_redirect_and_exit( $delete_redirect_base, $delete_response->get_error_message(), 'error' ); |
387 | 387 | } |
388 | 388 | |
389 | - if ( (int) $view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) { |
|
389 | + if ( (int)$view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) { |
|
390 | 390 | |
391 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
391 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
392 | 392 | $redirect_url_setting = $view->settings->get( 'delete_redirect_url' ); |
393 | 393 | $redirect_url = GFCommon::replace_variables( $redirect_url_setting, $form, $entry, false, false, false, 'text' ); |
394 | 394 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | private function delete_or_trash_entry( $entry ) { |
466 | 466 | |
467 | - $entry_id = $entry['id']; |
|
467 | + $entry_id = $entry[ 'id' ]; |
|
468 | 468 | |
469 | 469 | $mode = $this->get_delete_mode(); |
470 | 470 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
529 | 529 | |
530 | 530 | // The entry had no connected post |
531 | - if ( empty( $entry['post_id'] ) ) { |
|
531 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | $action = current_action(); |
547 | 547 | |
548 | 548 | if ( 'gravityview/delete-entry/deleted' === $action ) { |
549 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
549 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
550 | 550 | } else { |
551 | - $result = wp_trash_post( $entry['post_id'] ); |
|
551 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | if ( false === $result ) { |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | public function verify_nonce() { |
580 | 580 | |
581 | 581 | // No delete entry request was made |
582 | - if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
582 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
583 | 583 | return false; |
584 | 584 | } |
585 | 585 | |
586 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
586 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
587 | 587 | |
588 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
588 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
589 | 589 | |
590 | 590 | /** |
591 | 591 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $error = __( 'You do not have permission to delete this entry.', 'gk-gravityview' ); |
642 | 642 | } |
643 | 643 | |
644 | - if ( $entry['status'] === 'trash' ) { |
|
644 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
645 | 645 | if ( 'trash' === $this->get_delete_mode() ) { |
646 | 646 | $error = __( 'The entry is already in the trash.', 'gk-gravityview' ); |
647 | 647 | } else { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | $current_user = wp_get_current_user(); |
687 | 687 | |
688 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : null; |
|
688 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null; |
|
689 | 689 | |
690 | 690 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
691 | 691 | if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
@@ -699,17 +699,17 @@ discard block |
||
699 | 699 | if ( ! empty( $field ) ) { |
700 | 700 | |
701 | 701 | // If capability is not defined, something is not right! |
702 | - if ( empty( $field['allow_edit_cap'] ) ) { |
|
702 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
703 | 703 | |
704 | 704 | gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) ); |
705 | 705 | |
706 | 706 | return false; |
707 | 707 | } |
708 | 708 | |
709 | - if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
709 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
710 | 710 | |
711 | 711 | // Do not return true if cap is read, as we need to check if the current user created the entry |
712 | - if ( $field['allow_edit_cap'] !== 'read' ) { |
|
712 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
713 | 713 | return true; |
714 | 714 | } |
715 | 715 | } else { |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | } |
721 | 721 | } |
722 | 722 | |
723 | - if ( ! isset( $entry['created_by'] ) ) { |
|
723 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
724 | 724 | |
725 | 725 | gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
726 | 726 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | } |
737 | 737 | |
738 | 738 | // If the logged-in user is the same as the user who created the entry, we're good. |
739 | - if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
739 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
740 | 740 | |
741 | 741 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
742 | 742 | |
@@ -761,12 +761,12 @@ discard block |
||
761 | 761 | */ |
762 | 762 | public function maybe_display_message( $current_view_id = 0 ) { |
763 | 763 | |
764 | - if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
764 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
765 | 765 | return; |
766 | 766 | } |
767 | 767 | |
768 | 768 | // Entry wasn't deleted from current View |
769 | - if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
769 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
770 | 770 | return; |
771 | 771 | } |
772 | 772 | |
@@ -775,11 +775,11 @@ discard block |
||
775 | 775 | |
776 | 776 | public function display_message() { |
777 | 777 | |
778 | - if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) { |
|
778 | + if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
779 | 779 | return; |
780 | 780 | } |
781 | 781 | |
782 | - $status = esc_attr( $_GET['status'] ); |
|
782 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
783 | 783 | $message_from_url = \GV\Utils::_GET( 'message', '' ); |
784 | 784 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
785 | 785 | $class = ''; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $partial_entries_addon = GF_Partial_Entries::get_instance(); |
55 | 55 | |
56 | - $feed_settings = $partial_entries_addon->get_feed_settings( $form['id'] ); |
|
56 | + $feed_settings = $partial_entries_addon->get_feed_settings( $form[ 'id' ] ); |
|
57 | 57 | |
58 | 58 | $is_enabled = \GV\Utils::get( $feed_settings, 'enable', 0 ); |
59 | 59 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // Set the expected $_POST key for the Add-On to use |
73 | - $_POST['partial_entry_id'] = $partial_entry_id; |
|
73 | + $_POST[ 'partial_entry_id' ] = $partial_entry_id; |
|
74 | 74 | |
75 | 75 | gravityview()->log->debug( 'Saving partial entry (ID #{partial_entry_id}) for Entry #{entry_id}', array( |
76 | 76 | 'partial_entry_id' => $partial_entry_id, |
77 | 77 | 'entry_id' => $entry_id |
78 | 78 | ) ); |
79 | 79 | |
80 | - $partial_entries_addon->maybe_save_partial_entry( $form['id'] ); |
|
80 | + $partial_entries_addon->maybe_save_partial_entry( $form[ 'id' ] ); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -308,7 +308,7 @@ |
||
308 | 308 | {{field_settings}} |
309 | 309 | {{hidden_fields}} |
310 | 310 | </div> |
311 | -EOD; |
|
311 | +eod; |
|
312 | 312 | |
313 | 313 | $output = $template; |
314 | 314 |
@@ -392,7 +392,7 @@ |
||
392 | 392 | <div class="gv-field-detail gv-field-detail--field"> |
393 | 393 | <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-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"> |
@@ -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', 'gk-gravityview'), |
|
112 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview'), |
|
111 | + 'label' => __( 'Percent Width', 'gk-gravityview' ), |
|
112 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-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_option['label'], ':' ); |
|
124 | + $field_options[ $key ][ 'label' ] = trim( $field_option[ '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?', 'gk-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', 'gk-gravityview' ), |
240 | 240 | ); |
241 | 241 | |
242 | - if( is_multisite() ) { |
|
243 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gk-gravityview' ); |
|
242 | + if ( is_multisite() ) { |
|
243 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gk-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 | } |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * @return string HTML of dialog box |
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 | - if( empty( $uniqid ) ) { |
|
282 | + if ( empty( $uniqid ) ) { |
|
283 | 283 | //generate a unique field id |
284 | - $uniqid = uniqid('', false); |
|
284 | + $uniqid = uniqid( '', false ); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | $grouped = ( 'field' === $field_type ); |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | // get field/widget options |
290 | 290 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
291 | 291 | |
292 | - if( ! $grouped ) { |
|
292 | + if ( ! $grouped ) { |
|
293 | 293 | $option_groups = array( $option_groups ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | $option_groups = array_filter( $option_groups ); |
297 | 297 | |
298 | 298 | // two different post arrays, depending of the field type |
299 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
299 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
300 | 300 | |
301 | 301 | // build output |
302 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
303 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
302 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
303 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
304 | 304 | |
305 | 305 | $form_title = ''; |
306 | 306 | if ( $form_id ) { |
307 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
307 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
308 | 308 | $form = GVCommon::get_form_or_form_template( $form_id ); |
309 | - $form_title = $form['title']; |
|
309 | + $form_title = $form[ 'title' ]; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | // If there are no options, return what we got. |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
315 | 315 | } |
316 | 316 | |
317 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
317 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
318 | 318 | |
319 | 319 | $field_details = ''; |
320 | 320 | |
321 | 321 | // Get the pretty name for the input type |
322 | 322 | $gv_field = GravityView_Fields::get( $input_type ); |
323 | 323 | |
324 | - if( $gv_field ) { |
|
324 | + if ( $gv_field ) { |
|
325 | 325 | $input_type_label = $gv_field->label; |
326 | 326 | } else { |
327 | 327 | $input_type_label = $input_type; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | if ( $grouped ) { |
338 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
338 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
339 | 339 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
340 | 340 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
341 | 341 | } |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $show_if = ''; |
355 | - if ( ! empty( $option['requires'] ) ) { |
|
356 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
355 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
356 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
357 | 357 | } |
358 | 358 | |
359 | - if ( ! empty( $option['requires_not'] ) ) { |
|
360 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
359 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
360 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
361 | 361 | } |
362 | 362 | |
363 | - switch ( $option['type'] ) { |
|
363 | + switch ( $option[ 'type' ] ) { |
|
364 | 364 | // Hide hidden fields |
365 | 365 | case 'hidden': |
366 | 366 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -378,30 +378,30 @@ discard block |
||
378 | 378 | $item_details = ''; |
379 | 379 | $subtitle = ''; |
380 | 380 | |
381 | - if( 'field' === $field_type ) { |
|
382 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
381 | + if ( 'field' === $field_type ) { |
|
382 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
383 | 383 | |
384 | 384 | $item_details .= ' |
385 | 385 | <div class="gv-field-details--container"> |
386 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label> |
|
386 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label> |
|
387 | 387 | <section class="gv-field-details gv-field-details--closed">'; |
388 | 388 | |
389 | 389 | if ( $field_id && is_numeric( $field_id ) ) { |
390 | 390 | $item_details .= ' |
391 | 391 | <div class="gv-field-detail gv-field-detail--field"> |
392 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
392 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
393 | 393 | </div>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $item_details .= ' |
397 | 397 | <div class="gv-field-detail gv-field-detail--type"> |
398 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
398 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
399 | 399 | </div>'; |
400 | 400 | |
401 | - if( $form_id ) { |
|
401 | + if ( $form_id ) { |
|
402 | 402 | $item_details .= ' |
403 | 403 | <div class="gv-field-detail gv-field-detail--form"> |
404 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
404 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
405 | 405 | </div>'; |
406 | 406 | } |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | </section> |
410 | 410 | </div>'; |
411 | 411 | } else { |
412 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
412 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
413 | 413 | $widget_details_content = \GV\Utils::get( $item, 'description', '' ); |
414 | 414 | |
415 | 415 | // Intentionally not escaping to allow HTML. |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @deprecated setting index 'default' was replaced by 'value' |
477 | 477 | * @see GravityView_FieldType::get_field_defaults |
478 | 478 | */ |
479 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
480 | - $option['value'] = $option['default']; |
|
481 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
479 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
480 | + $option[ 'value' ] = $option[ 'default' ]; |
|
481 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | // prepare to render option field type |
485 | - if( isset( $option['type'] ) ) { |
|
485 | + if ( isset( $option[ 'type' ] ) ) { |
|
486 | 486 | |
487 | 487 | $type_class = self::load_type_class( $option ); |
488 | 488 | |
489 | - if( class_exists( $type_class ) ) { |
|
489 | + if ( class_exists( $type_class ) ) { |
|
490 | 490 | |
491 | 491 | /** @type GravityView_FieldType $render_type */ |
492 | 492 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param string $output field class name |
504 | 504 | * @param array $option option field data |
505 | 505 | */ |
506 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
506 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | } // isset option[type] |
@@ -538,27 +538,27 @@ discard block |
||
538 | 538 | * @deprecated setting index 'name' was replaced by 'label' |
539 | 539 | * @see GravityView_FieldType::get_field_defaults |
540 | 540 | */ |
541 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
542 | - $setting['label'] = $setting['name']; |
|
543 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
541 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
542 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
543 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | $name = esc_attr( sprintf( $name, $key ) ); |
547 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
548 | - $setting['tooltip'] = 'gv_' . $key; |
|
547 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
548 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
549 | 549 | |
550 | 550 | // Use default if current setting isn't set. |
551 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
551 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
552 | 552 | |
553 | 553 | // default setting type = text |
554 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
554 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
555 | 555 | |
556 | 556 | // merge tags |
557 | - if( !isset( $setting['merge_tags'] ) ) { |
|
558 | - if( $setting['type'] === 'text' ) { |
|
559 | - $setting['merge_tags'] = true; |
|
557 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
558 | + if ( $setting[ 'type' ] === 'text' ) { |
|
559 | + $setting[ 'merge_tags' ] = true; |
|
560 | 560 | } else { |
561 | - $setting['merge_tags'] = false; |
|
561 | + $setting[ 'merge_tags' ] = false; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | // render the setting |
568 | 568 | $type_class = self::load_type_class( $setting ); |
569 | - if( class_exists( $type_class ) ) { |
|
569 | + if ( class_exists( $type_class ) ) { |
|
570 | 570 | /** @type GravityView_FieldType $render_type */ |
571 | 571 | $render_type = new $type_class( $name, $setting, $curr_value ); |
572 | 572 | ob_start(); |
@@ -576,25 +576,25 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | // Check if setting is specific for a template |
579 | - if( !empty( $setting['show_in_template'] ) ) { |
|
580 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
581 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
579 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
580 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
581 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
582 | 582 | } |
583 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
583 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
584 | 584 | } else { |
585 | 585 | $show_if = ''; |
586 | 586 | } |
587 | 587 | |
588 | - if( ! empty( $setting['requires'] ) ) { |
|
589 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
588 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
589 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
590 | 590 | } |
591 | 591 | |
592 | - if( ! empty( $setting['requires_not'] ) ) { |
|
593 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
592 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
593 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | // output |
597 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
597 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
598 | 598 | |
599 | 599 | } |
600 | 600 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public static function load_type_class( $field = NULL ) { |
608 | 608 | |
609 | - if( empty( $field['type'] ) ) { |
|
609 | + if ( empty( $field[ 'type' ] ) ) { |
|
610 | 610 | return NULL; |
611 | 611 | } |
612 | 612 | |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
616 | 616 | * @param array $field field data |
617 | 617 | */ |
618 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
618 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
619 | 619 | |
620 | - if( class_exists( $type_class ) ) { |
|
620 | + if ( class_exists( $type_class ) ) { |
|
621 | 621 | return $type_class; |
622 | 622 | } |
623 | 623 | |
@@ -626,9 +626,9 @@ discard block |
||
626 | 626 | * @param string $field_type_include_path field class file path |
627 | 627 | * @param array $field field data |
628 | 628 | */ |
629 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
629 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
630 | 630 | |
631 | - if( $class_file && file_exists( $class_file ) ) { |
|
631 | + if ( $class_file && file_exists( $class_file ) ) { |
|
632 | 632 | require_once( $class_file ); |
633 | 633 | } |
634 | 634 | |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | |
651 | 651 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
652 | 652 | |
653 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
654 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
653 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
654 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
655 | 655 | |
656 | 656 | return $output; |
657 | 657 | } |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
672 | 672 | |
673 | 673 | // Show the merge tags if the field is a list view |
674 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
674 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
675 | 675 | |
676 | 676 | // Or is a single entry view |
677 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
677 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
678 | 678 | $show = ( $is_single || $is_list ); |
679 | 679 | |
680 | 680 | $class = ''; |
681 | 681 | // and $add_merge_tags is not false |
682 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
682 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
683 | 683 | $class = 'gv-merge-tag-support mt-position-right mt-hide_all_fields '; |
684 | 684 | } |
685 | 685 | |
686 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
687 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
686 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
687 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
688 | 688 | |
689 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
689 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -703,21 +703,21 @@ discard block |
||
703 | 703 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
704 | 704 | |
705 | 705 | // Show the merge tags if the field is a list view |
706 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
706 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
707 | 707 | |
708 | 708 | // Or is a single entry view |
709 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
709 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
710 | 710 | $show = ( $is_single || $is_list ); |
711 | 711 | |
712 | 712 | $class = ''; |
713 | 713 | // and $add_merge_tags is not false |
714 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
714 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
715 | 715 | $class = 'gv-merge-tag-support mt-position-right mt-hide_all_fields '; |
716 | 716 | } |
717 | 717 | |
718 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
718 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
719 | 719 | |
720 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
720 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
@@ -733,9 +733,9 @@ discard block |
||
733 | 733 | |
734 | 734 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
735 | 735 | |
736 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
737 | - foreach( $choices as $value => $label ) { |
|
738 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
736 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
737 | + foreach ( $choices as $value => $label ) { |
|
738 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
739 | 739 | } |
740 | 740 | $output .= '</select>'; |
741 | 741 |
@@ -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,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function get_all( $groups = '' ) { |
118 | 118 | |
119 | - if( '' !== $groups ) { |
|
119 | + if ( '' !== $groups ) { |
|
120 | 120 | $return_fields = self::$_fields; |
121 | 121 | |
122 | - $groups = (array) $groups; |
|
122 | + $groups = (array)$groups; |
|
123 | 123 | |
124 | 124 | foreach ( $return_fields as $key => $field ) { |
125 | - if( ! in_array( $field->group, $groups, true ) ) { |
|
125 | + if ( ! in_array( $field->group, $groups, true ) ) { |
|
126 | 126 | unset( $return_fields[ $key ] ); |
127 | 127 | } |
128 | 128 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class .= ' merge-tag-support mt-position-right '; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class .= ' merge-tag-support mt-position-right '; |
|
33 | 33 | |
34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | - $class .= ' mt-hide_all_fields '; |
|
36 | - } |
|
37 | - } |
|
34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | + $class .= ' mt-hide_all_fields '; |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | $class .= rgar( $this->field, 'class' ); |
40 | 40 | $placeholder = rgar( $this->field, 'placeholder' ); |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | |
56 | 56 | function codemirror( $field_id = '' ) { |
57 | 57 | |
58 | - // Enqueue code editor and settings for manipulating HTML. |
|
59 | - $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
58 | + // Enqueue code editor and settings for manipulating HTML. |
|
59 | + $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
60 | 60 | |
61 | - // Bail if user disabled CodeMirror. |
|
62 | - if ( false === $settings ) { |
|
63 | - return; |
|
64 | - } |
|
61 | + // Bail if user disabled CodeMirror. |
|
62 | + if ( false === $settings ) { |
|
63 | + return; |
|
64 | + } |
|
65 | 65 | |
66 | - ?> |
|
66 | + ?> |
|
67 | 67 | |
68 | 68 | <script> |
69 | 69 | wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
70 | 70 | </script> |
71 | 71 | <?php |
72 | - } |
|
72 | + } |
|
73 | 73 | |
74 | 74 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | ?> |
10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
11 | 11 | |
12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
14 | 14 | ?><div> |
15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
32 | 32 | $class .= ' merge-tag-support mt-position-right '; |
33 | 33 | |
34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
35 | 35 | $class .= ' mt-hide_all_fields '; |
36 | 36 | } |
37 | 37 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | # $this->codemirror( $this->get_field_id() ); |
50 | 50 | |
51 | 51 | ?> |
52 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
52 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
53 | 53 | <?php |
54 | 54 | } |
55 | 55 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ?> |
67 | 67 | |
68 | 68 | <script> |
69 | - wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
|
69 | + wp.codeEditor.initialize( "<?php echo $field_id; ?>", {}); |
|
70 | 70 | </script> |
71 | 71 | <?php |
72 | 72 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @deprecated |
115 | 115 | * @see The `gravityview/view_collection/from_post/meta_keys` filter. |
116 | 116 | */ |
117 | - $meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
117 | + $meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
118 | 118 | |
119 | 119 | /** What about inside post meta values? */ |
120 | 120 | foreach ( $meta_keys as $meta_key ) { |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | |
169 | 169 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
170 | 170 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
171 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
171 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
176 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
175 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
176 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
177 | 177 | if ( ! $view ) { |
178 | 178 | continue; |
179 | 179 | } |