@@ -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 | /** 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 ''; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
351 | 351 | */ |
352 | 352 | public function __get( $key ) { |
353 | - switch( $key ): |
|
353 | + switch ( $key ): |
|
354 | 354 | default: |
355 | 355 | if ( isset( $this->configuration[ $key ] ) ) { |
356 | 356 | return $this->configuration[ $key ]; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @return boolean Whether this $key is set or not. |
367 | 367 | */ |
368 | 368 | public function __isset( $key ) { |
369 | - switch( $key ): |
|
369 | + switch ( $key ): |
|
370 | 370 | default: |
371 | 371 | return isset( $this->configuration[ $key ] ); |
372 | 372 | endswitch; |
@@ -53,7 +53,6 @@ discard block |
||
53 | 53 | * Columns are able to be added to View layouts, but not separately searched! |
54 | 54 | * |
55 | 55 | * @param array $fields |
56 | - * @param int $form_id |
|
57 | 56 | * |
58 | 57 | * @return array |
59 | 58 | */ |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | * |
134 | 133 | * @param GF_Field_List $field Gravity Forms field |
135 | 134 | * @param string|array $field_value Serialized or unserialized array value for the field |
136 | - * @param int|string $column_id The numeric key of the column (0-index) or the label of the column |
|
135 | + * @param integer $column_id The numeric key of the column (0-index) or the label of the column |
|
137 | 136 | * @param string $format If set to 'raw', return an array of values for the column. Otherwise, allow Gravity Forms to render using `html` or `text` |
138 | 137 | * |
139 | 138 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function remove_columns_from_searchable_fields( $fields ) { |
61 | 61 | |
62 | 62 | foreach ( $fields as $key => $field ) { |
63 | - if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) { |
|
63 | + if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) { |
|
64 | 64 | unset( $fields[ $key ] ); |
65 | 65 | } |
66 | 66 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // Add the list columns |
87 | 87 | foreach ( $list_fields as $list_field ) { |
88 | 88 | |
89 | - if( empty( $list_field->enableColumns ) ) { |
|
89 | + if ( empty( $list_field->enableColumns ) ) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // If there are columns, add them under the parent field |
110 | - if( ! empty( $list_columns ) ) { |
|
110 | + if ( ! empty( $list_columns ) ) { |
|
111 | 111 | |
112 | 112 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * Merge the $list_columns into the $fields array at $index |
116 | 116 | * @see https://stackoverflow.com/a/1783125 |
117 | 117 | */ |
118 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
118 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | unset( $list_columns, $index, $input_id ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $list_rows = maybe_unserialize( $field_value ); |
144 | 144 | |
145 | - if( ! is_array( $list_rows ) ) { |
|
145 | + if ( ! is_array( $list_rows ) ) { |
|
146 | 146 | gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) ); |
147 | 147 | return null; |
148 | 148 | } |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | // Each list row |
153 | 153 | foreach ( $list_rows as $list_row ) { |
154 | 154 | $current_column = 0; |
155 | - foreach ( (array) $list_row as $column_key => $column_value ) { |
|
155 | + foreach ( (array)$list_row as $column_key => $column_value ) { |
|
156 | 156 | |
157 | 157 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
158 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | - $column_values[] = $column_value; |
|
158 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | + $column_values[ ] = $column_value; |
|
160 | 160 | } |
161 | 161 | $current_column++; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Return the array of values |
166 | - if( 'raw' === $format ) { |
|
166 | + if ( 'raw' === $format ) { |
|
167 | 167 | return $column_values; |
168 | 168 | } |
169 | 169 | // Return the Gravity Forms Field output |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function _filter_field_label( $label, $field, $form, $entry ) { |
188 | 188 | |
189 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
189 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
190 | 190 | |
191 | 191 | // Not a list field |
192 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
192 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
193 | 193 | return $label; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Custom label is defined, so use it |
197 | - if( ! empty( $field['custom_label'] ) ) { |
|
197 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
198 | 198 | return $label; |
199 | 199 | } |
200 | 200 | |
201 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
201 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
202 | 202 | |
203 | 203 | // Parent field, not column field |
204 | - if( false === $column_id ) { |
|
204 | + if ( false === $column_id ) { |
|
205 | 205 | return $label; |
206 | 206 | } |
207 | 207 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
223 | 223 | |
224 | 224 | // Doesn't have columns enabled |
225 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
225 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
226 | 226 | return $backup_label; |
227 | 227 | } |
228 | 228 |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * Uninstall all traces of GravityView |
|
142 | - * |
|
143 | - * Note: method is public because parent method is public |
|
144 | - * |
|
141 | + * Uninstall all traces of GravityView |
|
142 | + * |
|
143 | + * Note: method is public because parent method is public |
|
144 | + * |
|
145 | 145 | * @return bool |
146 | 146 | */ |
147 | 147 | public function uninstall() { |
148 | 148 | gravityview()->plugin->uninstall(); |
149 | 149 | |
150 | 150 | /** |
151 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
152 | - * @see GFAddOn::uninstall_addon |
|
153 | - * @uses deactivate_plugins() |
|
154 | - */ |
|
151 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
152 | + * @see GFAddOn::uninstall_addon |
|
153 | + * @uses deactivate_plugins() |
|
154 | + */ |
|
155 | 155 | $this->_path = GRAVITYVIEW_FILE; |
156 | 156 | |
157 | 157 | return true; |
@@ -181,42 +181,42 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
184 | - * Get an array of reasons why the plugin might be uninstalled |
|
185 | - * |
|
186 | - * @since 1.17.5 |
|
187 | - * |
|
184 | + * Get an array of reasons why the plugin might be uninstalled |
|
185 | + * |
|
186 | + * @since 1.17.5 |
|
187 | + * |
|
188 | 188 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
189 | 189 | */ |
190 | 190 | private function get_uninstall_reasons() { |
191 | 191 | $reasons = array( |
192 | 192 | 'will-continue' => array( |
193 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
194 | - ), |
|
193 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
194 | + ), |
|
195 | 195 | 'no-longer-need' => array( |
196 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
197 | - ), |
|
196 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
197 | + ), |
|
198 | 198 | 'doesnt-work' => array( |
199 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
200 | - ), |
|
199 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
200 | + ), |
|
201 | 201 | 'found-other' => array( |
202 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
203 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
204 | - ), |
|
202 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
203 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'other' => array( |
206 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
207 | - ), |
|
206 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
207 | + ), |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | shuffle( $reasons ); |
211 | 211 | |
212 | 212 | return $reasons; |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | 215 | /** |
216 | - * Display a feedback form when the plugin is uninstalled |
|
217 | - * |
|
218 | - * @since 1.17.5 |
|
219 | - * |
|
216 | + * Display a feedback form when the plugin is uninstalled |
|
217 | + * |
|
218 | + * @since 1.17.5 |
|
219 | + * |
|
220 | 220 | * @return string HTML of the uninstallation form |
221 | 221 | */ |
222 | 222 | public function uninstall_form() { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
297 | 297 | <ul> |
298 | 298 | <?php |
299 | - $reasons = $this->get_uninstall_reasons(); |
|
299 | + $reasons = $this->get_uninstall_reasons(); |
|
300 | 300 | foreach ( $reasons as $reason ) { |
301 | 301 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
302 | 302 | } |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | public function app_settings_tab() { |
393 | - parent::app_settings_tab(); |
|
393 | + parent::app_settings_tab(); |
|
394 | 394 | |
395 | 395 | if ( $this->maybe_uninstall() ) { |
396 | - echo $this->uninstall_form(); |
|
396 | + echo $this->uninstall_form(); |
|
397 | 397 | } |
398 | - } |
|
398 | + } |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * The Settings title |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @return array The settings. |
481 | 481 | */ |
482 | 482 | public function all() { |
483 | - return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
483 | + return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | type="' . $field['type'] . '" |
550 | 550 | name="' . esc_attr( $name ) . '" |
551 | 551 | value="' . $value . '" ' . |
552 | - implode( ' ', $attributes ) . |
|
553 | - ' />'; |
|
552 | + implode( ' ', $attributes ) . |
|
553 | + ' />'; |
|
554 | 554 | |
555 | 555 | if ( $echo ) { |
556 | 556 | echo $html; |
@@ -568,12 +568,12 @@ discard block |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
571 | - * Check whether GravityView is being saved |
|
572 | - * |
|
573 | - * The generic is_save_postback() is true for all addons |
|
574 | - * |
|
575 | - * @since 2.0.8 |
|
576 | - * |
|
571 | + * Check whether GravityView is being saved |
|
572 | + * |
|
573 | + * The generic is_save_postback() is true for all addons |
|
574 | + * |
|
575 | + * @since 2.0.8 |
|
576 | + * |
|
577 | 577 | * @return bool |
578 | 578 | */ |
579 | 579 | public function is_save_postback() { |
@@ -587,16 +587,16 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function license_key_notice() { |
589 | 589 | |
590 | - if( $this->is_save_postback() ) { |
|
591 | - $settings = $this->get_posted_settings(); |
|
592 | - $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
593 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
594 | - } else { |
|
595 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
596 | - $license_key = $this->get( 'license_key' ); |
|
597 | - } |
|
590 | + if( $this->is_save_postback() ) { |
|
591 | + $settings = $this->get_posted_settings(); |
|
592 | + $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
593 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
594 | + } else { |
|
595 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
596 | + $license_key = $this->get( 'license_key' ); |
|
597 | + } |
|
598 | 598 | |
599 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
599 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
600 | 600 | |
601 | 601 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
602 | 602 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $update_below = false; |
611 | 611 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
612 | 612 | |
613 | - switch ( $license_status ) { |
|
613 | + switch ( $license_status ) { |
|
614 | 614 | /** @since 1.17 */ |
615 | 615 | case 'expired': |
616 | 616 | $title = __( 'Expired License', 'gravityview' ); |
@@ -666,12 +666,12 @@ discard block |
||
666 | 666 | } |
667 | 667 | |
668 | 668 | /** |
669 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
670 | - * |
|
671 | - * @since 1.21.5 |
|
672 | - * |
|
673 | - * @see GFAddOn::scripts() |
|
674 | - * |
|
669 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
670 | + * |
|
671 | + * @since 1.21.5 |
|
672 | + * |
|
673 | + * @see GFAddOn::scripts() |
|
674 | + * |
|
675 | 675 | * @return array Array of scripts |
676 | 676 | */ |
677 | 677 | public function scripts() { |
@@ -680,10 +680,10 @@ discard block |
||
680 | 680 | $scripts[] = array( |
681 | 681 | 'handle' => 'gform_tooltip_init', |
682 | 682 | 'enqueue' => array( |
683 | - array( |
|
684 | - 'admin_page' => array( 'app_settings' ) |
|
685 | - ) |
|
686 | - ) |
|
683 | + array( |
|
684 | + 'admin_page' => array( 'app_settings' ) |
|
685 | + ) |
|
686 | + ) |
|
687 | 687 | ); |
688 | 688 | |
689 | 689 | return $scripts; |
@@ -701,10 +701,10 @@ discard block |
||
701 | 701 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
702 | 702 | 'version' => Plugin::$version, |
703 | 703 | 'deps' => array( |
704 | - 'gform_admin', |
|
704 | + 'gform_admin', |
|
705 | 705 | 'gaddon_form_settings_css', |
706 | - 'gform_tooltip', |
|
707 | - 'gform_font_awesome', |
|
706 | + 'gform_tooltip', |
|
707 | + 'gform_font_awesome', |
|
708 | 708 | ), |
709 | 709 | 'enqueue' => array( |
710 | 710 | array( 'admin_page' => array( |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | array( |
873 | 873 | 'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ), |
874 | 874 | 'value' => '1', |
875 | - 'name' => 'beta', |
|
875 | + 'name' => 'beta', |
|
876 | 876 | ), |
877 | 877 | ), |
878 | 878 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -910,38 +910,38 @@ discard block |
||
910 | 910 | |
911 | 911 | if ( empty( $field['disabled'] ) ) { |
912 | 912 | unset( $field['disabled'] ); |
913 | - } |
|
913 | + } |
|
914 | 914 | } |
915 | 915 | |
916 | - $sections = array( |
|
917 | - array( |
|
918 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
919 | - 'fields' => $fields, |
|
920 | - ) |
|
921 | - ); |
|
916 | + $sections = array( |
|
917 | + array( |
|
918 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
919 | + 'fields' => $fields, |
|
920 | + ) |
|
921 | + ); |
|
922 | 922 | |
923 | - // custom 'update settings' button |
|
924 | - $button = array( |
|
925 | - 'class' => 'button button-primary button-hero', |
|
926 | - 'type' => 'save', |
|
927 | - ); |
|
923 | + // custom 'update settings' button |
|
924 | + $button = array( |
|
925 | + 'class' => 'button button-primary button-hero', |
|
926 | + 'type' => 'save', |
|
927 | + ); |
|
928 | 928 | |
929 | 929 | if ( $disabled_attribute ) { |
930 | 930 | $button['disabled'] = $disabled_attribute; |
931 | 931 | } |
932 | 932 | |
933 | - /** |
|
934 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
935 | - * Extensions can tap in here to insert their own section and settings. |
|
936 | - * <code> |
|
937 | - * $sections[] = array( |
|
938 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
939 | - * 'fields' => $settings, |
|
940 | - * ); |
|
941 | - * </code> |
|
942 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
943 | - */ |
|
944 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
933 | + /** |
|
934 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
935 | + * Extensions can tap in here to insert their own section and settings. |
|
936 | + * <code> |
|
937 | + * $sections[] = array( |
|
938 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
939 | + * 'fields' => $settings, |
|
940 | + * ); |
|
941 | + * </code> |
|
942 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
943 | + */ |
|
944 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
945 | 945 | |
946 | 946 | // If there are extensions, add a section for them |
947 | 947 | if ( ! empty( $extension_sections ) ) { |
@@ -954,13 +954,13 @@ discard block |
||
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | - $k = count( $extension_sections ) - 1 ; |
|
958 | - $extension_sections[ $k ]['fields'][] = $button; |
|
957 | + $k = count( $extension_sections ) - 1 ; |
|
958 | + $extension_sections[ $k ]['fields'][] = $button; |
|
959 | 959 | $sections = array_merge( $sections, $extension_sections ); |
960 | 960 | } else { |
961 | - // add the 'update settings' button to the general section |
|
962 | - $sections[0]['fields'][] = $button; |
|
963 | - } |
|
961 | + // add the 'update settings' button to the general section |
|
962 | + $sections[0]['fields'][] = $button; |
|
963 | + } |
|
964 | 964 | |
965 | 965 | return $sections; |
966 | 966 | } |
@@ -1014,9 +1014,9 @@ discard block |
||
1014 | 1014 | */ |
1015 | 1015 | protected function settings_edd_license( $field, $echo = true ) { |
1016 | 1016 | |
1017 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1018 | - $field['input_type'] = 'password'; |
|
1019 | - } |
|
1017 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1018 | + $field['input_type'] = 'password'; |
|
1019 | + } |
|
1020 | 1020 | |
1021 | 1021 | $text = $this->settings_text( $field, false ); |
1022 | 1022 | |
@@ -1033,9 +1033,9 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | /** |
1035 | 1035 | * Allow pure HTML settings row |
1036 | - * |
|
1037 | - * @since 2.0.6 |
|
1038 | - * |
|
1036 | + * |
|
1037 | + * @since 2.0.6 |
|
1038 | + * |
|
1039 | 1039 | * @param array $field |
1040 | 1040 | * @param bool $echo Whether to echo the |
1041 | 1041 | * |
@@ -1101,19 +1101,19 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | /** |
1104 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1105 | - * |
|
1106 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1107 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1108 | - * |
|
1109 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1110 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1111 | - * |
|
1112 | - * @since 1.21.5.2 |
|
1113 | - * |
|
1104 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1105 | + * |
|
1106 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1107 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1108 | + * |
|
1109 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1110 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1111 | + * |
|
1112 | + * @since 1.21.5.2 |
|
1113 | + * |
|
1114 | 1114 | * @param array $field |
1115 | - * |
|
1116 | - * @return void |
|
1115 | + * |
|
1116 | + * @return void |
|
1117 | 1117 | */ |
1118 | 1118 | public function single_setting_row( $field ) { |
1119 | 1119 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return array |
102 | 102 | */ |
103 | 103 | public function modify_app_settings_menu_title( $setting_tabs ) { |
104 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
104 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
105 | 105 | return $setting_tabs; |
106 | 106 | } |
107 | 107 | |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | </ul> |
305 | 305 | <div class="gv-followup widefat"> |
306 | 306 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
307 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
307 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
308 | 308 | </div> |
309 | 309 | <div class="scale-description"> |
310 | 310 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
311 | 311 | <ul class="inline"> |
312 | 312 | <?php |
313 | 313 | $i = 0; |
314 | - while( $i < 11 ) { |
|
315 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
314 | + while ( $i < 11 ) { |
|
315 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
316 | 316 | $i++; |
317 | 317 | } |
318 | 318 | ?> |
@@ -529,15 +529,15 @@ discard block |
||
529 | 529 | * @return string The HTML |
530 | 530 | */ |
531 | 531 | public function as_html( $field, $echo = true ) { |
532 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
532 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
533 | 533 | |
534 | 534 | $attributes = $this->get_field_attributes( $field ); |
535 | 535 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
536 | - $value = $this->get( $field['name'], $default_value ); |
|
536 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
537 | 537 | |
538 | 538 | |
539 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
540 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
539 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
540 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
541 | 541 | |
542 | 542 | if ( empty( $value ) ) { |
543 | 543 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $attributes = $this->get_field_attributes( $field ); |
547 | 547 | |
548 | 548 | $html = '<input |
549 | - type="' . $field['type'] . '" |
|
549 | + type="' . $field[ 'type' ] . '" |
|
550 | 550 | name="' . esc_attr( $name ) . '" |
551 | 551 | value="' . $value . '" ' . |
552 | 552 | implode( ' ', $attributes ) . |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @return bool |
578 | 578 | */ |
579 | 579 | public function is_save_postback() { |
580 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
580 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function license_key_notice() { |
589 | 589 | |
590 | - if( $this->is_save_postback() ) { |
|
590 | + if ( $this->is_save_postback() ) { |
|
591 | 591 | $settings = $this->get_posted_settings(); |
592 | 592 | $license_key = \GV\Utils::get( $settings, 'license_key' ); |
593 | 593 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * but didn't want to mess up the translation strings for the translators. |
606 | 606 | */ |
607 | 607 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
608 | - $title = __ ( 'Inactive License', 'gravityview'); |
|
608 | + $title = __( 'Inactive License', 'gravityview' ); |
|
609 | 609 | $status = ''; |
610 | 610 | $update_below = false; |
611 | 611 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
636 | 636 | break; |
637 | 637 | } |
638 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
638 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
639 | 639 | |
640 | 640 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
641 | 641 | if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | public function scripts() { |
678 | 678 | $scripts = parent::scripts(); |
679 | 679 | |
680 | - $scripts[] = array( |
|
680 | + $scripts[ ] = array( |
|
681 | 681 | 'handle' => 'gform_tooltip_init', |
682 | 682 | 'enqueue' => array( |
683 | 683 | array( |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | public function styles() { |
697 | 697 | $styles = parent::styles(); |
698 | 698 | |
699 | - $styles[] = array( |
|
699 | + $styles[ ] = array( |
|
700 | 700 | 'handle' => 'gravityview_settings', |
701 | 701 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
702 | 702 | 'version' => Plugin::$version, |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * If multisite and not network admin, we don't want the settings to show. |
728 | 728 | * @since 1.7.6 |
729 | 729 | */ |
730 | - $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
730 | + $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
731 | 731 | |
732 | 732 | /** |
733 | 733 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -775,26 +775,26 @@ discard block |
||
775 | 775 | 'label' => __( 'License Key', 'gravityview' ), |
776 | 776 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
777 | 777 | 'type' => 'edd_license', |
778 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
778 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
779 | 779 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
780 | - 'default_value' => $default_settings['license_key'], |
|
780 | + 'default_value' => $default_settings[ 'license_key' ], |
|
781 | 781 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
782 | 782 | ), |
783 | 783 | array( |
784 | 784 | 'name' => 'license_key_response', |
785 | - 'default_value' => $default_settings['license_key_response'], |
|
785 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
786 | 786 | 'type' => 'hidden', |
787 | 787 | ), |
788 | 788 | array( |
789 | 789 | 'name' => 'license_key_status', |
790 | - 'default_value' => $default_settings['license_key_status'], |
|
790 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
791 | 791 | 'type' => 'hidden', |
792 | 792 | ), |
793 | 793 | array( |
794 | 794 | 'name' => 'support-email', |
795 | 795 | 'type' => 'text', |
796 | 796 | 'validate' => 'email', |
797 | - 'default_value' => $default_settings['support-email'], |
|
797 | + 'default_value' => $default_settings[ 'support-email' ], |
|
798 | 798 | 'label' => __( 'Support Email', 'gravityview' ), |
799 | 799 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
800 | 800 | 'class' => 'code regular-text', |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | 'name' => 'support_port', |
807 | 807 | 'type' => 'radio', |
808 | 808 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
809 | - 'default_value' => $default_settings['support_port'], |
|
809 | + 'default_value' => $default_settings[ 'support_port' ], |
|
810 | 810 | 'horizontal' => 1, |
811 | 811 | 'choices' => array( |
812 | 812 | array( |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | 'name' => 'no-conflict-mode', |
826 | 826 | 'type' => 'radio', |
827 | 827 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
828 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
828 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
829 | 829 | 'horizontal' => 1, |
830 | 830 | 'choices' => array( |
831 | 831 | array( |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | 'name' => 'rest_api', |
848 | 848 | 'type' => 'radio', |
849 | 849 | 'label' => __( 'REST API', 'gravityview' ), |
850 | - 'default_value' => $default_settings['rest_api'], |
|
850 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
851 | 851 | 'horizontal' => 1, |
852 | 852 | 'choices' => array( |
853 | 853 | array( |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | 'name' => 'beta', |
867 | 867 | 'type' => 'checkbox', |
868 | 868 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
869 | - 'default_value' => $default_settings['beta'], |
|
869 | + 'default_value' => $default_settings[ 'beta' ], |
|
870 | 870 | 'horizontal' => 1, |
871 | 871 | 'choices' => array( |
872 | 872 | array( |
@@ -899,17 +899,17 @@ discard block |
||
899 | 899 | * @since 1.7.4 |
900 | 900 | */ |
901 | 901 | foreach ( $fields as &$field ) { |
902 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
903 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
904 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
905 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
902 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
903 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
904 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
905 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
906 | 906 | |
907 | 907 | if ( $disabled_attribute ) { |
908 | - $field['disabled'] = $disabled_attribute; |
|
908 | + $field[ 'disabled' ] = $disabled_attribute; |
|
909 | 909 | } |
910 | 910 | |
911 | - if ( empty( $field['disabled'] ) ) { |
|
912 | - unset( $field['disabled'] ); |
|
911 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
912 | + unset( $field[ 'disabled' ] ); |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | ); |
928 | 928 | |
929 | 929 | if ( $disabled_attribute ) { |
930 | - $button['disabled'] = $disabled_attribute; |
|
930 | + $button[ 'disabled' ] = $disabled_attribute; |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | /** |
@@ -946,20 +946,20 @@ discard block |
||
946 | 946 | // If there are extensions, add a section for them |
947 | 947 | if ( ! empty( $extension_sections ) ) { |
948 | 948 | |
949 | - if( $disabled_attribute ) { |
|
949 | + if ( $disabled_attribute ) { |
|
950 | 950 | foreach ( $extension_sections as &$section ) { |
951 | - foreach ( $section['fields'] as &$field ) { |
|
952 | - $field['disabled'] = $disabled_attribute; |
|
951 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
952 | + $field[ 'disabled' ] = $disabled_attribute; |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | } |
956 | 956 | |
957 | - $k = count( $extension_sections ) - 1 ; |
|
958 | - $extension_sections[ $k ]['fields'][] = $button; |
|
957 | + $k = count( $extension_sections ) - 1; |
|
958 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
959 | 959 | $sections = array_merge( $sections, $extension_sections ); |
960 | 960 | } else { |
961 | 961 | // add the 'update settings' button to the general section |
962 | - $sections[0]['fields'][] = $button; |
|
962 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
963 | 963 | } |
964 | 964 | |
965 | 965 | return $sections; |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | protected function settings_edd_license( $field, $echo = true ) { |
1016 | 1016 | |
1017 | 1017 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1018 | - $field['input_type'] = 'password'; |
|
1018 | + $field[ 'input_type' ] = 'password'; |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | $text = $this->settings_text( $field, false ); |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | public function single_setting_row_html( $field ) { |
1065 | 1065 | ?> |
1066 | 1066 | |
1067 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1067 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1068 | 1068 | <td colspan="2"> |
1069 | 1069 | <?php $this->single_setting( $field ); ?> |
1070 | 1070 | </td> |
@@ -1082,10 +1082,10 @@ discard block |
||
1082 | 1082 | * @return string |
1083 | 1083 | */ |
1084 | 1084 | public function settings_save( $field, $echo = true ) { |
1085 | - $field['type'] = 'submit'; |
|
1086 | - $field['name'] = 'gform-settings-save'; |
|
1087 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
1088 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1085 | + $field[ 'type' ] = 'submit'; |
|
1086 | + $field[ 'name' ] = 'gform-settings-save'; |
|
1087 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
1088 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1089 | 1089 | |
1090 | 1090 | $output = $this->settings_submit( $field, false ); |
1091 | 1091 | |
@@ -1116,8 +1116,8 @@ discard block |
||
1116 | 1116 | * @return void |
1117 | 1117 | */ |
1118 | 1118 | public function single_setting_row( $field ) { |
1119 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1120 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1119 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1120 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1121 | 1121 | parent::single_setting_row( $field ); |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | public function single_setting_label( $field ) { |
1130 | 1130 | parent::single_setting_label( $field ); |
1131 | 1131 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
1132 | - echo '<span class="description">'. $description .'</span>'; |
|
1132 | + echo '<span class="description">' . $description . '</span>'; |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
1167 | 1167 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1168 | 1168 | if ( $local_key !== $response_key ) { |
1169 | - unset( $posted_settings['license_key_response'] ); |
|
1170 | - unset( $posted_settings['license_key_status'] ); |
|
1171 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1169 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1170 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1171 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1172 | 1172 | } |
1173 | 1173 | return $posted_settings; |
1174 | 1174 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'type' => 'radio', |
65 | 65 | 'full_width' => true, |
66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
68 | 68 | 'value' => 'any', |
69 | 69 | 'class' => 'hide-if-js', |
70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
91 | 91 | |
92 | 92 | // ajax - get the searchable fields |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
225 | 225 | $script_source = empty( $script_min ) ? '/source' : ''; |
226 | 226 | |
227 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
227 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
228 | 228 | |
229 | 229 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
230 | 230 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
247 | 247 | */ |
248 | 248 | public function register_no_conflict( $allowed ) { |
249 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
249 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
250 | 250 | return $allowed; |
251 | 251 | } |
252 | 252 | |
@@ -259,24 +259,24 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public static function get_searchable_fields() { |
261 | 261 | |
262 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
262 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
263 | 263 | exit( '0' ); |
264 | 264 | } |
265 | 265 | |
266 | 266 | $form = ''; |
267 | 267 | |
268 | 268 | // Fetch the form for the current View |
269 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
269 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
270 | 270 | |
271 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
271 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
272 | 272 | |
273 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
273 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
274 | 274 | |
275 | - $form = (int) $_POST['formid']; |
|
275 | + $form = (int)$_POST[ 'formid' ]; |
|
276 | 276 | |
277 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
277 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
278 | 278 | |
279 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
279 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 | |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | ), |
326 | 326 | ); |
327 | 327 | |
328 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
328 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // Get fields with sub-inputs and no parent |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $fields as $id => $field ) { |
350 | 350 | |
351 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
351 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
352 | 352 | continue; |
353 | 353 | } |
354 | 354 | |
355 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
355 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
356 | 356 | |
357 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
357 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
378 | 378 | |
379 | 379 | // @todo - This needs to be improved - many fields have . including products and addresses |
380 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
380 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
381 | 381 | $input_type = 'boolean'; // on/off checkbox |
382 | 382 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
383 | 383 | $input_type = 'multi'; //multiselect |
@@ -421,19 +421,19 @@ discard block |
||
421 | 421 | $post_id = 0; |
422 | 422 | |
423 | 423 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
424 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
425 | - $post_id = absint( $widget_args['post_id'] ); |
|
424 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
425 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
426 | 426 | } |
427 | 427 | // We're in the WordPress Widget context, and the base View ID should be used |
428 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
429 | - $post_id = absint( $widget_args['view_id'] ); |
|
428 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
429 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $args = gravityview_get_permalink_query_args( $post_id ); |
433 | 433 | |
434 | 434 | // Add hidden fields to the search form |
435 | 435 | foreach ( $args as $key => $value ) { |
436 | - $search_fields[] = array( |
|
436 | + $search_fields[ ] = array( |
|
437 | 437 | 'name' => $key, |
438 | 438 | 'input' => 'hidden', |
439 | 439 | 'value' => $value, |
@@ -470,22 +470,22 @@ discard block |
||
470 | 470 | /** |
471 | 471 | * Include the sidebar Widgets. |
472 | 472 | */ |
473 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
473 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
474 | 474 | |
475 | 475 | foreach ( $widgets as $widget ) { |
476 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
477 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
476 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
477 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
478 | 478 | foreach ( $_fields as $field ) { |
479 | - $searchable_fields [] = $field['field']; |
|
479 | + $searchable_fields [ ] = $field[ 'field' ]; |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | 485 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
486 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
486 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
487 | 487 | foreach ( $_fields as $field ) { |
488 | - $searchable_fields [] = $field['field']; |
|
488 | + $searchable_fields [ ] = $field[ 'field' ]; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function filter_entries( $search_criteria, $form_id = null, $args = array() ) { |
504 | 504 | |
505 | - if( 'post' === $this->search_method ) { |
|
505 | + if ( 'post' === $this->search_method ) { |
|
506 | 506 | $get = $_POST; |
507 | 507 | } else { |
508 | 508 | $get = $_GET; |
@@ -521,14 +521,14 @@ discard block |
||
521 | 521 | $get = gv_map_deep( $get, 'rawurldecode' ); |
522 | 522 | |
523 | 523 | // Make sure array key is set up |
524 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
524 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
525 | 525 | |
526 | 526 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
527 | 527 | |
528 | 528 | // add free search |
529 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
529 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
530 | 530 | |
531 | - $search_all_value = trim( $get['gv_search'] ); |
|
531 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
532 | 532 | |
533 | 533 | /** |
534 | 534 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | foreach ( $words as $word ) { |
556 | - $search_criteria['field_filters'][] = array( |
|
556 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
557 | 557 | 'key' => null, // The field ID to search |
558 | 558 | 'value' => $word, // The value to search |
559 | 559 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -563,19 +563,19 @@ discard block |
||
563 | 563 | |
564 | 564 | // start date & end date |
565 | 565 | if ( in_array( 'entry_date', $searchable_fields ) ) { |
566 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
567 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
566 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
567 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
568 | 568 | |
569 | 569 | if ( $view ) { |
570 | 570 | /** |
571 | 571 | * Override start and end dates if View is limited to some already. |
572 | 572 | */ |
573 | - if ( $start_date =$view->settings->get( 'start_date' ) ) { |
|
573 | + if ( $start_date = $view->settings->get( 'start_date' ) ) { |
|
574 | 574 | if ( $start_timestamp = strtotime( $curr_start ) ) { |
575 | 575 | $curr_start = $start_timestamp < strtotime( $start_date ) ? $start_date : $curr_start; |
576 | 576 | } |
577 | 577 | } |
578 | - if ( $end_date =$view->settings->get( 'end_date' ) ) { |
|
578 | + if ( $end_date = $view->settings->get( 'end_date' ) ) { |
|
579 | 579 | if ( $end_timestamp = strtotime( $curr_end ) ) { |
580 | 580 | $curr_end = $end_timestamp > strtotime( $end_date ) ? $end_date : $curr_end; |
581 | 581 | } |
@@ -596,22 +596,22 @@ discard block |
||
596 | 596 | */ |
597 | 597 | if ( ! empty( $curr_start ) ) { |
598 | 598 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
599 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
599 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | if ( ! empty( $curr_end ) ) { |
603 | 603 | // Fast-forward 24 hour on the end time |
604 | 604 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
605 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
606 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
607 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
605 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
606 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
607 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | 612 | // search for a specific entry ID |
613 | 613 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
614 | - $search_criteria['field_filters'][] = array( |
|
614 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
615 | 615 | 'key' => 'id', |
616 | 616 | 'value' => absint( $get[ 'gv_id' ] ), |
617 | 617 | 'operator' => '=', |
@@ -620,42 +620,42 @@ discard block |
||
620 | 620 | |
621 | 621 | // search for a specific Created_by ID |
622 | 622 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'entry_creator', $searchable_fields ) ) { |
623 | - $search_criteria['field_filters'][] = array( |
|
623 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
624 | 624 | 'key' => 'created_by', |
625 | - 'value' => absint( $get['gv_by'] ), |
|
625 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
626 | 626 | 'operator' => '=', |
627 | 627 | ); |
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | 631 | // Get search mode passed in URL |
632 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
632 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
633 | 633 | |
634 | 634 | // get the other search filters |
635 | 635 | foreach ( $get as $key => $value ) { |
636 | 636 | |
637 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
637 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
638 | 638 | continue; |
639 | 639 | } |
640 | 640 | |
641 | 641 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
642 | 642 | |
643 | 643 | // could return simple filter or multiple filters |
644 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
644 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
645 | 645 | continue; |
646 | 646 | } |
647 | 647 | |
648 | 648 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
649 | 649 | |
650 | - if ( isset( $filter[0]['value'] ) ) { |
|
651 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
650 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
651 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
652 | 652 | |
653 | 653 | // if date range type, set search mode to ALL |
654 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
654 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
655 | 655 | $mode = 'all'; |
656 | 656 | } |
657 | - } elseif( !empty( $filter ) ) { |
|
658 | - $search_criteria['field_filters'][] = $filter; |
|
657 | + } elseif ( ! empty( $filter ) ) { |
|
658 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * @since 1.5.1 |
665 | 665 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
666 | 666 | */ |
667 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
667 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
668 | 668 | |
669 | 669 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
670 | 670 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | $field_id = str_replace( 'filter_', '', $key ); |
693 | 693 | |
694 | 694 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
695 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
695 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
696 | 696 | $field_id = str_replace( '_', '.', $field_id ); |
697 | 697 | } |
698 | 698 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | case 'select': |
729 | 729 | case 'radio': |
730 | - $filter['operator'] = 'is'; |
|
730 | + $filter[ 'operator' ] = 'is'; |
|
731 | 731 | break; |
732 | 732 | |
733 | 733 | case 'post_category': |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | |
742 | 742 | foreach ( $value as $val ) { |
743 | 743 | $cat = get_term( $val, 'category' ); |
744 | - $filter[] = array( |
|
744 | + $filter[ ] = array( |
|
745 | 745 | 'key' => $filter_key, |
746 | 746 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
747 | 747 | 'operator' => 'is', |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $filter = array(); |
761 | 761 | |
762 | 762 | foreach ( $value as $val ) { |
763 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
763 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | break; |
@@ -769,9 +769,9 @@ discard block |
||
769 | 769 | // convert checkbox on/off into the correct search filter |
770 | 770 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
771 | 771 | foreach ( $form_field->inputs as $k => $input ) { |
772 | - if ( $input['id'] == $filter_key ) { |
|
773 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
774 | - $filter['operator'] = 'is'; |
|
772 | + if ( $input[ 'id' ] == $filter_key ) { |
|
773 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
774 | + $filter[ 'operator' ] = 'is'; |
|
775 | 775 | break; |
776 | 776 | } |
777 | 777 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $filter = array(); |
782 | 782 | |
783 | 783 | foreach ( $value as $val ) { |
784 | - $filter[] = array( |
|
784 | + $filter[ ] = array( |
|
785 | 785 | 'key' => $filter_key, |
786 | 786 | 'value' => $val, |
787 | 787 | 'operator' => 'is', |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | foreach ( $words as $word ) { |
803 | 803 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
804 | 804 | // Keep the same key for each filter |
805 | - $filter['value'] = $word; |
|
805 | + $filter[ 'value' ] = $word; |
|
806 | 806 | // Add a search for the value |
807 | - $filters[] = $filter; |
|
807 | + $filters[ ] = $filter; |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
@@ -831,19 +831,19 @@ discard block |
||
831 | 831 | * @since 1.16.3 |
832 | 832 | * Safeguard until GF implements '<=' operator |
833 | 833 | */ |
834 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
834 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
835 | 835 | $operator = '<'; |
836 | 836 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
837 | 837 | } |
838 | 838 | |
839 | - $filter[] = array( |
|
839 | + $filter[ ] = array( |
|
840 | 840 | 'key' => $filter_key, |
841 | 841 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
842 | 842 | 'operator' => $operator, |
843 | 843 | ); |
844 | 844 | } |
845 | 845 | } else { |
846 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
846 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | break; |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | 'ymd_dot' => 'Y.m.d', |
875 | 875 | ); |
876 | 876 | |
877 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
877 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
878 | 878 | $format = $datepicker[ $field->dateFormat ]; |
879 | 879 | } |
880 | 880 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | public function add_template_path( $file_paths ) { |
906 | 906 | |
907 | 907 | // Index 100 is the default GravityView template path. |
908 | - $file_paths[102] = self::$file . 'templates/'; |
|
908 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
909 | 909 | |
910 | 910 | return $file_paths; |
911 | 911 | } |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | $has_date = false; |
925 | 925 | |
926 | 926 | foreach ( $search_fields as $k => $field ) { |
927 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
927 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
928 | 928 | $has_date = true; |
929 | 929 | break; |
930 | 930 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | } |
952 | 952 | |
953 | 953 | // get configured search fields |
954 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
954 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
955 | 955 | |
956 | 956 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
957 | 957 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -966,34 +966,34 @@ discard block |
||
966 | 966 | |
967 | 967 | $updated_field = $this->get_search_filter_details( $updated_field ); |
968 | 968 | |
969 | - switch ( $field['field'] ) { |
|
969 | + switch ( $field[ 'field' ] ) { |
|
970 | 970 | |
971 | 971 | case 'search_all': |
972 | - $updated_field['key'] = 'search_all'; |
|
973 | - $updated_field['input'] = 'search_all'; |
|
974 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
972 | + $updated_field[ 'key' ] = 'search_all'; |
|
973 | + $updated_field[ 'input' ] = 'search_all'; |
|
974 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
975 | 975 | break; |
976 | 976 | |
977 | 977 | case 'entry_date': |
978 | - $updated_field['key'] = 'entry_date'; |
|
979 | - $updated_field['input'] = 'entry_date'; |
|
980 | - $updated_field['value'] = array( |
|
978 | + $updated_field[ 'key' ] = 'entry_date'; |
|
979 | + $updated_field[ 'input' ] = 'entry_date'; |
|
980 | + $updated_field[ 'value' ] = array( |
|
981 | 981 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
982 | 982 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
983 | 983 | ); |
984 | 984 | break; |
985 | 985 | |
986 | 986 | case 'entry_id': |
987 | - $updated_field['key'] = 'entry_id'; |
|
988 | - $updated_field['input'] = 'entry_id'; |
|
989 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
987 | + $updated_field[ 'key' ] = 'entry_id'; |
|
988 | + $updated_field[ 'input' ] = 'entry_id'; |
|
989 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
990 | 990 | break; |
991 | 991 | |
992 | 992 | case 'created_by': |
993 | - $updated_field['key'] = 'created_by'; |
|
994 | - $updated_field['name'] = 'gv_by'; |
|
995 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
996 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
993 | + $updated_field[ 'key' ] = 'created_by'; |
|
994 | + $updated_field[ 'name' ] = 'gv_by'; |
|
995 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
996 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
997 | 997 | break; |
998 | 998 | } |
999 | 999 | |
@@ -1012,16 +1012,16 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
1014 | 1014 | |
1015 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1015 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1016 | 1016 | |
1017 | 1017 | /** @since 1.14 */ |
1018 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1018 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1019 | 1019 | |
1020 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1020 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1021 | 1021 | |
1022 | 1022 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1023 | 1023 | |
1024 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1024 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1025 | 1025 | |
1026 | 1026 | if ( $this->has_date_field( $search_fields ) ) { |
1027 | 1027 | // enqueue datepicker stuff only if needed! |
@@ -1043,10 +1043,10 @@ discard block |
||
1043 | 1043 | public static function get_search_class( $custom_class = '' ) { |
1044 | 1044 | $gravityview_view = GravityView_View::getInstance(); |
1045 | 1045 | |
1046 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1046 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1047 | 1047 | |
1048 | - if ( ! empty( $custom_class ) ) { |
|
1049 | - $search_class .= ' '.$custom_class; |
|
1048 | + if ( ! empty( $custom_class ) ) { |
|
1049 | + $search_class .= ' ' . $custom_class; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
@@ -1090,9 +1090,9 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | if ( ! $label ) { |
1092 | 1092 | |
1093 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1093 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1094 | 1094 | |
1095 | - switch( $field['field'] ) { |
|
1095 | + switch ( $field[ 'field' ] ) { |
|
1096 | 1096 | case 'search_all': |
1097 | 1097 | $label = __( 'Search Entries:', 'gravityview' ); |
1098 | 1098 | break; |
@@ -1104,10 +1104,10 @@ discard block |
||
1104 | 1104 | break; |
1105 | 1105 | default: |
1106 | 1106 | // If this is a field input, not a field |
1107 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1107 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1108 | 1108 | |
1109 | 1109 | // Get the label for the field in question, which returns an array |
1110 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1110 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1111 | 1111 | |
1112 | 1112 | // Get the item with the `label` key |
1113 | 1113 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1146,32 +1146,32 @@ discard block |
||
1146 | 1146 | $form = $gravityview_view->getForm(); |
1147 | 1147 | |
1148 | 1148 | // for advanced field ids (eg, first name / last name ) |
1149 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1149 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1150 | 1150 | |
1151 | 1151 | // get searched value from $_GET/$_POST (string or array) |
1152 | 1152 | $value = $this->rgget_or_rgpost( $name ); |
1153 | 1153 | |
1154 | 1154 | // get form field details |
1155 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1155 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1156 | 1156 | |
1157 | 1157 | $filter = array( |
1158 | - 'key' => $field['field'], |
|
1158 | + 'key' => $field[ 'field' ], |
|
1159 | 1159 | 'name' => $name, |
1160 | 1160 | 'label' => self::get_field_label( $field, $form_field ), |
1161 | - 'input' => $field['input'], |
|
1161 | + 'input' => $field[ 'input' ], |
|
1162 | 1162 | 'value' => $value, |
1163 | - 'type' => $form_field['type'], |
|
1163 | + 'type' => $form_field[ 'type' ], |
|
1164 | 1164 | ); |
1165 | 1165 | |
1166 | 1166 | // collect choices |
1167 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1168 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1169 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1170 | - $filter['choices'] = $form_field['choices']; |
|
1167 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1168 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1169 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1170 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1174 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1173 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1174 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | return $filter; |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | $choices = array(); |
1197 | 1197 | foreach ( $users as $user ) { |
1198 | - $choices[] = array( |
|
1198 | + $choices[ ] = array( |
|
1199 | 1199 | 'value' => $user->ID, |
1200 | 1200 | 'text' => $user->display_name, |
1201 | 1201 | ); |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | */ |
1251 | 1251 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1252 | 1252 | |
1253 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1253 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1254 | 1254 | |
1255 | 1255 | return $js_dependencies; |
1256 | 1256 | } |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | 'isRTL' => is_rtl(), |
1295 | 1295 | ), $view_data ); |
1296 | 1296 | |
1297 | - $localizations['datepicker'] = $datepicker_settings; |
|
1297 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1298 | 1298 | |
1299 | 1299 | return $localizations; |
1300 | 1300 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | * @return void |
1322 | 1322 | */ |
1323 | 1323 | private function maybe_enqueue_flexibility() { |
1324 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1324 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1325 | 1325 | wp_enqueue_script( 'gv-flexibility' ); |
1326 | 1326 | } |
1327 | 1327 | } |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1344 | 1344 | |
1345 | 1345 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1346 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1346 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1347 | 1347 | |
1348 | 1348 | /** |
1349 | 1349 | * @filter `gravityview_search_datepicker_class` |
@@ -603,7 +603,8 @@ discard block |
||
603 | 603 | // Fast-forward 24 hour on the end time |
604 | 604 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
605 | 605 | $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
606 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
606 | + if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { |
|
607 | +// See https://github.com/gravityview/GravityView/issues/1056 |
|
607 | 608 | $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
608 | 609 | } |
609 | 610 | } |
@@ -874,7 +875,7 @@ discard block |
||
874 | 875 | 'ymd_dot' => 'Y.m.d', |
875 | 876 | ); |
876 | 877 | |
877 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
878 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
878 | 879 | $format = $datepicker[ $field->dateFormat ]; |
879 | 880 | } |
880 | 881 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function is_add_oembed_preview() { |
47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return boolean |
64 | 64 | */ |
65 | 65 | public static function is_rest() { |
66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | $get = $_GET; |
142 | 142 | } |
143 | 143 | |
144 | - unset( $get['mode'] ); |
|
144 | + unset( $get[ 'mode' ] ); |
|
145 | 145 | |
146 | 146 | $get = array_filter( $get, 'gravityview_is_not_empty_string' ); |
147 | 147 | |
148 | - if( $has_field_key = $this->_has_field_key( $get ) ) { |
|
148 | + if ( $has_field_key = $this->_has_field_key( $get ) ) { |
|
149 | 149 | return true; |
150 | 150 | } |
151 | 151 | |
152 | - return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ); |
|
152 | + return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | |
173 | 173 | $meta = array(); |
174 | 174 | foreach ( $fields as $field ) { |
175 | - if( empty( $field->_gf_field_class_name ) ) { |
|
176 | - $meta[] = preg_quote( $field->name ); |
|
175 | + if ( empty( $field->_gf_field_class_name ) ) { |
|
176 | + $meta[ ] = preg_quote( $field->name ); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | foreach ( $get as $key => $value ) { |
181 | - if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) { |
|
181 | + if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) { |
|
182 | 182 | $has_field_key = true; |
183 | 183 | break; |
184 | 184 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | 'detail' => null, |
38 | 38 | ) ); |
39 | 39 | |
40 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
41 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
40 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
41 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
42 | 42 | $view_id = $view->ID; |
43 | 43 | } |
44 | 44 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return get_the_password_form( $view->ID ); |
81 | 81 | } |
82 | 82 | |
83 | - if ( ! $view->form ) { |
|
83 | + if ( ! $view->form ) { |
|
84 | 84 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
85 | 85 | |
86 | 86 | /** |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
102 | 102 | } |
103 | 103 | |
104 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
104 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * View details. |
108 | 108 | */ |
109 | - if ( $atts['detail'] ) { |
|
109 | + if ( $atts[ 'detail' ] ) { |
|
110 | 110 | return $this->detail( $view, $entries, $atts ); |
111 | 111 | |
112 | 112 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return ''; |
121 | 121 | } |
122 | 122 | |
123 | - if ( $entry['status'] != 'active' ) { |
|
123 | + if ( $entry[ 'status' ] != 'active' ) { |
|
124 | 124 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
125 | 125 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
134 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
134 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
135 | 135 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
136 | 136 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
137 | 137 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | return ''; |
152 | 152 | } |
153 | 153 | |
154 | - if ( $entry['status'] != 'active' ) { |
|
154 | + if ( $entry[ 'status' ] != 'active' ) { |
|
155 | 155 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
156 | 156 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
157 | 157 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
165 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
165 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
166 | 166 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
167 | 167 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
168 | 168 | } |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | |
180 | 180 | // Mock the request with the actual View, not the global one |
181 | 181 | $mock_request = new \GV\Mock_Request(); |
182 | - $mock_request->returns['is_view'] = $view; |
|
183 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
184 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
185 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
182 | + $mock_request->returns[ 'is_view' ] = $view; |
|
183 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
184 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
185 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
186 | 186 | |
187 | 187 | $request = $mock_request; |
188 | 188 | } |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
219 | 219 | |
220 | 220 | // Only keep the passed attributes after making sure that they're valid pairs |
221 | - $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts; |
|
221 | + $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts; |
|
222 | 222 | |
223 | 223 | $atts = array(); |
224 | 224 | |
225 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
225 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
226 | 226 | |
227 | 227 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
228 | 228 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
229 | 229 | |
230 | - switch( $defaults[ $key ]['type'] ) { |
|
230 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Make sure number fields are numeric. |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
236 | 236 | */ |
237 | 237 | case 'number': |
238 | - if( is_numeric( $passed_value ) ) { |
|
238 | + if ( is_numeric( $passed_value ) ) { |
|
239 | 239 | $atts[ $key ] = ( $passed_value + 0 ); |
240 | 240 | } |
241 | 241 | break; |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | */ |
251 | 251 | case 'select': |
252 | 252 | case 'radio': |
253 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
254 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
253 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
254 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
255 | 255 | $atts[ $key ] = $passed_value; |
256 | 256 | } |
257 | 257 | break; |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
266 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
267 | 267 | |
268 | 268 | return $atts; |
269 | 269 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | private function detail( $view, $entries, $atts ) { |
281 | 281 | $output = ''; |
282 | 282 | |
283 | - switch ( $key = $atts['detail'] ): |
|
283 | + switch ( $key = $atts[ 'detail' ] ): |
|
284 | 284 | case 'total_entries': |
285 | 285 | $output = number_format_i18n( $entries->total() ); |
286 | 286 | break; |