@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_searchable = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
17 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
18 | 18 | |
19 | 19 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
20 | 20 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
29 | 29 | |
30 | - if( 'edit' === $context ) { |
|
30 | + if ( 'edit' === $context ) { |
|
31 | 31 | return $field_options; |
32 | 32 | } |
33 | 33 | |
34 | - $this->add_field_support('dynamic_data', $field_options ); |
|
35 | - $this->add_field_support('link_to_term', $field_options ); |
|
34 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
35 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
36 | 36 | |
37 | 37 | return $field_options; |
38 | 38 | } |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | |
31 | 31 | $label = ''; |
32 | 32 | |
33 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
33 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
34 | 34 | |
35 | - $label = $field['label']; |
|
35 | + $label = $field[ 'label' ]; |
|
36 | 36 | |
37 | 37 | // Support Gravity Forms 1.9+ |
38 | - if( class_exists( 'GF_Field' ) ) { |
|
38 | + if ( class_exists( 'GF_Field' ) ) { |
|
39 | 39 | |
40 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
40 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
41 | 41 | |
42 | - if( $field_object ) { |
|
42 | + if ( $field_object ) { |
|
43 | 43 | |
44 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
44 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
45 | 45 | |
46 | 46 | // This is a complex field, with labels on a per-input basis |
47 | - if( $input ) { |
|
47 | + if ( $input ) { |
|
48 | 48 | |
49 | 49 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
50 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
50 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
51 | 51 | |
52 | 52 | } else { |
53 | 53 | |
54 | 54 | // This is a field with one label |
55 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
55 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
64 | - if ( !empty( $field['custom_label'] ) ) { |
|
64 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
65 | 65 | |
66 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
66 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | |
118 | 118 | $width = NULL; |
119 | 119 | |
120 | - if( !empty( $field['width'] ) ) { |
|
121 | - $width = absint( $field['width'] ); |
|
120 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
121 | + $width = absint( $field[ 'width' ] ); |
|
122 | 122 | |
123 | 123 | // If using percentages, limit to 100% |
124 | - if( '%d%%' === $format && $width > 100 ) { |
|
124 | + if ( '%d%%' === $format && $width > 100 ) { |
|
125 | 125 | $width = 100; |
126 | 126 | } |
127 | 127 | |
@@ -144,39 +144,39 @@ discard block |
||
144 | 144 | |
145 | 145 | $classes = array(); |
146 | 146 | |
147 | - if( !empty( $field['custom_class'] ) ) { |
|
147 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field[ 'custom_class' ]; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if ( ! empty( $entry ) ) { |
|
152 | 152 | |
153 | 153 | // We want the merge tag to be formatted as a class. The merge tag may be |
154 | 154 | // replaced by a multiple-word value that should be output as a single class. |
155 | 155 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
156 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
157 | 157 | |
158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
159 | 159 | |
160 | 160 | // And then we want life to return to normal |
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
161 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
165 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | - if(!empty($field['id'])) { |
|
170 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
171 | - $form_id = '-'.$form['id']; |
|
169 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
170 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
171 | + $form_id = '-' . $form[ 'id' ]; |
|
172 | 172 | } else { |
173 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
173 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
174 | 174 | } |
175 | 175 | |
176 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
176 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
177 | 177 | } |
178 | 178 | |
179 | - return esc_attr(implode(' ', $classes)); |
|
179 | + return esc_attr( implode( ' ', $classes ) ); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
195 | 195 | $gravityview_view = GravityView_View::getInstance(); |
196 | - $id = $field['id']; |
|
196 | + $id = $field[ 'id' ]; |
|
197 | 197 | |
198 | 198 | if ( ! empty( $id ) ) { |
199 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
200 | - $form_id = '-' . $form['id']; |
|
199 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
200 | + $form_id = '-' . $form[ 'id' ]; |
|
201 | 201 | } else { |
202 | 202 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
203 | 203 | } |
204 | 204 | |
205 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
205 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return esc_attr( $id ); |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
221 | 221 | |
222 | - if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
222 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
223 | 223 | return NULL; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $gravityview_view = GravityView_View::getInstance(); |
227 | 227 | |
228 | - $field_id = $field_settings['id']; |
|
228 | + $field_id = $field_settings[ 'id' ]; |
|
229 | 229 | $form = $gravityview_view->getForm(); |
230 | 230 | $field = gravityview_get_field( $form, $field_id ); |
231 | 231 | |
232 | - if( $field && is_numeric( $field_id ) ) { |
|
232 | + if ( $field && is_numeric( $field_id ) ) { |
|
233 | 233 | // Used as file name of field template in GV. |
234 | 234 | // Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field |
235 | 235 | $field_type = $field->type; |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // If a Gravity Forms Field is found, get the field display |
243 | - if( $field ) { |
|
243 | + if ( $field ) { |
|
244 | 244 | |
245 | 245 | // Prevent any PHP warnings that may be generated |
246 | 246 | ob_start(); |
247 | 247 | |
248 | - $display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format ); |
|
248 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
249 | 249 | |
250 | 250 | if ( $errors = ob_get_clean() ) { |
251 | 251 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
255 | 255 | |
256 | 256 | // prevent the use of merge_tags for non-admin fields |
257 | - if( !empty( $field->adminOnly ) ) { |
|
257 | + if ( ! empty( $field->adminOnly ) ) { |
|
258 | 258 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
259 | 259 | } |
260 | 260 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | // Check whether the field exists in /includes/fields/{$field_type}.php |
266 | 266 | // This can be overridden by user template files. |
267 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
267 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
268 | 268 | |
269 | 269 | // Set the field data to be available in the templates |
270 | 270 | $gravityview_view->setCurrentField( array( |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | 'entry' => $entry, |
279 | 279 | 'field_type' => $field_type, /** {@since 1.6} */ |
280 | 280 | 'field_path' => $field_path, /** {@since 1.16} */ |
281 | - )); |
|
281 | + ) ); |
|
282 | 282 | |
283 | - if( ! empty( $field_path ) ) { |
|
283 | + if ( ! empty( $field_path ) ) { |
|
284 | 284 | |
285 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
285 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
286 | 286 | |
287 | 287 | ob_start(); |
288 | 288 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | |
300 | 300 | // Get the field settings again so that the field template can override the settings |
301 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
301 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link` |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
317 | 317 | * |
318 | 318 | */ |
319 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
319 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
320 | 320 | |
321 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
321 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
322 | 322 | |
323 | 323 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
324 | 324 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $field_settings Settings for the particular GV field |
333 | 333 | * @param array $field Current field being displayed |
334 | 334 | */ |
335 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
335 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
363 | 363 | |
364 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
364 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
365 | 365 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
366 | 366 | return NULL; |
367 | 367 | } |
368 | 368 | |
369 | 369 | $href = self::entry_link( $entry ); |
370 | 370 | |
371 | - if( '' === $href ) { |
|
371 | + if ( '' === $href ) { |
|
372 | 372 | return NULL; |
373 | 373 | } |
374 | 374 | |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | * @param boolean $wpautop Apply wpautop() to the output? |
392 | 392 | * @return string HTML of "no results" text |
393 | 393 | */ |
394 | - public static function no_results($wpautop = true) { |
|
394 | + public static function no_results( $wpautop = true ) { |
|
395 | 395 | $gravityview_view = GravityView_View::getInstance(); |
396 | 396 | |
397 | 397 | $is_search = false; |
398 | 398 | |
399 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
399 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
400 | 400 | $is_search = true; |
401 | 401 | } |
402 | 402 | |
403 | - if($is_search) { |
|
404 | - $output = __('This search returned no results.', 'gravityview'); |
|
403 | + if ( $is_search ) { |
|
404 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
405 | 405 | } else { |
406 | - $output = __('No entries match your request.', 'gravityview'); |
|
406 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -411,9 +411,9 @@ discard block |
||
411 | 411 | * @param string $output The existing "No Entries" text |
412 | 412 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
413 | 413 | */ |
414 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
414 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
415 | 415 | |
416 | - return $wpautop ? wpautop($output) : $output; |
|
416 | + return $wpautop ? wpautop( $output ) : $output; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
@@ -430,37 +430,37 @@ discard block |
||
430 | 430 | |
431 | 431 | $gravityview_view = GravityView_View::getInstance(); |
432 | 432 | |
433 | - if( empty( $post_id ) ) { |
|
433 | + if ( empty( $post_id ) ) { |
|
434 | 434 | |
435 | 435 | $post_id = false; |
436 | 436 | |
437 | 437 | // DataTables passes the Post ID |
438 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
438 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
439 | 439 | |
440 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
440 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
441 | 441 | |
442 | 442 | } else { |
443 | 443 | |
444 | 444 | // The Post ID has been passed via the shortcode |
445 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
445 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
446 | 446 | |
447 | 447 | $post_id = $gravityview_view->getPostId(); |
448 | 448 | |
449 | 449 | } else { |
450 | 450 | |
451 | 451 | // This is a GravityView post type |
452 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
452 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
453 | 453 | |
454 | 454 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
455 | 455 | |
456 | 456 | } else { |
457 | 457 | |
458 | 458 | // This is an embedded GravityView; use the embedded post's ID as the base. |
459 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
459 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
460 | 460 | |
461 | 461 | $post_id = $post->ID; |
462 | 462 | |
463 | - } elseif( $gravityview_view->getViewId() ) { |
|
463 | + } elseif ( $gravityview_view->getViewId() ) { |
|
464 | 464 | |
465 | 465 | // The GravityView has been embedded in a widget or in a template, and |
466 | 466 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -475,36 +475,36 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | // No post ID, get outta here. |
478 | - if( empty( $post_id ) ) { |
|
478 | + if ( empty( $post_id ) ) { |
|
479 | 479 | return NULL; |
480 | 480 | } |
481 | 481 | |
482 | 482 | // If we've saved the permalink in memory, use it |
483 | 483 | // @since 1.3 |
484 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
484 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
485 | 485 | |
486 | - if( empty( $link ) ) { |
|
486 | + if ( empty( $link ) ) { |
|
487 | 487 | |
488 | 488 | $link = get_permalink( $post_id ); |
489 | 489 | |
490 | 490 | // If not yet saved, cache the permalink. |
491 | 491 | // @since 1.3 |
492 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
492 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | 496 | // Deal with returning to proper pagination for embedded views |
497 | - if( $link && $add_query_args ) { |
|
497 | + if ( $link && $add_query_args ) { |
|
498 | 498 | |
499 | 499 | $args = array(); |
500 | 500 | |
501 | - if( $pagenum = rgget('pagenum') ) { |
|
502 | - $args['pagenum'] = intval( $pagenum ); |
|
501 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
502 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
503 | 503 | } |
504 | 504 | |
505 | - if( $sort = rgget('sort') ) { |
|
506 | - $args['sort'] = $sort; |
|
507 | - $args['dir'] = rgget('dir'); |
|
505 | + if ( $sort = rgget( 'sort' ) ) { |
|
506 | + $args[ 'sort' ] = $sort; |
|
507 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | $link = add_query_arg( $args, $link ); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
536 | 536 | |
537 | 537 | // Generate an unique hash to use as the default value |
538 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
538 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
547 | 547 | |
548 | 548 | // Make sure we have something - use the original ID as backup. |
549 | - if( empty( $slug ) ) { |
|
549 | + if ( empty( $slug ) ) { |
|
550 | 550 | $slug = $id; |
551 | 551 | } |
552 | 552 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
576 | 576 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
577 | 577 | */ |
578 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
578 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
579 | 579 | |
580 | 580 | // If we're using custom slug... |
581 | 581 | if ( $custom ) { |
@@ -589,8 +589,8 @@ discard block |
||
589 | 589 | // If it does have a hash set, and the hash is expected, use it. |
590 | 590 | // This check allows users to change the hash structure using the |
591 | 591 | // gravityview_entry_hash filter and have the old hashes expire. |
592 | - if( empty( $value ) || $value !== $hash ) { |
|
593 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash ); |
|
592 | + if ( empty( $value ) || $value !== $hash ) { |
|
593 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash ); |
|
594 | 594 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
595 | 595 | } |
596 | 596 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | * @param boolean $custom Should we process the custom entry slug? |
617 | 617 | */ |
618 | 618 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
619 | - if( $custom ) { |
|
619 | + if ( $custom ) { |
|
620 | 620 | // create the gravityview_unique_id and save it |
621 | 621 | |
622 | 622 | // Get the entry hash |
623 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
623 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
624 | 624 | |
625 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash ); |
|
625 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash ); |
|
626 | 626 | |
627 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
627 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
628 | 628 | |
629 | 629 | } |
630 | 630 | } |
@@ -641,14 +641,14 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
643 | 643 | |
644 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
644 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
645 | 645 | $entry = GVCommon::get_entry( $entry ); |
646 | - } else if( empty( $entry ) ) { |
|
646 | + } else if ( empty( $entry ) ) { |
|
647 | 647 | $entry = GravityView_frontend::getInstance()->getEntry(); |
648 | 648 | } |
649 | 649 | |
650 | 650 | // Second parameter used to be passed as $field; this makes sure it's not an array |
651 | - if( !is_numeric( $post_id ) ) { |
|
651 | + if ( ! is_numeric( $post_id ) ) { |
|
652 | 652 | $post_id = NULL; |
653 | 653 | } |
654 | 654 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | $directory_link = self::directory_link( $post_id, false ); |
657 | 657 | |
658 | 658 | // No post ID? Get outta here. |
659 | - if( empty( $directory_link ) ) { |
|
659 | + if ( empty( $directory_link ) ) { |
|
660 | 660 | return ''; |
661 | 661 | } |
662 | 662 | |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
668 | 668 | } |
669 | 669 | |
670 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
670 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
671 | 671 | |
672 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
672 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
673 | 673 | |
674 | 674 | $args = array(); |
675 | 675 | |
@@ -679,9 +679,9 @@ discard block |
||
679 | 679 | */ |
680 | 680 | $link_parts = explode( '?', $directory_link ); |
681 | 681 | |
682 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
682 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
683 | 683 | |
684 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
684 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
685 | 685 | |
686 | 686 | } else { |
687 | 687 | |
@@ -691,18 +691,18 @@ discard block |
||
691 | 691 | /** |
692 | 692 | * @since 1.7.3 |
693 | 693 | */ |
694 | - if( $add_directory_args ) { |
|
694 | + if ( $add_directory_args ) { |
|
695 | 695 | |
696 | - if( !empty( $_GET['pagenum'] ) ) { |
|
697 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
696 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
697 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /** |
701 | 701 | * @since 1.7 |
702 | 702 | */ |
703 | - if( $sort = rgget('sort') ) { |
|
704 | - $args['sort'] = $sort; |
|
705 | - $args['dir'] = rgget('dir'); |
|
703 | + if ( $sort = rgget( 'sort' ) ) { |
|
704 | + $args[ 'sort' ] = $sort; |
|
705 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | } |
@@ -712,8 +712,8 @@ discard block |
||
712 | 712 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
713 | 713 | * @see GravityView_frontend::get_context_view_id() |
714 | 714 | */ |
715 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
716 | - $args['gvid'] = gravityview_get_view_id(); |
|
715 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
716 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | return add_query_arg( $args, $directory_link ); |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | } |
732 | 732 | |
733 | 733 | function gv_class( $field, $form = NULL, $entry = array() ) { |
734 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
734 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | /** |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | |
754 | 754 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
755 | 755 | |
756 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
756 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
757 | 757 | $default_css_class .= ' hidden'; |
758 | 758 | } |
759 | 759 | |
760 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
760 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
761 | 761 | $default_css_class .= ' gv-container-no-results'; |
762 | 762 | } |
763 | 763 | |
764 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
764 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
765 | 765 | |
766 | 766 | /** |
767 | 767 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | |
773 | 773 | $css_class = gravityview_sanitize_html_class( $css_class ); |
774 | 774 | |
775 | - if( $echo ) { |
|
775 | + if ( $echo ) { |
|
776 | 776 | echo $css_class; |
777 | 777 | } |
778 | 778 | |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | |
784 | 784 | $value = GravityView_API::field_value( $entry, $field ); |
785 | 785 | |
786 | - if( $value === '' ) { |
|
786 | + if ( $value === '' ) { |
|
787 | 787 | /** |
788 | 788 | * @filter `gravityview_empty_value` What to display when a field is empty |
789 | 789 | * @param string $value (empty string) |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | return GravityView_API::entry_link( $entry, $post_id ); |
803 | 803 | } |
804 | 804 | |
805 | -function gv_no_results($wpautop = true) { |
|
805 | +function gv_no_results( $wpautop = true ) { |
|
806 | 806 | return GravityView_API::no_results( $wpautop ); |
807 | 807 | } |
808 | 808 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | */ |
824 | 824 | $href = apply_filters( 'gravityview_go_back_url', $href ); |
825 | 825 | |
826 | - if( empty( $href ) ) { return NULL; } |
|
826 | + if ( empty( $href ) ) { return NULL; } |
|
827 | 827 | |
828 | 828 | // calculate link label |
829 | 829 | $gravityview_view = GravityView_View::getInstance(); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | |
840 | 840 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
841 | 841 | 'data-viewid' => $gravityview_view->getViewId() |
842 | - )); |
|
842 | + ) ); |
|
843 | 843 | |
844 | 844 | return $link; |
845 | 845 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | */ |
859 | 859 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
860 | 860 | |
861 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
861 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
862 | 862 | |
863 | 863 | // For the complete field value as generated by Gravity Forms |
864 | 864 | return $display_value; |
@@ -888,16 +888,16 @@ discard block |
||
888 | 888 | |
889 | 889 | $terms = explode( ', ', $value ); |
890 | 890 | |
891 | - foreach ($terms as $term_name ) { |
|
891 | + foreach ( $terms as $term_name ) { |
|
892 | 892 | |
893 | 893 | // If we're processing a category, |
894 | - if( $taxonomy === 'category' ) { |
|
894 | + if ( $taxonomy === 'category' ) { |
|
895 | 895 | |
896 | 896 | // Use rgexplode to prevent errors if : doesn't exist |
897 | 897 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
898 | 898 | |
899 | 899 | // The explode was succesful; we have the category ID |
900 | - if( !empty( $term_id )) { |
|
900 | + if ( ! empty( $term_id ) ) { |
|
901 | 901 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
902 | 902 | } else { |
903 | 903 | // We have to fall back to the name |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | } |
911 | 911 | |
912 | 912 | // There's still a tag/category here. |
913 | - if( $term ) { |
|
913 | + if ( $term ) { |
|
914 | 914 | |
915 | 915 | $term_link = get_term_link( $term, $taxonomy ); |
916 | 916 | |
@@ -919,11 +919,11 @@ discard block |
||
919 | 919 | continue; |
920 | 920 | } |
921 | 921 | |
922 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
922 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | |
926 | - return implode(', ', $output ); |
|
926 | + return implode( ', ', $output ); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | /** |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | |
938 | 938 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
939 | 939 | |
940 | - if( empty( $link ) ) { |
|
941 | - return strip_tags( $output); |
|
940 | + if ( empty( $link ) ) { |
|
941 | + return strip_tags( $output ); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | return $output; |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | $fe = GravityView_frontend::getInstance(); |
958 | 958 | |
959 | 959 | // Solve problem when loading content via admin-ajax.php |
960 | - if( ! $fe->getGvOutputData() ) { |
|
960 | + if ( ! $fe->getGvOutputData() ) { |
|
961 | 961 | |
962 | 962 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
963 | 963 | |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | } |
966 | 966 | |
967 | 967 | // Make 100% sure that we're dealing with a properly called situation |
968 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
968 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
969 | 969 | |
970 | 970 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
971 | 971 | |
@@ -985,10 +985,10 @@ discard block |
||
985 | 985 | |
986 | 986 | $fe = GravityView_frontend::getInstance(); |
987 | 987 | |
988 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
988 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
989 | 989 | |
990 | 990 | // If not set, grab the current view ID |
991 | - if( empty( $view_id ) ) { |
|
991 | + if ( empty( $view_id ) ) { |
|
992 | 992 | $view_id = $fe->get_context_view_id(); |
993 | 993 | } |
994 | 994 | |
@@ -1053,11 +1053,11 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
1055 | 1055 | |
1056 | - if( $is_edit_entry ) { |
|
1056 | + if ( $is_edit_entry ) { |
|
1057 | 1057 | $context = 'edit'; |
1058 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1058 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1059 | 1059 | $context = 'single'; |
1060 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1060 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
1061 | 1061 | $context = GravityView_View::getInstance()->getContext(); |
1062 | 1062 | } |
1063 | 1063 | |
@@ -1085,12 +1085,12 @@ discard block |
||
1085 | 1085 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
1086 | 1086 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1087 | 1087 | |
1088 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1089 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1088 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1089 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1093 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1092 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1093 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1168,12 +1168,12 @@ discard block |
||
1168 | 1168 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
1169 | 1169 | |
1170 | 1170 | // Required fields. |
1171 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1171 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1172 | 1172 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
1173 | 1173 | return ''; |
1174 | 1174 | } |
1175 | 1175 | |
1176 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1176 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1177 | 1177 | |
1178 | 1178 | /** |
1179 | 1179 | * Create the content variables for replacing. |
@@ -1189,37 +1189,37 @@ discard block |
||
1189 | 1189 | 'field_id' => '', |
1190 | 1190 | ); |
1191 | 1191 | |
1192 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1192 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
1193 | 1193 | |
1194 | 1194 | // If the value is empty and we're hiding empty, return empty. |
1195 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1195 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1196 | 1196 | return ''; |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1200 | - $context['value'] = wpautop( $context['value'] ); |
|
1199 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1200 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | // Get width setting, if exists |
1204 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1204 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
1205 | 1205 | |
1206 | 1206 | // If replacing with CSS inline formatting, let's do it. |
1207 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1207 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
1208 | 1208 | |
1209 | 1209 | // Grab the Class using `gv_class` |
1210 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1211 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1210 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1211 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
1212 | 1212 | |
1213 | 1213 | // Get field label if needed |
1214 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1215 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1214 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
1215 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Default Label value |
1219 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1219 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
1220 | 1220 | |
1221 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1222 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1221 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
1222 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | /** |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | * @param string $markup The HTML for the markup |
1229 | 1229 | * @param array $args All args for the field output |
1230 | 1230 | */ |
1231 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1231 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
1232 | 1232 | |
1233 | 1233 | /** |
1234 | 1234 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | foreach ( $context as $tag => $value ) { |
1252 | 1252 | |
1253 | 1253 | // If the tag doesn't exist just skip it |
1254 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1254 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1255 | 1255 | continue; |
1256 | 1256 | } |
1257 | 1257 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data ); |
55 | 55 | |
56 | - return (bool) $hide_coupon_fields; |
|
56 | + return (bool)$hide_coupon_fields; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) { |
70 | 70 | |
71 | 71 | if ( $this->should_hide_coupon_fields( $entry ) ) { |
72 | - $blacklist[] = 'coupon'; |
|
72 | + $blacklist[ ] = 'coupon'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $blacklist; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // No coupons match the codes provided |
108 | 108 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
109 | 109 | |
110 | - if( ! $discounts ) { |
|
110 | + if ( ! $discounts ) { |
|
111 | 111 | return $value; |
112 | 112 | } |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @see GF_Field_Coupon::get_field_input |
117 | 117 | */ |
118 | 118 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
119 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
119 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
120 | 120 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
121 | 121 | |
122 | 122 | return $value; |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * @hack |
|
310 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
311 | - */ |
|
309 | + * @hack |
|
310 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
311 | + */ |
|
312 | 312 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
313 | - continue; |
|
314 | - } |
|
313 | + continue; |
|
314 | + } |
|
315 | 315 | $fields["{$input['id']}"] = array( |
316 | 316 | 'label' => rgar( $input, 'label' ), |
317 | 317 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
489 | 489 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
490 | 490 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
491 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
491 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
492 | 492 | $criteria['context_view_id'] = null; |
493 | 493 | } |
494 | 494 | |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | ), |
1252 | 1252 | ); |
1253 | 1253 | |
1254 | - $fields = $date_created + $fields; |
|
1254 | + $fields = $date_created + $fields; |
|
1255 | 1255 | |
1256 | 1256 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1257 | 1257 | |
@@ -1263,13 +1263,13 @@ discard block |
||
1263 | 1263 | } |
1264 | 1264 | } |
1265 | 1265 | |
1266 | - /** |
|
1267 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1268 | - * @since 1.12 |
|
1269 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1270 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1271 | - */ |
|
1272 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1266 | + /** |
|
1267 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1268 | + * @since 1.12 |
|
1269 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1270 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1271 | + */ |
|
1272 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1273 | 1273 | |
1274 | 1274 | return $fields; |
1275 | 1275 | } |
@@ -1561,26 +1561,26 @@ discard block |
||
1561 | 1561 | } |
1562 | 1562 | |
1563 | 1563 | |
1564 | - /** |
|
1565 | - * Display updated/error notice |
|
1566 | - * |
|
1567 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
1568 | - * |
|
1569 | - * @param string $notice text/HTML of notice |
|
1570 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1571 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1572 | - * |
|
1573 | - * @return string |
|
1574 | - */ |
|
1575 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1576 | - |
|
1577 | - // If $cap is defined, only show notice if user has capability |
|
1578 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1579 | - return ''; |
|
1580 | - } |
|
1581 | - |
|
1582 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1583 | - } |
|
1564 | + /** |
|
1565 | + * Display updated/error notice |
|
1566 | + * |
|
1567 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
1568 | + * |
|
1569 | + * @param string $notice text/HTML of notice |
|
1570 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1571 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1572 | + * |
|
1573 | + * @return string |
|
1574 | + */ |
|
1575 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1576 | + |
|
1577 | + // If $cap is defined, only show notice if user has capability |
|
1578 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1579 | + return ''; |
|
1580 | + } |
|
1581 | + |
|
1582 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1583 | + } |
|
1584 | 1584 | |
1585 | 1585 | /** |
1586 | 1586 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
327 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
328 | 328 | $has_product_fields = true; |
329 | 329 | } |
330 | 330 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $fields = array(); |
386 | 386 | |
387 | - foreach ( $extra_fields as $key => $field ){ |
|
387 | + foreach ( $extra_fields as $key => $field ) { |
|
388 | 388 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
389 | 389 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
390 | 390 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $form = GFAPI::get_form( $form ); |
979 | 979 | } |
980 | 980 | |
981 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
981 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
982 | 982 | return GFFormsModel::get_field( $form, $field_id ); |
983 | 983 | } else { |
984 | 984 | return null; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $shortcodes = array(); |
1026 | 1026 | |
1027 | 1027 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1028 | - if ( empty( $matches ) ){ |
|
1028 | + if ( empty( $matches ) ) { |
|
1029 | 1029 | return false; |
1030 | 1030 | } |
1031 | 1031 |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $form = false; |
128 | 128 | |
129 | - if( $entry ) { |
|
130 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
129 | + if ( $entry ) { |
|
130 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $form; |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | |
194 | 194 | $has_transaction_data = rgar( $entry, $meta, false ); |
195 | 195 | |
196 | - if( ! empty( $has_transaction_data ) ) { |
|
196 | + if ( ! empty( $has_transaction_data ) ) { |
|
197 | 197 | break; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | - return (bool) $has_transaction_data; |
|
201 | + return (bool)$has_transaction_data; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
238 | 238 | |
239 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
239 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
240 | 240 | |
241 | 241 | return $result; |
242 | 242 | } |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
255 | 255 | */ |
256 | - public static function get_forms( $active = true, $trash = false ) { |
|
256 | + public static function get_forms( $active = true, $trash = false ) { |
|
257 | 257 | $forms = array(); |
258 | 258 | if ( class_exists( 'GFAPI' ) ) { |
259 | - if( 'any' === $active ) { |
|
259 | + if ( 'any' === $active ) { |
|
260 | 260 | $active_forms = GFAPI::get_forms( true, $trash ); |
261 | 261 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
262 | 262 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $has_post_fields = false; |
288 | 288 | |
289 | 289 | if ( $form ) { |
290 | - foreach ( $form['fields'] as $field ) { |
|
291 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
292 | - $fields["{$field['id']}"] = array( |
|
290 | + foreach ( $form[ 'fields' ] as $field ) { |
|
291 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
292 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
293 | 293 | 'label' => rgar( $field, 'label' ), |
294 | 294 | 'parent' => null, |
295 | 295 | 'type' => rgar( $field, 'type' ), |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | ); |
299 | 299 | } |
300 | 300 | |
301 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
302 | - foreach ( $field['inputs'] as $input ) { |
|
301 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
302 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
303 | 303 | |
304 | - if( ! empty( $input['isHidden'] ) ) { |
|
304 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | * @hack |
310 | 310 | * In case of email/email confirmation, the input for email has the same id as the parent field |
311 | 311 | */ |
312 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
312 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
313 | 313 | continue; |
314 | 314 | } |
315 | - $fields["{$input['id']}"] = array( |
|
315 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
316 | 316 | 'label' => rgar( $input, 'label' ), |
317 | 317 | 'customLabel' => rgar( $input, 'customLabel' ), |
318 | 318 | 'parent' => $field, |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
327 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
328 | 328 | $has_product_fields = true; |
329 | 329 | } |
330 | 330 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @since 1.7 |
339 | 339 | */ |
340 | 340 | if ( $has_post_fields ) { |
341 | - $fields['post_id'] = array( |
|
341 | + $fields[ 'post_id' ] = array( |
|
342 | 342 | 'label' => __( 'Post ID', 'gravityview' ), |
343 | 343 | 'type' => 'post_id', |
344 | 344 | ); |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | foreach ( $payment_fields as $payment_field ) { |
352 | 352 | |
353 | 353 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
354 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
354 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - $fields["{$payment_field->name}"] = array( |
|
358 | + $fields[ "{$payment_field->name}" ] = array( |
|
359 | 359 | 'label' => $payment_field->label, |
360 | 360 | 'desc' => $payment_field->description, |
361 | 361 | 'type' => $payment_field->name, |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | |
388 | 388 | $fields = array(); |
389 | 389 | |
390 | - foreach ( $extra_fields as $key => $field ){ |
|
391 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
392 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
390 | + foreach ( $extra_fields as $key => $field ) { |
|
391 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
392 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -429,32 +429,32 @@ discard block |
||
429 | 429 | 'search_criteria' => null, |
430 | 430 | 'sorting' => null, |
431 | 431 | 'paging' => null, |
432 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
432 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
433 | 433 | ); |
434 | 434 | |
435 | 435 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
436 | 436 | |
437 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
438 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
437 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
438 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
439 | 439 | |
440 | 440 | if ( ! is_array( $filter ) ) { |
441 | 441 | continue; |
442 | 442 | } |
443 | 443 | |
444 | 444 | // By default, we want searches to be wildcard for each field. |
445 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
445 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
449 | 449 | * @param string $operator Existing search operator |
450 | 450 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
451 | 451 | */ |
452 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
452 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | // don't send just the [mode] without any field filter. |
456 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
457 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
456 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
457 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
@@ -465,36 +465,36 @@ discard block |
||
465 | 465 | * Prepare date formats to be in Gravity Forms DB format; |
466 | 466 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
467 | 467 | */ |
468 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
468 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
469 | 469 | |
470 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
470 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
471 | 471 | |
472 | 472 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
473 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
473 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
474 | 474 | |
475 | 475 | if ( $date ) { |
476 | 476 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
477 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
477 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
478 | 478 | } else { |
479 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
479 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
480 | 480 | |
481 | 481 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
482 | - unset( $criteria['search_criteria'][ $key ] ); |
|
482 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | 487 | |
488 | 488 | // Calculate the context view id and send it to the advanced filter |
489 | - if( GravityView_frontend::getInstance()->getSingleEntry() ) { |
|
490 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
489 | + if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
|
490 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
491 | 491 | } elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
492 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
492 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
493 | 493 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
494 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
495 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
494 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
495 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
496 | 496 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
497 | - $criteria['context_view_id'] = null; |
|
497 | + $criteria[ 'context_view_id' ] = null; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param array $form_ids Forms to search |
504 | 504 | * @param int $view_id ID of the view being used to search |
505 | 505 | */ |
506 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
506 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
507 | 507 | |
508 | 508 | return (array)$criteria; |
509 | 509 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | /** Reduce # of database calls */ |
534 | 534 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
535 | 535 | |
536 | - if ( ! empty( $criteria['cache'] ) ) { |
|
536 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
537 | 537 | |
538 | 538 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
539 | 539 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | // Still update the total count when using cached results |
543 | 543 | if ( ! is_null( $total ) ) { |
544 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
544 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | $return = $entries; |
@@ -561,9 +561,9 @@ discard block |
||
561 | 561 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
562 | 562 | |
563 | 563 | // No entries returned from gravityview_before_get_entries |
564 | - if( is_null( $entries ) ) { |
|
564 | + if ( is_null( $entries ) ) { |
|
565 | 565 | |
566 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
566 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
567 | 567 | |
568 | 568 | if ( is_wp_error( $entries ) ) { |
569 | 569 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
575 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
576 | 576 | |
577 | 577 | // Cache results |
578 | 578 | $Cache->set( $entries, 'entries' ); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | */ |
678 | 678 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
679 | 679 | |
680 | - if( $check_entry_display ) { |
|
680 | + if ( $check_entry_display ) { |
|
681 | 681 | // Is the entry allowed |
682 | 682 | $entry = self::check_entry_display( $entry ); |
683 | 683 | } |
@@ -710,12 +710,12 @@ discard block |
||
710 | 710 | |
711 | 711 | $value = false; |
712 | 712 | |
713 | - if( 'context' === $val1 ) { |
|
713 | + if ( 'context' === $val1 ) { |
|
714 | 714 | |
715 | 715 | $matching_contexts = array( $val2 ); |
716 | 716 | |
717 | 717 | // We allow for non-standard contexts. |
718 | - switch( $val2 ) { |
|
718 | + switch ( $val2 ) { |
|
719 | 719 | // Check for either single or edit |
720 | 720 | case 'singular': |
721 | 721 | $matching_contexts = array( 'single', 'edit' ); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | return false; |
777 | 777 | } |
778 | 778 | |
779 | - if ( empty( $entry['form_id'] ) ) { |
|
779 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
780 | 780 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
781 | 781 | return false; |
782 | 782 | } |
@@ -784,26 +784,26 @@ discard block |
||
784 | 784 | $criteria = self::calculate_get_entries_criteria(); |
785 | 785 | |
786 | 786 | // Make sure the current View is connected to the same form as the Entry |
787 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
788 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
787 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
788 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
789 | 789 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
790 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
791 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
790 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
791 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
792 | 792 | return false; |
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
796 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
796 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
797 | 797 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
798 | 798 | return $entry; |
799 | 799 | } |
800 | 800 | |
801 | - $search_criteria = $criteria['search_criteria']; |
|
801 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
802 | 802 | unset( $criteria ); |
803 | 803 | |
804 | 804 | // check entry status |
805 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
806 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
805 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
806 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
@@ -811,41 +811,41 @@ discard block |
||
811 | 811 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
812 | 812 | |
813 | 813 | // field_filters |
814 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
814 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
815 | 815 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
816 | 816 | return $entry; |
817 | 817 | } |
818 | 818 | |
819 | - $filters = $search_criteria['field_filters']; |
|
819 | + $filters = $search_criteria[ 'field_filters' ]; |
|
820 | 820 | unset( $search_criteria ); |
821 | 821 | |
822 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
823 | - unset( $filters['mode'] ); |
|
822 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
823 | + unset( $filters[ 'mode' ] ); |
|
824 | 824 | |
825 | - $form = self::get_form( $entry['form_id'] ); |
|
825 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
826 | 826 | |
827 | 827 | foreach ( $filters as $filter ) { |
828 | 828 | |
829 | - if ( ! isset( $filter['key'] ) ) { |
|
829 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
830 | 830 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter ); |
831 | 831 | continue; |
832 | 832 | } |
833 | 833 | |
834 | - $k = $filter['key']; |
|
834 | + $k = $filter[ 'key' ]; |
|
835 | 835 | |
836 | 836 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
837 | 837 | $field_value = $entry[ $k ]; |
838 | 838 | $field = null; |
839 | 839 | } else { |
840 | 840 | $field = self::get_field( $form, $k ); |
841 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
841 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
842 | 842 | // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it |
843 | 843 | $field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value; |
844 | 844 | } |
845 | 845 | |
846 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
846 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
847 | 847 | |
848 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
848 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
849 | 849 | |
850 | 850 | // verify if we are already free to go! |
851 | 851 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -903,18 +903,18 @@ discard block |
||
903 | 903 | * Gravity Forms code to adjust date to locally-configured Time Zone |
904 | 904 | * @see GFCommon::format_date() for original code |
905 | 905 | */ |
906 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
906 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
907 | 907 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
908 | 908 | |
909 | - $format = rgar( $atts, 'format' ); |
|
910 | - $is_human = ! empty( $atts['human'] ); |
|
911 | - $is_diff = ! empty( $atts['diff'] ); |
|
912 | - $is_raw = ! empty( $atts['raw'] ); |
|
913 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
914 | - $include_time = ! empty( $atts['time'] ); |
|
909 | + $format = rgar( $atts, 'format' ); |
|
910 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
911 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
912 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
913 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
914 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
915 | 915 | |
916 | 916 | // If we're using time diff, we want to have a different default format |
917 | - if( empty( $format ) ) { |
|
917 | + if ( empty( $format ) ) { |
|
918 | 918 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
919 | 919 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
920 | 920 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | // If raw was specified, don't modify the stored value |
923 | 923 | if ( $is_raw ) { |
924 | 924 | $formatted_date = $date_string; |
925 | - } elseif( $is_timestamp ) { |
|
925 | + } elseif ( $is_timestamp ) { |
|
926 | 926 | $formatted_date = $date_local_timestamp; |
927 | 927 | } elseif ( $is_diff ) { |
928 | 928 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | |
957 | 957 | $label = rgar( $field, 'label' ); |
958 | 958 | |
959 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
959 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
960 | 960 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
961 | 961 | } |
962 | 962 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $form = GFAPI::get_form( $form ); |
985 | 985 | } |
986 | 986 | |
987 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
987 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
988 | 988 | return GFFormsModel::get_field( $form, $field_id ); |
989 | 989 | } else { |
990 | 990 | return null; |
@@ -1031,19 +1031,19 @@ discard block |
||
1031 | 1031 | $shortcodes = array(); |
1032 | 1032 | |
1033 | 1033 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1034 | - if ( empty( $matches ) ){ |
|
1034 | + if ( empty( $matches ) ) { |
|
1035 | 1035 | return false; |
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | foreach ( $matches as $shortcode ) { |
1039 | - if ( $tag === $shortcode[2] ) { |
|
1039 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1040 | 1040 | |
1041 | 1041 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1042 | - $shortcodes[] = $shortcode; |
|
1042 | + $shortcodes[ ] = $shortcode; |
|
1043 | 1043 | |
1044 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1045 | - foreach( $results as $result ) { |
|
1046 | - $shortcodes[] = $result; |
|
1044 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1045 | + foreach ( $results as $result ) { |
|
1046 | + $shortcodes[ ] = $result; |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | public static function get_directory_fields( $post_id, $apply_filter = true ) { |
1188 | 1188 | $fields = get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
1189 | 1189 | |
1190 | - if( $apply_filter ) { |
|
1190 | + if ( $apply_filter ) { |
|
1191 | 1191 | /** |
1192 | 1192 | * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
1193 | 1193 | * @since 1.6.5 |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | * @return string html |
1211 | 1211 | */ |
1212 | 1212 | public static function get_sortable_fields( $formid, $current = '' ) { |
1213 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1213 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1214 | 1214 | |
1215 | 1215 | if ( empty( $formid ) ) { |
1216 | 1216 | return $output; |
@@ -1223,11 +1223,11 @@ discard block |
||
1223 | 1223 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1224 | 1224 | |
1225 | 1225 | foreach ( $fields as $id => $field ) { |
1226 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1226 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1227 | 1227 | continue; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1230 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1262,9 +1262,9 @@ discard block |
||
1262 | 1262 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1263 | 1263 | |
1264 | 1264 | // TODO: Convert to using array_filter |
1265 | - foreach( $fields as $id => $field ) { |
|
1265 | + foreach ( $fields as $id => $field ) { |
|
1266 | 1266 | |
1267 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1267 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1268 | 1268 | unset( $fields[ $id ] ); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1305,14 +1305,14 @@ discard block |
||
1305 | 1305 | * @param int|array $field field key or field array |
1306 | 1306 | * @return boolean |
1307 | 1307 | */ |
1308 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1308 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1309 | 1309 | |
1310 | 1310 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1311 | 1311 | $form = self::get_form( $form ); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | // If entry meta, it's a string. Otherwise, numeric |
1315 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1315 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1316 | 1316 | $type = $field; |
1317 | 1317 | } else { |
1318 | 1318 | $type = self::get_field_type( $form, $field ); |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1327 | 1327 | |
1328 | 1328 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1329 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1330 | - if( true === $gv_field->is_numeric ) { |
|
1331 | - $numeric_types[] = $gv_field->is_numeric; |
|
1329 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1330 | + if ( true === $gv_field->is_numeric ) { |
|
1331 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | |
@@ -1478,18 +1478,18 @@ discard block |
||
1478 | 1478 | $final_atts = array_filter( $final_atts ); |
1479 | 1479 | |
1480 | 1480 | // If the href wasn't passed as an attribute, use the value passed to the function |
1481 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1482 | - $final_atts['href'] = $href; |
|
1481 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1482 | + $final_atts[ 'href' ] = $href; |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1485 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1486 | 1486 | |
1487 | 1487 | /** |
1488 | 1488 | * Fix potential security issue with target=_blank |
1489 | 1489 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1490 | 1490 | */ |
1491 | - if( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1492 | - $final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1491 | + if ( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1492 | + $final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | // Sort the attributes alphabetically, to help testing |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1502 | 1502 | } |
1503 | 1503 | |
1504 | - if( '' !== $output ) { |
|
1504 | + if ( '' !== $output ) { |
|
1505 | 1505 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1506 | 1506 | } |
1507 | 1507 | |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1529 | 1529 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1530 | 1530 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1531 | - $merged[] = $value; |
|
1531 | + $merged[ ] = $value; |
|
1532 | 1532 | } else { |
1533 | 1533 | $merged[ $key ] = $value; |
1534 | 1534 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1562 | 1562 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1563 | 1563 | */ |
1564 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1564 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1565 | 1565 | |
1566 | 1566 | return get_users( $get_users_settings ); |
1567 | 1567 | } |
@@ -1581,11 +1581,11 @@ discard block |
||
1581 | 1581 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1582 | 1582 | |
1583 | 1583 | // If $cap is defined, only show notice if user has capability |
1584 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1584 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1585 | 1585 | return ''; |
1586 | 1586 | } |
1587 | 1587 | |
1588 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1588 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1589 | 1589 | } |
1590 | 1590 | |
1591 | 1591 | /** |
@@ -18,80 +18,80 @@ discard block |
||
18 | 18 | |
19 | 19 | class GravityView_Edit_Entry { |
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | 24 | static $file; |
25 | 25 | |
26 | 26 | static $instance; |
27 | 27 | |
28 | - /** |
|
29 | - * Component instances. |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $instances = array(); |
|
28 | + /** |
|
29 | + * Component instances. |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $instances = array(); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | function __construct() { |
36 | 36 | |
37 | - self::$file = plugin_dir_path( __FILE__ ); |
|
37 | + self::$file = plugin_dir_path( __FILE__ ); |
|
38 | 38 | |
39 | - if( is_admin() ) { |
|
40 | - $this->load_components( 'admin' ); |
|
41 | - } |
|
39 | + if( is_admin() ) { |
|
40 | + $this->load_components( 'admin' ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - $this->load_components( 'render' ); |
|
44 | + $this->load_components( 'render' ); |
|
45 | 45 | |
46 | - // If GF User Registration Add-on exists |
|
47 | - $this->load_components( 'user-registration' ); |
|
46 | + // If GF User Registration Add-on exists |
|
47 | + $this->load_components( 'user-registration' ); |
|
48 | 48 | |
49 | - $this->add_hooks(); |
|
49 | + $this->add_hooks(); |
|
50 | 50 | |
51 | 51 | // Process hooks for addons that may or may not be present |
52 | 52 | $this->addon_specific_hooks(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - static function getInstance() { |
|
56 | + static function getInstance() { |
|
57 | 57 | |
58 | - if( empty( self::$instance ) ) { |
|
59 | - self::$instance = new GravityView_Edit_Entry; |
|
60 | - } |
|
58 | + if( empty( self::$instance ) ) { |
|
59 | + self::$instance = new GravityView_Edit_Entry; |
|
60 | + } |
|
61 | 61 | |
62 | - return self::$instance; |
|
63 | - } |
|
62 | + return self::$instance; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - private function load_components( $component ) { |
|
66 | + private function load_components( $component ) { |
|
67 | 67 | |
68 | - $dir = trailingslashit( self::$file ); |
|
68 | + $dir = trailingslashit( self::$file ); |
|
69 | 69 | |
70 | - $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
71 | - $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
70 | + $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
71 | + $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
72 | 72 | |
73 | - // Loads component and pass extension's instance so that component can |
|
74 | - // talk each other. |
|
75 | - require_once $filename; |
|
76 | - $this->instances[ $component ] = new $classname( $this ); |
|
77 | - $this->instances[ $component ]->load(); |
|
73 | + // Loads component and pass extension's instance so that component can |
|
74 | + // talk each other. |
|
75 | + require_once $filename; |
|
76 | + $this->instances[ $component ] = new $classname( $this ); |
|
77 | + $this->instances[ $component ]->load(); |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | - private function add_hooks() { |
|
81 | + private function add_hooks() { |
|
82 | 82 | |
83 | - // Add front-end access to Gravity Forms delete file action |
|
84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
83 | + // Add front-end access to Gravity Forms delete file action |
|
84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
85 | 85 | |
86 | - // Make sure this hook is run for non-admins |
|
87 | - add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
86 | + // Make sure this hook is run for non-admins |
|
87 | + add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
88 | 88 | |
89 | - add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
89 | + add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
90 | 90 | |
91 | - // add template path to check for field |
|
92 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
91 | + // add template path to check for field |
|
92 | + add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin |
@@ -105,75 +105,75 @@ discard block |
||
105 | 105 | |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Include this extension templates path |
|
110 | - * @param array $file_paths List of template paths ordered |
|
111 | - */ |
|
112 | - public function add_template_path( $file_paths ) { |
|
113 | - |
|
114 | - // Index 100 is the default GravityView template path. |
|
115 | - $file_paths[ 110 ] = self::$file; |
|
116 | - |
|
117 | - return $file_paths; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * |
|
122 | - * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
123 | - * |
|
124 | - * @param $view_id int GravityView view id |
|
125 | - * @param $form_id int Gravity Forms form id |
|
126 | - * @param $entry_id int Gravity Forms entry id |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
130 | - return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * The edit entry link creates a secure link with a nonce |
|
136 | - * |
|
137 | - * It also mimics the URL structure Gravity Forms expects to have so that |
|
138 | - * it formats the display of the edit form like it does in the backend, like |
|
139 | - * "You can edit this post from the post page" fields, for example. |
|
140 | - * |
|
141 | - * @param $entry array Gravity Forms entry object |
|
142 | - * @param $view_id int GravityView view id |
|
143 | - * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
144 | - * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
145 | - * @return string |
|
146 | - */ |
|
147 | - public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
148 | - |
|
149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
150 | - |
|
151 | - $base = gv_entry_link( $entry, $post_id ); |
|
152 | - |
|
153 | - $url = add_query_arg( array( |
|
154 | - 'page' => 'gf_entries', // Needed for GFForms::get_page() |
|
155 | - 'view' => 'entry', // Needed for GFForms::get_page() |
|
156 | - 'edit' => wp_create_nonce( $nonce_key ) |
|
157 | - ), $base ); |
|
158 | - |
|
159 | - /** |
|
160 | - * Allow passing params to dynamically populate entry with values |
|
161 | - * @since 1.9.2 |
|
162 | - */ |
|
163 | - if( !empty( $field_values ) ) { |
|
164 | - |
|
165 | - if( is_array( $field_values ) ) { |
|
166 | - // If already an array, no parse_str() needed |
|
167 | - $params = $field_values; |
|
168 | - } else { |
|
169 | - parse_str( $field_values, $params ); |
|
170 | - } |
|
171 | - |
|
172 | - $url = add_query_arg( $params, $url ); |
|
173 | - } |
|
174 | - |
|
175 | - return $url; |
|
176 | - } |
|
108 | + /** |
|
109 | + * Include this extension templates path |
|
110 | + * @param array $file_paths List of template paths ordered |
|
111 | + */ |
|
112 | + public function add_template_path( $file_paths ) { |
|
113 | + |
|
114 | + // Index 100 is the default GravityView template path. |
|
115 | + $file_paths[ 110 ] = self::$file; |
|
116 | + |
|
117 | + return $file_paths; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * |
|
122 | + * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
123 | + * |
|
124 | + * @param $view_id int GravityView view id |
|
125 | + * @param $form_id int Gravity Forms form id |
|
126 | + * @param $entry_id int Gravity Forms entry id |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
130 | + return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * The edit entry link creates a secure link with a nonce |
|
136 | + * |
|
137 | + * It also mimics the URL structure Gravity Forms expects to have so that |
|
138 | + * it formats the display of the edit form like it does in the backend, like |
|
139 | + * "You can edit this post from the post page" fields, for example. |
|
140 | + * |
|
141 | + * @param $entry array Gravity Forms entry object |
|
142 | + * @param $view_id int GravityView view id |
|
143 | + * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
144 | + * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
145 | + * @return string |
|
146 | + */ |
|
147 | + public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
148 | + |
|
149 | + $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
150 | + |
|
151 | + $base = gv_entry_link( $entry, $post_id ); |
|
152 | + |
|
153 | + $url = add_query_arg( array( |
|
154 | + 'page' => 'gf_entries', // Needed for GFForms::get_page() |
|
155 | + 'view' => 'entry', // Needed for GFForms::get_page() |
|
156 | + 'edit' => wp_create_nonce( $nonce_key ) |
|
157 | + ), $base ); |
|
158 | + |
|
159 | + /** |
|
160 | + * Allow passing params to dynamically populate entry with values |
|
161 | + * @since 1.9.2 |
|
162 | + */ |
|
163 | + if( !empty( $field_values ) ) { |
|
164 | + |
|
165 | + if( is_array( $field_values ) ) { |
|
166 | + // If already an array, no parse_str() needed |
|
167 | + $params = $field_values; |
|
168 | + } else { |
|
169 | + parse_str( $field_values, $params ); |
|
170 | + } |
|
171 | + |
|
172 | + $url = add_query_arg( $params, $url ); |
|
173 | + } |
|
174 | + |
|
175 | + return $url; |
|
176 | + } |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Edit mode doesn't allow certain field types. |
@@ -225,81 +225,81 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - /** |
|
229 | - * checks if user has permissions to edit a specific entry |
|
230 | - * |
|
231 | - * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
232 | - * |
|
233 | - * @param array $entry Gravity Forms entry array |
|
234 | - * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2} |
|
235 | - * @return bool |
|
236 | - */ |
|
237 | - public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) { |
|
228 | + /** |
|
229 | + * checks if user has permissions to edit a specific entry |
|
230 | + * |
|
231 | + * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
232 | + * |
|
233 | + * @param array $entry Gravity Forms entry array |
|
234 | + * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2} |
|
235 | + * @return bool |
|
236 | + */ |
|
237 | + public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) { |
|
238 | 238 | |
239 | - // No permission by default |
|
240 | - $user_can_edit = false; |
|
239 | + // No permission by default |
|
240 | + $user_can_edit = false; |
|
241 | 241 | |
242 | - // If they can edit any entries (as defined in Gravity Forms) |
|
243 | - // Or if they can edit other people's entries |
|
244 | - // Then we're good. |
|
245 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
242 | + // If they can edit any entries (as defined in Gravity Forms) |
|
243 | + // Or if they can edit other people's entries |
|
244 | + // Then we're good. |
|
245 | + if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
246 | 246 | |
247 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
247 | + do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
248 | 248 | |
249 | - $user_can_edit = true; |
|
249 | + $user_can_edit = true; |
|
250 | 250 | |
251 | - } else if( !isset( $entry['created_by'] ) ) { |
|
251 | + } else if( !isset( $entry['created_by'] ) ) { |
|
252 | 252 | |
253 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
253 | + do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
254 | 254 | |
255 | - $user_can_edit = false; |
|
255 | + $user_can_edit = false; |
|
256 | 256 | |
257 | - } else { |
|
257 | + } else { |
|
258 | 258 | |
259 | - // get user_edit setting |
|
260 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
261 | - // if View ID not specified or is the current view |
|
262 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
263 | - } else { |
|
264 | - // in case is specified and not the current view |
|
265 | - $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
|
266 | - } |
|
259 | + // get user_edit setting |
|
260 | + if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
261 | + // if View ID not specified or is the current view |
|
262 | + $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
263 | + } else { |
|
264 | + // in case is specified and not the current view |
|
265 | + $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
|
266 | + } |
|
267 | 267 | |
268 | - $current_user = wp_get_current_user(); |
|
268 | + $current_user = wp_get_current_user(); |
|
269 | 269 | |
270 | - // User edit is disabled |
|
271 | - if( empty( $user_edit ) ) { |
|
270 | + // User edit is disabled |
|
271 | + if( empty( $user_edit ) ) { |
|
272 | 272 | |
273 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
273 | + do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
274 | 274 | |
275 | - $user_can_edit = false; |
|
276 | - } |
|
275 | + $user_can_edit = false; |
|
276 | + } |
|
277 | 277 | |
278 | - // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
279 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
278 | + // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
279 | + else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
280 | 280 | |
281 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
281 | + do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
282 | 282 | |
283 | - $user_can_edit = true; |
|
283 | + $user_can_edit = true; |
|
284 | 284 | |
285 | - } else if( ! is_user_logged_in() ) { |
|
285 | + } else if( ! is_user_logged_in() ) { |
|
286 | 286 | |
287 | - do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
|
288 | - } |
|
287 | + do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
|
288 | + } |
|
289 | 289 | |
290 | - } |
|
290 | + } |
|
291 | 291 | |
292 | - /** |
|
293 | - * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
294 | - * @since 1.15 Added `$entry` and `$view_id` parameters |
|
295 | - * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
296 | - * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
297 | - * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
298 | - */ |
|
299 | - $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
292 | + /** |
|
293 | + * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
294 | + * @since 1.15 Added `$entry` and `$view_id` parameters |
|
295 | + * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
296 | + * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
297 | + * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
298 | + */ |
|
299 | + $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
300 | 300 | |
301 | - return (bool)$user_can_edit; |
|
302 | - } |
|
301 | + return (bool)$user_can_edit; |
|
302 | + } |
|
303 | 303 | |
304 | 304 | |
305 | 305 |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | continue; |
72 | 72 | } |
73 | 73 | |
74 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
75 | - $views->append( View::by_id( $shortcode->atts['id'] ) ); |
|
74 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
75 | + $views->append( View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
106 | - $views->append( View::by_id( $shortcode->atts['id'] ) ); |
|
105 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
106 | + $views->append( View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * A collection of \GV\View objects. |
@@ -39,8 +40,9 @@ discard block |
||
39 | 40 | */ |
40 | 41 | public function get( $view_id ) { |
41 | 42 | foreach ( $this->all() as $view ) { |
42 | - if ( $view->ID == $view_id ) |
|
43 | - return $view; |
|
43 | + if ( $view->ID == $view_id ) { |
|
44 | + return $view; |
|
45 | + } |
|
44 | 46 | } |
45 | 47 | return null; |
46 | 48 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | * @return string The version of PHP. |
212 | 212 | */ |
213 | 213 | private function get_php_version() { |
214 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
215 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
214 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
215 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * @return string The version of WordPress. |
224 | 224 | */ |
225 | 225 | private function get_wordpress_version() { |
226 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
227 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
226 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
227 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @return string The version of Gravity Forms. |
237 | 237 | */ |
238 | 238 | private function get_gravityforms_version() { |
239 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
239 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) |
|
240 | 240 | throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
241 | 241 | |
242 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
243 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
242 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
243 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | private function __clone() { } |
@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The GravityView WordPress plugin class. |
@@ -68,8 +69,9 @@ discard block |
||
68 | 69 | * @return \GV\Plugin The global instance of GravityView Plugin. |
69 | 70 | */ |
70 | 71 | public static function get() { |
71 | - if ( ! self::$__instance instanceof self ) |
|
72 | - self::$__instance = new self; |
|
72 | + if ( ! self::$__instance instanceof self ) { |
|
73 | + self::$__instance = new self; |
|
74 | + } |
|
73 | 75 | return self::$__instance; |
74 | 76 | } |
75 | 77 | |
@@ -92,8 +94,9 @@ discard block |
||
92 | 94 | * Stop all further functionality from loading if the WordPress |
93 | 95 | * plugin is incompatible with the current environment. |
94 | 96 | */ |
95 | - if ( ! $this->is_compatible() ) |
|
96 | - return; |
|
97 | + if ( ! $this->is_compatible() ) { |
|
98 | + return; |
|
99 | + } |
|
97 | 100 | |
98 | 101 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
99 | 102 | register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) ); |
@@ -236,8 +239,9 @@ discard block |
||
236 | 239 | * @return string The version of Gravity Forms. |
237 | 240 | */ |
238 | 241 | private function get_gravityforms_version() { |
239 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
240 | - throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
|
242 | + if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
243 | + throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
|
244 | + } |
|
241 | 245 | |
242 | 246 | return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
243 | 247 | $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | public function append( $value ) { |
27 | - $this->storage []= $value; |
|
27 | + $this->storage [ ] = $value; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * A generic Collection base class. |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The default Request class. |