@@ -312,8 +312,9 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public static function is_admin() { |
314 | 314 | |
315 | - if ( function_exists( 'gravityview' ) ) |
|
316 | - return gravityview()->request->is_admin(); |
|
315 | + if ( function_exists( 'gravityview' ) ) { |
|
316 | + return gravityview()->request->is_admin(); |
|
317 | + } |
|
317 | 318 | |
318 | 319 | $doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false; |
319 | 320 | |
@@ -382,7 +383,7 @@ discard block |
||
382 | 383 | * @param mixed $data Additional data to display |
383 | 384 | * @return void |
384 | 385 | */ |
385 | - public static function log_debug( $message, $data = null ){ |
|
386 | + public static function log_debug( $message, $data = null ) { |
|
386 | 387 | /** |
387 | 388 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
388 | 389 | * @param string $message Message to display |
@@ -396,7 +397,7 @@ discard block |
||
396 | 397 | * @param string $message log message |
397 | 398 | * @return void |
398 | 399 | */ |
399 | - public static function log_error( $message, $data = null ){ |
|
400 | + public static function log_error( $message, $data = null ) { |
|
400 | 401 | /** |
401 | 402 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
402 | 403 | * @param string $message Error message to display |
@@ -232,7 +232,7 @@ |
||
232 | 232 | * Does the if and the comparison match? |
233 | 233 | * @uses GVCommon::matches_operation |
234 | 234 | * |
235 | - * @return boolean True: yep; false: nope |
|
235 | + * @return boolean|null True: yep; false: nope |
|
236 | 236 | */ |
237 | 237 | private function set_is_match() { |
238 | 238 | $this->is_match = GVCommon::matches_operation( $this->if, $this->comparison, $this->operation ); |
@@ -245,7 +245,7 @@ |
||
245 | 245 | * @param bool $url_encode Whether to URL-encode output |
246 | 246 | * @param bool $esc_html Whether to apply `esc_html()` to output |
247 | 247 | * |
248 | - * @return mixed |
|
248 | + * @return string |
|
249 | 249 | */ |
250 | 250 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
251 | 251 |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
136 | 136 | |
137 | - if( $this->entry_meta_key ) { |
|
137 | + if ( $this->entry_meta_key ) { |
|
138 | 138 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
139 | 139 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->_custom_merge_tag ) { |
|
142 | + if ( $this->_custom_merge_tag ) { |
|
143 | 143 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
144 | 144 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
145 | 145 | } |
146 | 146 | |
147 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
147 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
148 | 148 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
149 | 149 | } |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Auto-assign label from Gravity Forms label, if exists |
153 | 153 | * @since 1.20 |
154 | 154 | */ |
155 | - if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
155 | + if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
156 | 156 | $this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
157 | 157 | } |
158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'type' => $this->name |
176 | 176 | ); |
177 | 177 | |
178 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
178 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
179 | 179 | |
180 | 180 | return $fields; |
181 | 181 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
197 | 197 | |
198 | - if( $this->name === $field['field'] && '' === $label ) { |
|
198 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
199 | 199 | $label = esc_html( $this->default_search_label ); |
200 | 200 | } |
201 | 201 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
218 | 218 | */ |
219 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
219 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
220 | 220 | |
221 | 221 | // Is there is field merge tag? Strip whitespace off the ned, too. |
222 | 222 | preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
249 | 249 | |
250 | - foreach( $matches as $match ) { |
|
250 | + foreach ( $matches as $match ) { |
|
251 | 251 | |
252 | - $full_tag = $match[0]; |
|
252 | + $full_tag = $match[ 0 ]; |
|
253 | 253 | |
254 | 254 | // Strip the Merge Tags |
255 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
255 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
256 | 256 | |
257 | 257 | // Replace the value from the entry, if exists |
258 | - if( isset( $entry[ $tag ] ) ) { |
|
258 | + if ( isset( $entry[ $tag ] ) ) { |
|
259 | 259 | |
260 | 260 | $value = $entry[ $tag ]; |
261 | 261 | |
262 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
262 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
263 | 263 | $value = $this->get_content( $value ); |
264 | 264 | } |
265 | 265 | |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function _filter_sortable_fields( $not_sortable ) { |
334 | 334 | |
335 | - if( ! $this->is_sortable ) { |
|
336 | - $not_sortable[] = $this->name; |
|
335 | + if ( ! $this->is_sortable ) { |
|
336 | + $not_sortable[ ] = $this->name; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | return $not_sortable; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | function add_entry_meta( $entry_meta ) { |
352 | 352 | |
353 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
353 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
354 | 354 | |
355 | 355 | $added_meta = array( |
356 | 356 | 'label' => $this->label, |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | ); |
360 | 360 | |
361 | 361 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
362 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
362 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
363 | 363 | } |
364 | 364 | |
365 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
365 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
366 | 366 | |
367 | 367 | } else { |
368 | - do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] ); |
|
368 | + do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] ); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | return $entry_meta; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | 'date_display' => array( |
395 | 395 | 'type' => 'text', |
396 | 396 | 'label' => __( 'Override Date Format', 'gravityview' ), |
397 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
397 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
398 | 398 | /** |
399 | 399 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
400 | 400 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | $options = $this->field_support_options(); |
421 | 421 | |
422 | - if( isset( $options[ $key ] ) ) { |
|
422 | + if ( isset( $options[ $key ] ) ) { |
|
423 | 423 | $field_options[ $key ] = $options[ $key ]; |
424 | 424 | } |
425 | 425 | |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | $connected_form = rgpost( 'form_id' ); |
484 | 484 | |
485 | 485 | // Otherwise, get the Form ID from the Post page |
486 | - if( empty( $connected_form ) ) { |
|
486 | + if ( empty( $connected_form ) ) { |
|
487 | 487 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
488 | 488 | } |
489 | 489 | |
490 | - if( empty( $connected_form ) ) { |
|
490 | + if ( empty( $connected_form ) ) { |
|
491 | 491 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
492 | 492 | return false; |
493 | 493 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | /** |
78 | 78 | * Alias for get_instance() |
79 | 79 | * |
80 | - * @param $field_name |
|
80 | + * @param string $field_name |
|
81 | 81 | * |
82 | 82 | * @return GravityView_Field|false |
83 | 83 | */ |
@@ -40,7 +40,6 @@ |
||
40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
41 | 41 | * |
42 | 42 | * @since 1.16.4 |
43 | - |
|
44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
46 | 45 | * |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
17 | 17 | |
18 | 18 | var $is_searchable = true; |
19 | 19 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = true; |
13 | 13 | |
14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
15 | 15 | |
16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | // Set the $_field_id var |
41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
42 | 42 | |
43 | - if( $this->is_choice_value_enabled() ) { |
|
44 | - $field_options['choice_display'] = array( |
|
43 | + if ( $this->is_choice_value_enabled() ) { |
|
44 | + $field_options[ 'choice_display' ] = array( |
|
45 | 45 | 'type' => 'radio', |
46 | 46 | 'value' => 'value', |
47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = true; |
13 | 13 | |
14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
15 | 15 | |
16 | 16 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
17 | 17 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $entry = GFAPI::get_entry( $entry_id ); |
45 | 45 | $post_id = rgar( $entry, 'post_id' ); |
46 | 46 | |
47 | - if( empty( $post_id ) ) { |
|
47 | + if ( empty( $post_id ) ) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' ); |
54 | 54 | |
55 | - if( $post_category_fields ) { |
|
55 | + if ( $post_category_fields ) { |
|
56 | 56 | |
57 | 57 | $updated_categories = array(); |
58 | 58 | |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return mixed |
121 | 121 | */ |
122 | - function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
122 | + function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
123 | 123 | |
124 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
124 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
125 | 125 | |
126 | 126 | // $entry['post_id'] should always be set, but we check to make sure. |
127 | - if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) { |
|
127 | + if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) { |
|
128 | 128 | |
129 | 129 | $post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) ); |
130 | 130 | |
131 | 131 | // Always use the live value |
132 | 132 | foreach ( $choices as &$choice ) { |
133 | - $choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) ); |
|
133 | + $choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) ); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | |
140 | 140 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
141 | 141 | |
142 | - if( 'edit' === $context ) { |
|
142 | + if ( 'edit' === $context ) { |
|
143 | 143 | return $field_options; |
144 | 144 | } |
145 | 145 | |
146 | - $this->add_field_support('dynamic_data', $field_options ); |
|
147 | - $this->add_field_support('link_to_term', $field_options ); |
|
146 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
147 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
148 | 148 | |
149 | 149 | return $field_options; |
150 | 150 | } |
@@ -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 | } |