@@ -23,36 +23,36 @@ discard block |
||
23 | 23 | * @param boolean $force_show_label Whether to always show the label, regardless of field settings |
24 | 24 | * @return string |
25 | 25 | */ |
26 | - public static function field_label( $field, $entry = array(), $force_show_label = false ) { |
|
26 | + public static function field_label($field, $entry = array(), $force_show_label = false) { |
|
27 | 27 | $gravityview_view = GravityView_View::getInstance(); |
28 | 28 | |
29 | 29 | $form = $gravityview_view->getForm(); |
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 | 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 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param[in,out] string $appended_content Content you can add after a label. Empty by default. |
73 | 73 | * @param[in] array $field GravityView field array |
74 | 74 | */ |
75 | - $label .= apply_filters( 'gravityview_render_after_label', '', $field ); |
|
75 | + $label .= apply_filters('gravityview_render_after_label', '', $field); |
|
76 | 76 | |
77 | 77 | } // End $field['show_label'] |
78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param[in] array $form Gravity Forms form array |
85 | 85 | * @param[in] array $entry Gravity Forms entry array |
86 | 86 | */ |
87 | - $label = apply_filters( 'gravityview/template/field_label', $label, $field, $form, $entry ); |
|
87 | + $label = apply_filters('gravityview/template/field_label', $label, $field, $form, $entry); |
|
88 | 88 | |
89 | 89 | return $label; |
90 | 90 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $entry GF Entry array |
100 | 100 | * @return string Text with variables maybe replaced |
101 | 101 | */ |
102 | - public static function replace_variables($text, $form, $entry ) { |
|
103 | - return GravityView_Merge_Tags::replace_variables( $text, $form, $entry ); |
|
102 | + public static function replace_variables($text, $form, $entry) { |
|
103 | + return GravityView_Merge_Tags::replace_variables($text, $form, $entry); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string|null If not empty, string in $format format. Otherwise, null. |
115 | 115 | */ |
116 | - public static function field_width( $field, $format = '%d%%' ) { |
|
116 | + public static function field_width($field, $format = '%d%%') { |
|
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 | |
128 | - $width = sprintf( $format, $width ); |
|
128 | + $width = sprintf($format, $width); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $width; |
@@ -139,38 +139,38 @@ discard block |
||
139 | 139 | * @param mixed $field |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - public static function field_class( $field, $form = NULL, $entry = NULL ) { |
|
142 | + public static function field_class($field, $form = NULL, $entry = NULL) { |
|
143 | 143 | $gravityview_view = GravityView_View::getInstance(); |
144 | 144 | |
145 | 145 | $classes = array(); |
146 | 146 | |
147 | - if( !empty( $field['custom_class'] ) ) { |
|
147 | + if (!empty($field['custom_class'])) { |
|
148 | 148 | |
149 | 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 | 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 | 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'] ) ) { |
|
169 | + if (!empty($field['id'])) { |
|
170 | + if (!empty($form) && !empty($form['id'])) { |
|
171 | 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 | 176 | $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | * @param array $entry Gravity Forms entry array |
192 | 192 | * @return string Sanitized unique HTML `id` attribute for the field |
193 | 193 | */ |
194 | - public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
|
194 | + public static function field_html_attr_id($field, $form = array(), $entry = array()) { |
|
195 | 195 | $gravityview_view = GravityView_View::getInstance(); |
196 | 196 | $id = $field['id']; |
197 | 197 | |
198 | - if ( ! empty( $id ) ) { |
|
199 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
200 | - $form_id = '-' . $form['id']; |
|
198 | + if (!empty($id)) { |
|
199 | + if (!empty($form) && !empty($form['id'])) { |
|
200 | + $form_id = '-'.$form['id']; |
|
201 | 201 | } else { |
202 | - $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
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 | - return esc_attr( $id ); |
|
208 | + return esc_attr($id); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | * @param integer $field |
218 | 218 | * @return null|string |
219 | 219 | */ |
220 | - public static function field_value( $entry, $field_settings, $format = 'html' ) { |
|
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 | - if( class_exists( 'GFCache' ) ) { |
|
228 | + if (class_exists('GFCache')) { |
|
229 | 229 | /** |
230 | 230 | * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run. |
231 | 231 | * |
@@ -240,18 +240,18 @@ discard block |
||
240 | 240 | * @param boolean false Tell Gravity Forms not to store this as a transient |
241 | 241 | * @param int 0 Time to store the value. 0 is maximum amount of time possible. |
242 | 242 | */ |
243 | - GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 ); |
|
243 | + GFCache::set("GFFormsModel::get_lead_field_value_".$entry["id"]."_".$field_settings["id"], false, false, 0); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $field_id = $field_settings['id']; |
247 | 247 | |
248 | 248 | $form = $gravityview_view->getForm(); |
249 | 249 | |
250 | - $field = gravityview_get_field( $form, $field_id ); |
|
250 | + $field = gravityview_get_field($form, $field_id); |
|
251 | 251 | |
252 | 252 | $field_type = RGFormsModel::get_input_type($field); |
253 | 253 | |
254 | - if( $field_type ) { |
|
254 | + if ($field_type) { |
|
255 | 255 | $field_type = $field['type']; |
256 | 256 | $value = RGFormsModel::get_lead_field_value($entry, $field); |
257 | 257 | } else { |
@@ -266,15 +266,15 @@ discard block |
||
266 | 266 | |
267 | 267 | $display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format); |
268 | 268 | |
269 | - if( $errors = ob_get_clean() ) { |
|
270 | - do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
|
269 | + if ($errors = ob_get_clean()) { |
|
270 | + do_action('gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form); |
274 | 274 | |
275 | 275 | // prevent the use of merge_tags for non-admin fields |
276 | - if( !empty( $field['adminOnly'] ) ) { |
|
277 | - $display_value = self::replace_variables( $display_value, $form, $entry ); |
|
276 | + if (!empty($field['adminOnly'])) { |
|
277 | + $display_value = self::replace_variables($display_value, $form, $entry); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // Check whether the field exists in /includes/fields/{$field_type}.php |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
283 | 283 | |
284 | 284 | // Set the field data to be available in the templates |
285 | - $gravityview_view->setCurrentField( array( |
|
285 | + $gravityview_view->setCurrentField(array( |
|
286 | 286 | 'form' => $form, |
287 | 287 | 'field_id' => $field_id, |
288 | 288 | 'field' => $field, |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | 'field_path' => $field_path, /** {@since 1.16} */ |
296 | 296 | )); |
297 | 297 | |
298 | - if( ! empty( $field_path ) ) { |
|
298 | + if (!empty($field_path)) { |
|
299 | 299 | |
300 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
300 | + do_action('gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path)); |
|
301 | 301 | |
302 | 302 | ob_start(); |
303 | 303 | |
304 | - load_template( $field_path, false ); |
|
304 | + load_template($field_path, false); |
|
305 | 305 | |
306 | 306 | $output = ob_get_clean(); |
307 | 307 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @param array $field_settings Settings for the particular GV field |
323 | 323 | * @param array $field Field array, as fetched from GravityView_View::getCurrentField() |
324 | 324 | */ |
325 | - $output = apply_filters( 'gravityview_field_entry_value_' . $field_type . '_pre_link', $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
325 | + $output = apply_filters('gravityview_field_entry_value_'.$field_type.'_pre_link', $output, $entry, $field_settings, $gravityview_view->getCurrentField()); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Link to the single entry by wrapping the output in an anchor tag |
@@ -330,11 +330,11 @@ discard block |
||
330 | 330 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
331 | 331 | * |
332 | 332 | */ |
333 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
333 | + if (!empty($field_settings['show_as_link']) && !gv_empty($output, false, false)) { |
|
334 | 334 | |
335 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
335 | + $link_atts = empty($field_settings['new_window']) ? array() : array('target' => '_blank'); |
|
336 | 336 | |
337 | - $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
|
337 | + $output = self::entry_link_html($entry, $output, $link_atts, $field_settings); |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param array $field_settings Settings for the particular GV field |
347 | 347 | * @param array $field Current field being displayed |
348 | 348 | */ |
349 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
349 | + $output = apply_filters('gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField()); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @param array $field_settings Settings for the particular GV field |
356 | 356 | * @param array $field_data {@since 1.6} |
357 | 357 | */ |
358 | - $output = apply_filters( 'gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
358 | + $output = apply_filters('gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField()); |
|
359 | 359 | |
360 | 360 | return $output; |
361 | 361 | } |
@@ -369,18 +369,18 @@ discard block |
||
369 | 369 | * @param array $entry Gravity Forms entry array |
370 | 370 | * @param array $field_settings Array of field settings. Optional, but passed to the `gravityview_field_entry_link` filter |
371 | 371 | */ |
372 | - public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
|
372 | + public static function entry_link_html($entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array()) { |
|
373 | 373 | |
374 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
374 | + if (empty($entry) || !is_array($entry) || !isset($entry['id'])) { |
|
375 | 375 | |
376 | - do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
|
376 | + do_action('gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry); |
|
377 | 377 | |
378 | 378 | return NULL; |
379 | 379 | } |
380 | 380 | |
381 | - $href = self::entry_link( $entry ); |
|
381 | + $href = self::entry_link($entry); |
|
382 | 382 | |
383 | - $link = gravityview_get_link( $href, $anchor_text, $passed_tag_atts ); |
|
383 | + $link = gravityview_get_link($href, $anchor_text, $passed_tag_atts); |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * @filter `gravityview_field_entry_link` Modify the link HTML |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param array $entry The GF entry array |
390 | 390 | * @param array $field_settings Settings for the particular GV field |
391 | 391 | */ |
392 | - $output = apply_filters( 'gravityview_field_entry_link', $link, $href, $entry, $field_settings ); |
|
392 | + $output = apply_filters('gravityview_field_entry_link', $link, $href, $entry, $field_settings); |
|
393 | 393 | |
394 | 394 | return $output; |
395 | 395 | } |
@@ -404,11 +404,11 @@ discard block |
||
404 | 404 | |
405 | 405 | $is_search = false; |
406 | 406 | |
407 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
407 | + if ($gravityview_view && ($gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search)) { |
|
408 | 408 | $is_search = true; |
409 | 409 | } |
410 | 410 | |
411 | - if($is_search) { |
|
411 | + if ($is_search) { |
|
412 | 412 | $output = __('This search returned no results.', 'gravityview'); |
413 | 413 | } else { |
414 | 414 | $output = __('No entries match your request.', 'gravityview'); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param string $output The existing "No Entries" text |
420 | 420 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
421 | 421 | */ |
422 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
422 | + $output = apply_filters('gravitview_no_entries_text', $output, $is_search); |
|
423 | 423 | |
424 | 424 | return $wpautop ? wpautop($output) : $output; |
425 | 425 | } |
@@ -433,42 +433,42 @@ discard block |
||
433 | 433 | * @param boolean $add_query_args Add pagination and sorting arguments |
434 | 434 | * @return string Permalink to multiple entries view |
435 | 435 | */ |
436 | - public static function directory_link( $post_id = NULL, $add_query_args = true ) { |
|
436 | + public static function directory_link($post_id = NULL, $add_query_args = true) { |
|
437 | 437 | global $post; |
438 | 438 | |
439 | 439 | $gravityview_view = GravityView_View::getInstance(); |
440 | 440 | |
441 | - if( empty( $post_id ) ) { |
|
441 | + if (empty($post_id)) { |
|
442 | 442 | |
443 | 443 | $post_id = false; |
444 | 444 | |
445 | 445 | // DataTables passes the Post ID |
446 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
446 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
447 | 447 | |
448 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
448 | + $post_id = isset($_POST['post_id']) ? (int)$_POST['post_id'] : false; |
|
449 | 449 | |
450 | 450 | } else { |
451 | 451 | |
452 | 452 | // The Post ID has been passed via the shortcode |
453 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
453 | + if (!empty($gravityview_view) && $gravityview_view->getPostId()) { |
|
454 | 454 | |
455 | 455 | $post_id = $gravityview_view->getPostId(); |
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | 459 | // This is a GravityView post type |
460 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
460 | + if (GravityView_frontend::getInstance()->isGravityviewPostType()) { |
|
461 | 461 | |
462 | - $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
|
462 | + $post_id = isset($gravityview_view) ? $gravityview_view->getViewId() : $post->ID; |
|
463 | 463 | |
464 | 464 | } else { |
465 | 465 | |
466 | 466 | // This is an embedded GravityView; use the embedded post's ID as the base. |
467 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
467 | + if (GravityView_frontend::getInstance()->isPostHasShortcode() && is_a($post, 'WP_Post')) { |
|
468 | 468 | |
469 | 469 | $post_id = $post->ID; |
470 | 470 | |
471 | - } elseif( $gravityview_view->getViewId() ) { |
|
471 | + } elseif ($gravityview_view->getViewId()) { |
|
472 | 472 | |
473 | 473 | // The GravityView has been embedded in a widget or in a template, and |
474 | 474 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -483,39 +483,39 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | // No post ID, get outta here. |
486 | - if( empty( $post_id ) ) { |
|
486 | + if (empty($post_id)) { |
|
487 | 487 | return NULL; |
488 | 488 | } |
489 | 489 | |
490 | 490 | // If we've saved the permalink in memory, use it |
491 | 491 | // @since 1.3 |
492 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
492 | + $link = wp_cache_get('gv_directory_link_'.$post_id); |
|
493 | 493 | |
494 | - if( empty( $link ) ) { |
|
494 | + if (empty($link)) { |
|
495 | 495 | |
496 | - $link = get_permalink( $post_id ); |
|
496 | + $link = get_permalink($post_id); |
|
497 | 497 | |
498 | 498 | // If not yet saved, cache the permalink. |
499 | 499 | // @since 1.3 |
500 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
500 | + wp_cache_set('gv_directory_link_'.$post_id, $link); |
|
501 | 501 | |
502 | 502 | } |
503 | 503 | |
504 | 504 | // Deal with returning to proper pagination for embedded views |
505 | - if( $link && $add_query_args ) { |
|
505 | + if ($link && $add_query_args) { |
|
506 | 506 | |
507 | 507 | $args = array(); |
508 | 508 | |
509 | - if( $pagenum = rgget('pagenum') ) { |
|
510 | - $args['pagenum'] = intval( $pagenum ); |
|
509 | + if ($pagenum = rgget('pagenum')) { |
|
510 | + $args['pagenum'] = intval($pagenum); |
|
511 | 511 | } |
512 | 512 | |
513 | - if( $sort = rgget('sort') ) { |
|
513 | + if ($sort = rgget('sort')) { |
|
514 | 514 | $args['sort'] = $sort; |
515 | 515 | $args['dir'] = rgget('dir'); |
516 | 516 | } |
517 | 517 | |
518 | - $link = add_query_arg( $args, $link ); |
|
518 | + $link = add_query_arg($args, $link); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | return $link; |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | * @param array $entry Entry data passed to provide additional information when generating the hash. Optional - don't rely on it being available. |
533 | 533 | * @return string Hashed unique value for entry |
534 | 534 | */ |
535 | - private static function get_custom_entry_slug( $id, $entry = array() ) { |
|
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}` |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | * @param string $id The entry ID |
544 | 544 | * @param array $entry Entry data array. May be empty. |
545 | 545 | */ |
546 | - $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
|
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 | |
553 | - return sanitize_title( $slug ); |
|
553 | + return sanitize_title($slug); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * @param array $entry Gravity Forms Entry array, optional. Used only to provide data to customize the `gravityview_entry_slug` filter |
565 | 565 | * @return string Unique slug ID, passed through `sanitize_title()` |
566 | 566 | */ |
567 | - public static function get_entry_slug( $id_or_string, $entry = array() ) { |
|
567 | + public static function get_entry_slug($id_or_string, $entry = array()) { |
|
568 | 568 | |
569 | 569 | /** |
570 | 570 | * Default: use the entry ID as the unique identifier |
@@ -575,32 +575,32 @@ 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 | - if ( $custom ) { |
|
581 | + if ($custom) { |
|
582 | 582 | |
583 | 583 | // Get the entry hash |
584 | - $hash = self::get_custom_entry_slug( $id_or_string, $entry ); |
|
584 | + $hash = self::get_custom_entry_slug($id_or_string, $entry); |
|
585 | 585 | |
586 | 586 | // See if the entry already has a hash set |
587 | - $value = gform_get_meta( $id_or_string, 'gravityview_unique_id' ); |
|
587 | + $value = gform_get_meta($id_or_string, 'gravityview_unique_id'); |
|
588 | 588 | |
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 ) { |
|
592 | + if (empty($value) || $value !== $hash) { |
|
593 | 593 | |
594 | - gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
|
594 | + gform_update_meta($id_or_string, 'gravityview_unique_id', $hash); |
|
595 | 595 | |
596 | 596 | } |
597 | 597 | |
598 | 598 | $slug = $hash; |
599 | 599 | |
600 | - unset( $value, $hash ); |
|
600 | + unset($value, $hash); |
|
601 | 601 | } |
602 | 602 | |
603 | - return sanitize_title( $slug ); |
|
603 | + return sanitize_title($slug); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
@@ -611,18 +611,18 @@ discard block |
||
611 | 611 | * @param $entry array Gravity Forms entry object |
612 | 612 | * @param $form array Gravity Forms form object |
613 | 613 | */ |
614 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
614 | + public static function entry_create_custom_slug($entry, $form) { |
|
615 | 615 | /** |
616 | 616 | * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
617 | 617 | * @param boolean $custom Should we process the custom entry slug? |
618 | 618 | */ |
619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | - if( $custom ) { |
|
619 | + $custom = apply_filters('gravityview_custom_entry_slug', false); |
|
620 | + if ($custom) { |
|
621 | 621 | // create the gravityview_unique_id and save it |
622 | 622 | |
623 | 623 | // Get the entry hash |
624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
624 | + $hash = self::get_custom_entry_slug($entry['id'], $entry); |
|
625 | + gform_update_meta($entry['id'], 'gravityview_unique_id', $hash); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | } |
@@ -637,55 +637,55 @@ discard block |
||
637 | 637 | * @param boolean $add_directory_args True: Add args to help return to directory; False: only include args required to get to entry {@since 1.7.3} |
638 | 638 | * @return string Link to the entry with the directory parent slug |
639 | 639 | */ |
640 | - public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
|
640 | + public static function entry_link($entry, $post_id = NULL, $add_directory_args = true) { |
|
641 | 641 | |
642 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
643 | - $entry = GVCommon::get_entry( $entry ); |
|
644 | - } else if( empty( $entry ) ) { |
|
642 | + if (!empty($entry) && !is_array($entry)) { |
|
643 | + $entry = GVCommon::get_entry($entry); |
|
644 | + } else if (empty($entry)) { |
|
645 | 645 | $entry = GravityView_frontend::getInstance()->getEntry(); |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Second parameter used to be passed as $field; this makes sure it's not an array |
649 | - if( !is_numeric( $post_id ) ) { |
|
649 | + if (!is_numeric($post_id)) { |
|
650 | 650 | $post_id = NULL; |
651 | 651 | } |
652 | 652 | |
653 | 653 | // Get the permalink to the View |
654 | - $directory_link = self::directory_link( $post_id, false ); |
|
654 | + $directory_link = self::directory_link($post_id, false); |
|
655 | 655 | |
656 | 656 | // No post ID? Get outta here. |
657 | - if( empty( $directory_link ) ) { |
|
657 | + if (empty($directory_link)) { |
|
658 | 658 | return ''; |
659 | 659 | } |
660 | 660 | |
661 | 661 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
662 | 662 | |
663 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
663 | + $entry_slug = self::get_entry_slug($entry['id'], $entry); |
|
664 | 664 | |
665 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
665 | + if (get_option('permalink_structure') && !is_preview()) { |
|
666 | 666 | |
667 | 667 | $args = array(); |
668 | 668 | |
669 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
669 | + $directory_link = trailingslashit($directory_link).$query_arg_name.'/'.$entry_slug.'/'; |
|
670 | 670 | |
671 | 671 | } else { |
672 | 672 | |
673 | - $args = array( $query_arg_name => $entry_slug ); |
|
673 | + $args = array($query_arg_name => $entry_slug); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
677 | 677 | * @since 1.7.3 |
678 | 678 | */ |
679 | - if( $add_directory_args ) { |
|
679 | + if ($add_directory_args) { |
|
680 | 680 | |
681 | - if( !empty( $_GET['pagenum'] ) ) { |
|
682 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
681 | + if (!empty($_GET['pagenum'])) { |
|
682 | + $args['pagenum'] = intval($_GET['pagenum']); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
686 | 686 | * @since 1.7 |
687 | 687 | */ |
688 | - if( $sort = rgget('sort') ) { |
|
688 | + if ($sort = rgget('sort')) { |
|
689 | 689 | $args['sort'] = $sort; |
690 | 690 | $args['dir'] = rgget('dir'); |
691 | 691 | } |
@@ -697,11 +697,11 @@ discard block |
||
697 | 697 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
698 | 698 | * @see GravityView_frontend::get_context_view_id() |
699 | 699 | */ |
700 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
700 | + if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views()) { |
|
701 | 701 | $args['gvid'] = gravityview_get_view_id(); |
702 | 702 | } |
703 | 703 | |
704 | - return add_query_arg( $args, $directory_link ); |
|
704 | + return add_query_arg($args, $directory_link); |
|
705 | 705 | |
706 | 706 | } |
707 | 707 | |
@@ -711,12 +711,12 @@ discard block |
||
711 | 711 | |
712 | 712 | // inside loop functions |
713 | 713 | |
714 | -function gv_label( $field, $entry = NULL ) { |
|
715 | - return GravityView_API::field_label( $field, $entry ); |
|
714 | +function gv_label($field, $entry = NULL) { |
|
715 | + return GravityView_API::field_label($field, $entry); |
|
716 | 716 | } |
717 | 717 | |
718 | -function gv_class( $field, $form = NULL, $entry = array() ) { |
|
719 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
718 | +function gv_class($field, $form = NULL, $entry = array()) { |
|
719 | + return GravityView_API::field_class($field, $form, $entry); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -730,61 +730,61 @@ discard block |
||
730 | 730 | * |
731 | 731 | * @return string CSS class, sanitized by gravityview_sanitize_html_class() |
732 | 732 | */ |
733 | -function gv_container_class( $passed_css_class = '', $echo = true ) { |
|
733 | +function gv_container_class($passed_css_class = '', $echo = true) { |
|
734 | 734 | |
735 | - $passed_css_class = trim( $passed_css_class ); |
|
735 | + $passed_css_class = trim($passed_css_class); |
|
736 | 736 | |
737 | 737 | $view_id = GravityView_View::getInstance()->getViewId(); |
738 | 738 | |
739 | - $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
|
739 | + $default_css_class = !empty($view_id) ? sprintf('gv-container gv-container-%d', $view_id) : 'gv-container'; |
|
740 | 740 | |
741 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
741 | + if (GravityView_View::getInstance()->isHideUntilSearched()) { |
|
742 | 742 | $default_css_class .= ' hidden'; |
743 | 743 | } |
744 | 744 | |
745 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
745 | + $css_class = trim($passed_css_class.' '.$default_css_class); |
|
746 | 746 | |
747 | 747 | /** |
748 | 748 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
749 | 749 | * @since 1.5.4 |
750 | 750 | * @param[in,out] string $css_class Default: `gv-container gv-container-{view id}`. If View is hidden until search, adds ` hidden` |
751 | 751 | */ |
752 | - $css_class = apply_filters( 'gravityview/render/container/class', $css_class ); |
|
752 | + $css_class = apply_filters('gravityview/render/container/class', $css_class); |
|
753 | 753 | |
754 | - $css_class = gravityview_sanitize_html_class( $css_class ); |
|
754 | + $css_class = gravityview_sanitize_html_class($css_class); |
|
755 | 755 | |
756 | - if( $echo ) { |
|
756 | + if ($echo) { |
|
757 | 757 | echo $css_class; |
758 | 758 | } |
759 | 759 | |
760 | 760 | return $css_class; |
761 | 761 | } |
762 | 762 | |
763 | -function gv_value( $entry, $field ) { |
|
763 | +function gv_value($entry, $field) { |
|
764 | 764 | |
765 | - $value = GravityView_API::field_value( $entry, $field ); |
|
765 | + $value = GravityView_API::field_value($entry, $field); |
|
766 | 766 | |
767 | - if( $value === '') { |
|
767 | + if ($value === '') { |
|
768 | 768 | /** |
769 | 769 | * @filter `gravityview_empty_value` What to display when a field is empty |
770 | 770 | * @param string $value (empty string) |
771 | 771 | */ |
772 | - $value = apply_filters( 'gravityview_empty_value', '' ); |
|
772 | + $value = apply_filters('gravityview_empty_value', ''); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | return $value; |
776 | 776 | } |
777 | 777 | |
778 | -function gv_directory_link( $post = NULL, $add_pagination = true ) { |
|
779 | - return GravityView_API::directory_link( $post, $add_pagination ); |
|
778 | +function gv_directory_link($post = NULL, $add_pagination = true) { |
|
779 | + return GravityView_API::directory_link($post, $add_pagination); |
|
780 | 780 | } |
781 | 781 | |
782 | -function gv_entry_link( $entry, $post_id = NULL ) { |
|
783 | - return GravityView_API::entry_link( $entry, $post_id ); |
|
782 | +function gv_entry_link($entry, $post_id = NULL) { |
|
783 | + return GravityView_API::entry_link($entry, $post_id); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | function gv_no_results($wpautop = true) { |
787 | - return GravityView_API::no_results( $wpautop ); |
|
787 | + return GravityView_API::no_results($wpautop); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -796,21 +796,21 @@ discard block |
||
796 | 796 | |
797 | 797 | $href = gv_directory_link(); |
798 | 798 | |
799 | - if( empty( $href ) ) { return NULL; } |
|
799 | + if (empty($href)) { return NULL; } |
|
800 | 800 | |
801 | 801 | // calculate link label |
802 | 802 | $gravityview_view = GravityView_View::getInstance(); |
803 | 803 | |
804 | - $label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __( '← Go back', 'gravityview' ); |
|
804 | + $label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __('← Go back', 'gravityview'); |
|
805 | 805 | |
806 | 806 | /** |
807 | 807 | * @filter `gravityview_go_back_label` Modify the back link text |
808 | 808 | * @since 1.0.9 |
809 | 809 | * @param string $label Existing label text |
810 | 810 | */ |
811 | - $label = apply_filters( 'gravityview_go_back_label', $label ); |
|
811 | + $label = apply_filters('gravityview_go_back_label', $label); |
|
812 | 812 | |
813 | - $link = gravityview_get_link( $href, esc_html( $label ), array( |
|
813 | + $link = gravityview_get_link($href, esc_html($label), array( |
|
814 | 814 | 'data-viewid' => $gravityview_view->getViewId() |
815 | 815 | )); |
816 | 816 | |
@@ -829,9 +829,9 @@ discard block |
||
829 | 829 | * @param string $display_value The value generated by Gravity Forms |
830 | 830 | * @return string Value |
831 | 831 | */ |
832 | -function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
|
832 | +function gravityview_get_field_value($entry, $field_id, $display_value) { |
|
833 | 833 | |
834 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
834 | + if (floatval($field_id) === floor(floatval($field_id))) { |
|
835 | 835 | |
836 | 836 | // For the complete field value as generated by Gravity Forms |
837 | 837 | return $display_value; |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } else { |
840 | 840 | |
841 | 841 | // For one part of the address (City, ZIP, etc.) |
842 | - return isset( $entry[ $field_id ] ) ? $entry[ $field_id ] : ''; |
|
842 | + return isset($entry[$field_id]) ? $entry[$field_id] : ''; |
|
843 | 843 | |
844 | 844 | } |
845 | 845 | |
@@ -855,48 +855,48 @@ discard block |
||
855 | 855 | * @param string $taxonomy Type of term (`post_tag` or `category`) |
856 | 856 | * @return string CSV of linked terms |
857 | 857 | */ |
858 | -function gravityview_convert_value_to_term_list( $value, $taxonomy = 'post_tag' ) { |
|
858 | +function gravityview_convert_value_to_term_list($value, $taxonomy = 'post_tag') { |
|
859 | 859 | |
860 | 860 | $output = array(); |
861 | 861 | |
862 | - $terms = explode( ', ', $value ); |
|
862 | + $terms = explode(', ', $value); |
|
863 | 863 | |
864 | - foreach ($terms as $term_name ) { |
|
864 | + foreach ($terms as $term_name) { |
|
865 | 865 | |
866 | 866 | // If we're processing a category, |
867 | - if( $taxonomy === 'category' ) { |
|
867 | + if ($taxonomy === 'category') { |
|
868 | 868 | |
869 | 869 | // Use rgexplode to prevent errors if : doesn't exist |
870 | - list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
|
870 | + list($term_name, $term_id) = rgexplode(':', $value, 2); |
|
871 | 871 | |
872 | 872 | // The explode was succesful; we have the category ID |
873 | - if( !empty( $term_id )) { |
|
874 | - $term = get_term_by( 'id', $term_id, $taxonomy ); |
|
873 | + if (!empty($term_id)) { |
|
874 | + $term = get_term_by('id', $term_id, $taxonomy); |
|
875 | 875 | } else { |
876 | 876 | // We have to fall back to the name |
877 | - $term = get_term_by( 'name', $term_name, $taxonomy ); |
|
877 | + $term = get_term_by('name', $term_name, $taxonomy); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | } else { |
881 | 881 | // Use the name of the tag to get the full term information |
882 | - $term = get_term_by( 'name', $term_name, $taxonomy ); |
|
882 | + $term = get_term_by('name', $term_name, $taxonomy); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | // There's still a tag/category here. |
886 | - if( $term ) { |
|
886 | + if ($term) { |
|
887 | 887 | |
888 | - $term_link = get_term_link( $term, $taxonomy ); |
|
888 | + $term_link = get_term_link($term, $taxonomy); |
|
889 | 889 | |
890 | 890 | // If there was an error, continue to the next term. |
891 | - if ( is_wp_error( $term_link ) ) { |
|
891 | + if (is_wp_error($term_link)) { |
|
892 | 892 | continue; |
893 | 893 | } |
894 | 894 | |
895 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
895 | + $output[] = gravityview_get_link($term_link, esc_html($term->name)); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | - return implode(', ', $output ); |
|
899 | + return implode(', ', $output); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | /** |
@@ -906,12 +906,12 @@ discard block |
||
906 | 906 | * @param string $taxonomy Taxonomy of term to fetch. |
907 | 907 | * @return string String with terms |
908 | 908 | */ |
909 | -function gravityview_get_the_term_list( $post_id, $link = true, $taxonomy = 'post_tag' ) { |
|
909 | +function gravityview_get_the_term_list($post_id, $link = true, $taxonomy = 'post_tag') { |
|
910 | 910 | |
911 | - $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
|
911 | + $output = get_the_term_list($post_id, $taxonomy, NULL, ', '); |
|
912 | 912 | |
913 | - if( empty( $link ) ) { |
|
914 | - return strip_tags( $output); |
|
913 | + if (empty($link)) { |
|
914 | + return strip_tags($output); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | return $output; |
@@ -930,17 +930,17 @@ discard block |
||
930 | 930 | $fe = GravityView_frontend::getInstance(); |
931 | 931 | |
932 | 932 | // Solve problem when loading content via admin-ajax.php |
933 | - if( ! $fe->getGvOutputData() ) { |
|
933 | + if (!$fe->getGvOutputData()) { |
|
934 | 934 | |
935 | - do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
|
935 | + do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.'); |
|
936 | 936 | |
937 | 937 | $fe->parse_content(); |
938 | 938 | } |
939 | 939 | |
940 | 940 | // Make 100% sure that we're dealing with a properly called situation |
941 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
941 | + if (!is_a($fe->getGvOutputData(), 'GravityView_View_Data')) { |
|
942 | 942 | |
943 | - do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
|
943 | + do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData()); |
|
944 | 944 | |
945 | 945 | return array(); |
946 | 946 | } |
@@ -954,18 +954,18 @@ discard block |
||
954 | 954 | * @see GravityView_View_Data::get_view() |
955 | 955 | * @return array View data with `id`, `view_id`, `form_id`, `template_id`, `atts`, `fields`, `widgets`, `form` keys. |
956 | 956 | */ |
957 | -function gravityview_get_current_view_data( $view_id = 0 ) { |
|
957 | +function gravityview_get_current_view_data($view_id = 0) { |
|
958 | 958 | |
959 | 959 | $fe = GravityView_frontend::getInstance(); |
960 | 960 | |
961 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
961 | + if (!$fe->getGvOutputData()) { return array(); } |
|
962 | 962 | |
963 | 963 | // If not set, grab the current view ID |
964 | - if( empty( $view_id ) ) { |
|
964 | + if (empty($view_id)) { |
|
965 | 965 | $view_id = $fe->get_context_view_id(); |
966 | 966 | } |
967 | 967 | |
968 | - return $fe->getGvOutputData()->get_view( $view_id ); |
|
968 | + return $fe->getGvOutputData()->get_view($view_id); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | // Templates' hooks |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @action `gravityview_before` Display content before a View. Used to render widget areas. Rendered outside the View container `<div>` |
975 | 975 | * @param int $view_id The ID of the View being displayed |
976 | 976 | */ |
977 | - do_action( 'gravityview_before', gravityview_get_view_id() ); |
|
977 | + do_action('gravityview_before', gravityview_get_view_id()); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | function gravityview_header() { |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | * @action `gravityview_header` Prepend content to the View container `<div>` |
983 | 983 | * @param int $view_id The ID of the View being displayed |
984 | 984 | */ |
985 | - do_action( 'gravityview_header', gravityview_get_view_id() ); |
|
985 | + do_action('gravityview_header', gravityview_get_view_id()); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | function gravityview_footer() { |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | * @action `gravityview_after` Display content after a View. Used to render footer widget areas. Rendered outside the View container `<div>` |
991 | 991 | * @param int $view_id The ID of the View being displayed |
992 | 992 | */ |
993 | - do_action( 'gravityview_footer', gravityview_get_view_id() ); |
|
993 | + do_action('gravityview_footer', gravityview_get_view_id()); |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | function gravityview_after() { |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | * @action `gravityview_after` Append content to the View container `<div>` |
999 | 999 | * @param int $view_id The ID of the View being displayed |
1000 | 1000 | */ |
1001 | - do_action( 'gravityview_after', gravityview_get_view_id() ); |
|
1001 | + do_action('gravityview_after', gravityview_get_view_id()); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | /** |
@@ -1024,13 +1024,13 @@ discard block |
||
1024 | 1024 | * The Edit Entry functionality overrides this value. |
1025 | 1025 | * @param boolean $is_edit_entry |
1026 | 1026 | */ |
1027 | - $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
|
1027 | + $is_edit_entry = apply_filters('gravityview_is_edit_entry', false); |
|
1028 | 1028 | |
1029 | - if( $is_edit_entry ) { |
|
1029 | + if ($is_edit_entry) { |
|
1030 | 1030 | $context = 'edit'; |
1031 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
1031 | + } else if (class_exists('GravityView_frontend') && $single = GravityView_frontend::is_single_entry()) { |
|
1032 | 1032 | $context = 'single'; |
1033 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
1033 | + } else if (class_exists('GravityView_View')) { |
|
1034 | 1034 | $context = GravityView_View::getInstance()->getContext(); |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1055,18 +1055,18 @@ discard block |
||
1055 | 1055 | * @param string $gv_class Field class to add to the output HTML |
1056 | 1056 | * @return array Array of file output, with `file_path` and `html` keys (see comments above) |
1057 | 1057 | */ |
1058 | -function gravityview_get_files_array( $value, $gv_class = '' ) { |
|
1058 | +function gravityview_get_files_array($value, $gv_class = '') { |
|
1059 | 1059 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1060 | 1060 | |
1061 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1062 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1061 | + if (!class_exists('GravityView_Field')) { |
|
1062 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php'); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1066 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
1065 | + if (!class_exists('GravityView_Field_FileUpload')) { |
|
1066 | + include_once(GRAVITYVIEW_DIR.'includes/fields/fileupload.php'); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | - return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
|
1069 | + return GravityView_Field_FileUpload::get_files_array($value, $gv_class); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
@@ -1080,16 +1080,16 @@ discard block |
||
1080 | 1080 | * @param string $address Address |
1081 | 1081 | * @return string URL of link to map of address |
1082 | 1082 | */ |
1083 | -function gravityview_get_map_link( $address ) { |
|
1083 | +function gravityview_get_map_link($address) { |
|
1084 | 1084 | |
1085 | - $address_qs = str_replace( array( '<br />', "\n" ), ' ', $address ); // Replace \n with spaces |
|
1086 | - $address_qs = urlencode( $address_qs ); |
|
1085 | + $address_qs = str_replace(array('<br />', "\n"), ' ', $address); // Replace \n with spaces |
|
1086 | + $address_qs = urlencode($address_qs); |
|
1087 | 1087 | |
1088 | 1088 | $url = "https://maps.google.com/maps?q={$address_qs}"; |
1089 | 1089 | |
1090 | - $link_text = esc_html__( 'Map It', 'gravityview' ); |
|
1090 | + $link_text = esc_html__('Map It', 'gravityview'); |
|
1091 | 1091 | |
1092 | - $link = gravityview_get_link( $url, $link_text, 'class=map-it-link' ); |
|
1092 | + $link = gravityview_get_link($url, $link_text, 'class=map-it-link'); |
|
1093 | 1093 | |
1094 | 1094 | /** |
1095 | 1095 | * @filter `gravityview_map_link` Modify the map link generated. You can use a different mapping service, for example. |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | * @param[in] string $address Address to generate link for |
1098 | 1098 | * @param[in] string $url URL generated by the function |
1099 | 1099 | */ |
1100 | - $link = apply_filters( 'gravityview_map_link', $link, $address, $url ); |
|
1100 | + $link = apply_filters('gravityview_map_link', $link, $address, $url); |
|
1101 | 1101 | |
1102 | 1102 | return $link; |
1103 | 1103 | } |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * @param array $passed_args Associative array with field data. `field` and `form` are required. |
1119 | 1119 | * @return string Field output. If empty value and hide empty is true, return empty. |
1120 | 1120 | */ |
1121 | -function gravityview_field_output( $passed_args ) { |
|
1121 | +function gravityview_field_output($passed_args) { |
|
1122 | 1122 | $defaults = array( |
1123 | 1123 | 'entry' => null, |
1124 | 1124 | 'field' => null, |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | 'zone_id' => null, |
1131 | 1131 | ); |
1132 | 1132 | |
1133 | - $args = wp_parse_args( $passed_args, $defaults ); |
|
1133 | + $args = wp_parse_args($passed_args, $defaults); |
|
1134 | 1134 | |
1135 | 1135 | /** |
1136 | 1136 | * @filter `gravityview/field_output/args` Modify the args before generation begins |
@@ -1138,15 +1138,15 @@ discard block |
||
1138 | 1138 | * @param array $args Associative array; `field` and `form` is required. |
1139 | 1139 | * @param array $passed_args Original associative array with field data. `field` and `form` are required. |
1140 | 1140 | */ |
1141 | - $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
|
1141 | + $args = apply_filters('gravityview/field_output/args', $args, $passed_args); |
|
1142 | 1142 | |
1143 | 1143 | // Required fields. |
1144 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1145 | - do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
|
1144 | + if (empty($args['field']) || empty($args['form'])) { |
|
1145 | + do_action('gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args); |
|
1146 | 1146 | return ''; |
1147 | 1147 | } |
1148 | 1148 | |
1149 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1149 | + $entry = empty($args['entry']) ? array() : $args['entry']; |
|
1150 | 1150 | |
1151 | 1151 | /** |
1152 | 1152 | * Create the content variables for replacing. |
@@ -1162,36 +1162,36 @@ discard block |
||
1162 | 1162 | 'field_id' => '', |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
1165 | + $context['value'] = gv_value($entry, $args['field']); |
|
1166 | 1166 | |
1167 | 1167 | // If the value is empty and we're hiding empty, return empty. |
1168 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1168 | + if ($context['value'] === '' && !empty($args['hide_empty'])) { |
|
1169 | 1169 | return ''; |
1170 | 1170 | } |
1171 | 1171 | |
1172 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1173 | - $context['value'] = wpautop( $context['value'] ); |
|
1172 | + if ($context['value'] !== '' && !empty($args['wpautop'])) { |
|
1173 | + $context['value'] = wpautop($context['value']); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | // Get width setting, if exists |
1177 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
1177 | + $context['width'] = GravityView_API::field_width($args['field']); |
|
1178 | 1178 | |
1179 | 1179 | // If replacing with CSS inline formatting, let's do it. |
1180 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
1180 | + $context['width:style'] = GravityView_API::field_width($args['field'], 'width:'.$context['width'].'%;'); |
|
1181 | 1181 | |
1182 | 1182 | // Grab the Class using `gv_class` |
1183 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
1184 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
1183 | + $context['class'] = gv_class($args['field'], $args['form'], $entry); |
|
1184 | + $context['field_id'] = GravityView_API::field_html_attr_id($args['field'], $args['form'], $entry); |
|
1185 | 1185 | |
1186 | 1186 | // Get field label if needed |
1187 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
1188 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
1187 | + if (!empty($args['label_markup']) && !empty($args['field']['show_label'])) { |
|
1188 | + $context['label'] = str_replace(array('{{label}}', '{{ label }}'), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup']); |
|
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Default Label value |
1192 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
1192 | + $context['label_value'] = gv_label($args['field'], $entry); |
|
1193 | 1193 | |
1194 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
1194 | + if (empty($context['label']) && !empty($context['label_value'])) { |
|
1195 | 1195 | $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1201,37 +1201,37 @@ discard block |
||
1201 | 1201 | * @param string $markup The HTML for the markup |
1202 | 1202 | * @param array $args All args for the field output |
1203 | 1203 | */ |
1204 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
1204 | + $html = apply_filters('gravityview/field_output/pre_html', $args['markup'], $args); |
|
1205 | 1205 | |
1206 | 1206 | /** |
1207 | 1207 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
1208 | 1208 | * @since 1.11 |
1209 | 1209 | * @param string $open_tag Open tag for template content placeholders. Default: `{{` |
1210 | 1210 | */ |
1211 | - $open_tag = apply_filters( 'gravityview/field_output/open_tag', '{{', $args ); |
|
1211 | + $open_tag = apply_filters('gravityview/field_output/open_tag', '{{', $args); |
|
1212 | 1212 | |
1213 | 1213 | /** |
1214 | 1214 | * @filter `gravityview/field_output/close_tag` Modify the closing tags for the template content placeholders |
1215 | 1215 | * @since 1.11 |
1216 | 1216 | * @param string $close_tag Close tag for template content placeholders. Default: `}}` |
1217 | 1217 | */ |
1218 | - $close_tag = apply_filters( 'gravityview/field_output/close_tag', '}}', $args ); |
|
1218 | + $close_tag = apply_filters('gravityview/field_output/close_tag', '}}', $args); |
|
1219 | 1219 | |
1220 | 1220 | /** |
1221 | 1221 | * Loop through each of the tags to replace and replace both `{{tag}}` and `{{ tag }}` with the values |
1222 | 1222 | * @since 1.11 |
1223 | 1223 | */ |
1224 | - foreach ( $context as $tag => $value ) { |
|
1224 | + foreach ($context as $tag => $value) { |
|
1225 | 1225 | |
1226 | 1226 | // If the tag doesn't exist just skip it |
1227 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1227 | + if (false === strpos($html, $open_tag.$tag.$close_tag) && false === strpos($html, $open_tag.' '.$tag.' '.$close_tag)) { |
|
1228 | 1228 | continue; |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | // Array to search |
1232 | 1232 | $search = array( |
1233 | - $open_tag . $tag . $close_tag, |
|
1234 | - $open_tag . ' ' . $tag . ' ' . $close_tag, |
|
1233 | + $open_tag.$tag.$close_tag, |
|
1234 | + $open_tag.' '.$tag.' '.$close_tag, |
|
1235 | 1235 | ); |
1236 | 1236 | |
1237 | 1237 | /** |
@@ -1240,26 +1240,26 @@ discard block |
||
1240 | 1240 | * @param string $value The content to be shown instead of the {{tag}} placeholder |
1241 | 1241 | * @param array $args Arguments passed to the function |
1242 | 1242 | */ |
1243 | - $value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args ); |
|
1243 | + $value = apply_filters('gravityview/field_output/context/'.$tag, $value, $args); |
|
1244 | 1244 | |
1245 | 1245 | // Finally do the replace |
1246 | - $html = str_replace( $search, $value, $html ); |
|
1246 | + $html = str_replace($search, $value, $html); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | /** |
1250 | 1250 | * @todo Depricate `gravityview_field_output` |
1251 | 1251 | */ |
1252 | - $html = apply_filters( 'gravityview_field_output', $html, $args ); |
|
1252 | + $html = apply_filters('gravityview_field_output', $html, $args); |
|
1253 | 1253 | |
1254 | 1254 | /** |
1255 | 1255 | * @filter `gravityview/field_output/html` Modify field HTML output |
1256 | 1256 | * @param string $html Existing HTML output |
1257 | 1257 | * @param array $args Arguments passed to the function |
1258 | 1258 | */ |
1259 | - $html = apply_filters( 'gravityview/field_output/html', $html, $args ); |
|
1259 | + $html = apply_filters('gravityview/field_output/html', $html, $args); |
|
1260 | 1260 | |
1261 | 1261 | // Just free up a tiny amount of memory |
1262 | - unset( $value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag ); |
|
1262 | + unset($value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag); |
|
1263 | 1263 | |
1264 | 1264 | return $html; |
1265 | 1265 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = false; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * GravityView_Field_Is_Fulfilled constructor. |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - $this->label = esc_html__( 'Is Fulfilled', 'gravityview' ); |
|
37 | + $this->label = esc_html__('Is Fulfilled', 'gravityview'); |
|
38 | 38 | |
39 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
39 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
40 | 40 | |
41 | 41 | parent::__construct(); |
42 | 42 | } |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return String values for this field based on the numeric values used by Gravity Forms |
57 | 57 | */ |
58 | - public function get_content( $output, $entry, $field_settings, $field ) { |
|
58 | + public function get_content($output, $entry, $field_settings, $field) { |
|
59 | 59 | |
60 | 60 | /** Overridden by a template. */ |
61 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
61 | + if (!empty($field['field_path'])) { return $output; } |
|
62 | 62 | |
63 | - return $this->get_string_from_value( $output ); |
|
63 | + return $this->get_string_from_value($output); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string |
74 | 74 | */ |
75 | - private function get_string_from_value( $value ) { |
|
75 | + private function get_string_from_value($value) { |
|
76 | 76 | |
77 | - switch ( intval( $value ) ) { |
|
77 | + switch (intval($value)) { |
|
78 | 78 | case self::NOT_FULFILLED: |
79 | 79 | default: |
80 | 80 | $return = __('Not Fulfilled', 'gravityview'); |
@@ -101,22 +101,22 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
103 | 103 | */ |
104 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
104 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
105 | 105 | |
106 | 106 | $return = $text; |
107 | 107 | |
108 | - foreach ( $matches as $match ) { |
|
108 | + foreach ($matches as $match) { |
|
109 | 109 | |
110 | 110 | $full_tag = $match[0]; |
111 | 111 | |
112 | - $fulfilled = rgar( $entry, 'is_fulfilled' ); |
|
112 | + $fulfilled = rgar($entry, 'is_fulfilled'); |
|
113 | 113 | |
114 | - $value = $this->get_string_from_value( $fulfilled ); |
|
114 | + $value = $this->get_string_from_value($fulfilled); |
|
115 | 115 | |
116 | - $return = str_replace( $full_tag, $value, $return ); |
|
116 | + $return = str_replace($full_tag, $value, $return); |
|
117 | 117 | } |
118 | 118 | |
119 | - unset( $formatted_amount, $value, $amount, $full_tag, $matches ); |
|
119 | + unset($formatted_amount, $value, $amount, $full_tag, $matches); |
|
120 | 120 | |
121 | 121 | return $return; |
122 | 122 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'in', 'not in' ); |
|
17 | + var $search_operators = array('is', 'isnot', 'in', 'not in'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * GravityView_Field_Transaction_Type constructor. |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - $this->label = esc_html__( 'Transaction Type', 'gravityview' ); |
|
38 | - $this->description = esc_html__( 'The type of the order: one-time payment or subscription', 'gravityview' ); |
|
37 | + $this->label = esc_html__('Transaction Type', 'gravityview'); |
|
38 | + $this->description = esc_html__('The type of the order: one-time payment or subscription', 'gravityview'); |
|
39 | 39 | |
40 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
40 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
41 | 41 | |
42 | 42 | parent::__construct(); |
43 | 43 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return String values for this field based on the numeric values used by Gravity Forms |
58 | 58 | */ |
59 | - public function get_content( $output, $entry, $field_settings, $field ) { |
|
59 | + public function get_content($output, $entry, $field_settings, $field) { |
|
60 | 60 | |
61 | 61 | /** Overridden by a template. */ |
62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
62 | + if (!empty($field['field_path'])) { return $output; } |
|
63 | 63 | |
64 | - return $this->get_string_from_value( $output ); |
|
64 | + return $this->get_string_from_value($output); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
75 | 75 | */ |
76 | - private function get_string_from_value( $value ) { |
|
76 | + private function get_string_from_value($value) { |
|
77 | 77 | |
78 | - switch ( intval( $value ) ) { |
|
78 | + switch (intval($value)) { |
|
79 | 79 | case self::ONE_TIME_PAYMENT: |
80 | 80 | default: |
81 | 81 | $return = __('One-Time Payment', 'gravityview'); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = false; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * GravityView_Field_Date_Created constructor. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->label = esc_attr__( 'Payment Method', 'gravityview' ); |
|
28 | - $this->description = esc_html( 'The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Payment Method', 'gravityview'); |
|
28 | + $this->description = esc_html('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
|
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'contains' ); |
|
17 | + var $search_operators = array('is', 'isnot', 'greater_than', 'less_than', 'contains'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * GravityView_Field_Payment_Amount constructor. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->label = esc_attr__( 'Payment Amount', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Payment Amount', 'gravityview'); |
|
28 | 28 | |
29 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
29 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
30 | 30 | |
31 | 31 | parent::__construct(); |
32 | 32 | } |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return String values for this field based on the numeric values used by Gravity Forms |
47 | 47 | */ |
48 | - public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
|
48 | + public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array()) { |
|
49 | 49 | |
50 | 50 | /** Overridden by a template. */ |
51 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
51 | + if (!empty($field['field_path'])) { return $output; } |
|
52 | 52 | |
53 | - $amount = rgar( $entry, 'payment_amount' ); |
|
54 | - $return = GFCommon::to_money( $amount, rgar( $entry, 'currency' ) ); |
|
53 | + $amount = rgar($entry, 'payment_amount'); |
|
54 | + $return = GFCommon::to_money($amount, rgar($entry, 'currency')); |
|
55 | 55 | |
56 | 56 | return $return; |
57 | 57 | } |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
71 | 71 | */ |
72 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
72 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
73 | 73 | |
74 | 74 | $return = $text; |
75 | 75 | |
76 | - foreach ( $matches as $match ) { |
|
76 | + foreach ($matches as $match) { |
|
77 | 77 | |
78 | 78 | $full_tag = $match[0]; |
79 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
79 | + $modifier = isset($match[1]) ? $match[1] : false; |
|
80 | 80 | |
81 | - $amount = rgar( $entry, 'payment_amount' ); |
|
81 | + $amount = rgar($entry, 'payment_amount'); |
|
82 | 82 | |
83 | - $formatted_amount = ( 'raw' === $modifier ) ? $amount : GFCommon::to_money( $amount, rgar( $entry, 'currency' ) ); |
|
83 | + $formatted_amount = ('raw' === $modifier) ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency')); |
|
84 | 84 | |
85 | - $return = str_replace( $full_tag, $formatted_amount, $return ); |
|
85 | + $return = str_replace($full_tag, $formatted_amount, $return); |
|
86 | 86 | } |
87 | 87 | |
88 | - unset( $formatted_amount, $amount, $full_tag, $matches ); |
|
88 | + unset($formatted_amount, $amount, $full_tag, $matches); |
|
89 | 89 | |
90 | 90 | return $return; |
91 | 91 | } |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public static function register( $field ) { |
|
27 | - if ( ! is_subclass_of( $field, 'GravityView_Field' ) ) { |
|
28 | - throw new Exception( 'Must be a subclass of GravityView_Field' ); |
|
26 | + public static function register($field) { |
|
27 | + if (!is_subclass_of($field, 'GravityView_Field')) { |
|
28 | + throw new Exception('Must be a subclass of GravityView_Field'); |
|
29 | 29 | } |
30 | - if ( empty( $field->name ) ) { |
|
31 | - throw new Exception( 'The name must be set' ); |
|
30 | + if (empty($field->name)) { |
|
31 | + throw new Exception('The name must be set'); |
|
32 | 32 | } |
33 | - if ( isset( self::$_fields[ $field->name ] ) && ! defined( 'DOING_GRAVITYVIEW_TESTS' ) ) { |
|
34 | - throw new Exception( 'Field type already registered: ' . $field->name ); |
|
33 | + if (isset(self::$_fields[$field->name]) && !defined('DOING_GRAVITYVIEW_TESTS')) { |
|
34 | + throw new Exception('Field type already registered: '.$field->name); |
|
35 | 35 | } |
36 | - self::$_fields[ $field->name ] = $field; |
|
36 | + self::$_fields[$field->name] = $field; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return GravityView_Field | bool |
43 | 43 | */ |
44 | - public static function create( $properties ) { |
|
45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
47 | - if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
|
48 | - return new GravityView_Field( $properties ); |
|
44 | + public static function create($properties) { |
|
45 | + $type = isset($properties['type']) ? $properties['type'] : ''; |
|
46 | + $type = empty($properties['inputType']) ? $type : $properties['inputType']; |
|
47 | + if (empty($type) || !isset(self::$_fields[$type])) { |
|
48 | + return new GravityView_Field($properties); |
|
49 | 49 | } |
50 | - $class = self::$_fields[ $type ]; |
|
51 | - $class_name = get_class( $class ); |
|
52 | - $field = new $class_name( $properties ); |
|
50 | + $class = self::$_fields[$type]; |
|
51 | + $class_name = get_class($class); |
|
52 | + $field = new $class_name($properties); |
|
53 | 53 | |
54 | 54 | return $field; |
55 | 55 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return bool True: yes, it exists; False: nope |
63 | 63 | */ |
64 | - public static function exists( $field_name ) { |
|
65 | - return isset( self::$_fields["{$field_name}"] ); |
|
64 | + public static function exists($field_name) { |
|
65 | + return isset(self::$_fields["{$field_name}"]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return GravityView_Field |
72 | 72 | */ |
73 | - public static function get_instance( $field_name ) { |
|
74 | - return isset( self::$_fields[ $field_name ] ) ? self::$_fields[ $field_name ] : false; |
|
73 | + public static function get_instance($field_name) { |
|
74 | + return isset(self::$_fields[$field_name]) ? self::$_fields[$field_name] : false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return GravityView_Field |
83 | 83 | */ |
84 | - public static function get( $field_name ) { |
|
85 | - return self::get_instance( $field_name ); |
|
84 | + public static function get($field_name) { |
|
85 | + return self::get_instance($field_name); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return GravityView_Field[] |
96 | 96 | */ |
97 | - public static function get_all( $group = '' ) { |
|
97 | + public static function get_all($group = '') { |
|
98 | 98 | |
99 | - if( '' !== $group ) { |
|
99 | + if ('' !== $group) { |
|
100 | 100 | $return_fields = self::$_fields; |
101 | - foreach ( $return_fields as $key => $field ) { |
|
102 | - if( $group !== $field->group ) { |
|
103 | - unset( $return_fields[ $key ] ); |
|
101 | + foreach ($return_fields as $key => $field) { |
|
102 | + if ($group !== $field->group) { |
|
103 | + unset($return_fields[$key]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | return $return_fields; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @type array |
74 | 74 | * @since 1.15.2 |
75 | 75 | */ |
76 | - var $contexts = array( 'single', 'multiple', 'edit', 'export' ); |
|
76 | + var $contexts = array('single', 'multiple', 'edit', 'export'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @internal Not yet implemented |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * If this is a Gravity Forms field, use their labels. Spare our translation team! |
107 | 107 | */ |
108 | - if( ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
108 | + if (!empty($this->_gf_field_class_name) && class_exists($this->_gf_field_class_name)) { |
|
109 | 109 | /** @var GF_Field $GF_Field */ |
110 | 110 | $GF_Field = new $this->_gf_field_class_name; |
111 | 111 | $this->label = $GF_Field->get_form_editor_field_title(); |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Modify the field options based on the name of the field type |
115 | - add_filter( sprintf( 'gravityview_template_%s_options', $this->name ), array( &$this, 'field_options' ), 10, 5 ); |
|
115 | + add_filter(sprintf('gravityview_template_%s_options', $this->name), array(&$this, 'field_options'), 10, 5); |
|
116 | 116 | |
117 | - add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
|
117 | + add_filter('gravityview/sortable/field_blacklist', array($this, '_filter_sortable_fields'), 1); |
|
118 | 118 | |
119 | - if( $this->_custom_merge_tag ) { |
|
120 | - add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
|
121 | - add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
|
119 | + if ($this->_custom_merge_tag) { |
|
120 | + add_filter('gform_custom_merge_tags', array($this, '_filter_gform_custom_merge_tags'), 10, 4); |
|
121 | + add_filter('gform_replace_merge_tags', array($this, '_filter_gform_replace_merge_tags'), 10, 7); |
|
122 | 122 | } |
123 | 123 | |
124 | - GravityView_Fields::register( $this ); |
|
124 | + GravityView_Fields::register($this); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
140 | 140 | */ |
141 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
141 | + public function _filter_gform_replace_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | * @see GFCommon::replace_variables_prepopulate() |
147 | 147 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
148 | 148 | */ |
149 | - if( false === $form ) { |
|
149 | + if (false === $form) { |
|
150 | 150 | return $text; |
151 | 151 | } |
152 | 152 | |
153 | 153 | // Is there is field merge tag? Strip whitespace off the ned, too. |
154 | - preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
|
154 | + preg_match_all('/{'.preg_quote($this->_custom_merge_tag).':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER); |
|
155 | 155 | |
156 | 156 | // If there are no matches, return original text |
157 | - if ( empty( $matches ) ) { |
|
157 | + if (empty($matches)) { |
|
158 | 158 | return $text; |
159 | 159 | } |
160 | 160 | |
161 | - return $this->replace_merge_tag( $matches, $text, $form, $entry, $url_encode, $esc_html ); |
|
161 | + return $this->replace_merge_tag($matches, $text, $form, $entry, $url_encode, $esc_html); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -177,29 +177,29 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
180 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
181 | 181 | |
182 | - foreach( $matches as $match ) { |
|
182 | + foreach ($matches as $match) { |
|
183 | 183 | |
184 | 184 | $full_tag = $match[0]; |
185 | 185 | |
186 | 186 | // Strip the Merge Tags |
187 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
187 | + $tag = str_replace(array('{', '}'), '', $full_tag); |
|
188 | 188 | |
189 | 189 | // Replace the value from the entry, if exists |
190 | - if( isset( $entry[ $tag ] ) ) { |
|
190 | + if (isset($entry[$tag])) { |
|
191 | 191 | |
192 | - $value = $entry[ $tag ]; |
|
192 | + $value = $entry[$tag]; |
|
193 | 193 | |
194 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
195 | - $value = $this->get_content( $value ); |
|
194 | + if (is_callable(array($this, 'get_content'))) { |
|
195 | + $value = $this->get_content($value); |
|
196 | 196 | } |
197 | 197 | |
198 | - $text = str_replace( $full_tag, $value, $text ); |
|
198 | + $text = str_replace($full_tag, $value, $text); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - unset( $value, $tag, $full_tag ); |
|
202 | + unset($value, $tag, $full_tag); |
|
203 | 203 | |
204 | 204 | return $text; |
205 | 205 | } |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return array Modified merge tags |
220 | 220 | */ |
221 | - public function _filter_gform_custom_merge_tags( $custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '' ) { |
|
221 | + public function _filter_gform_custom_merge_tags($custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '') { |
|
222 | 222 | |
223 | - $form = GVCommon::get_form( $form_id ); |
|
223 | + $form = GVCommon::get_form($form_id); |
|
224 | 224 | |
225 | - $field_merge_tags = $this->custom_merge_tags( $form, $fields ); |
|
225 | + $field_merge_tags = $this->custom_merge_tags($form, $fields); |
|
226 | 226 | |
227 | - return array_merge( $custom_merge_tags, $field_merge_tags ); |
|
227 | + return array_merge($custom_merge_tags, $field_merge_tags); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return array Merge tag array with `label` and `tag` keys based on class `label` and `_custom_merge_tag` variables |
241 | 241 | */ |
242 | - protected function custom_merge_tags( $form = array(), $fields = array() ) { |
|
242 | + protected function custom_merge_tags($form = array(), $fields = array()) { |
|
243 | 243 | |
244 | 244 | // Use variables to make it unnecessary for other fields to override |
245 | 245 | $merge_tags = array( |
246 | 246 | array( |
247 | 247 | 'label' => $this->label, |
248 | - 'tag' => '{' . $this->_custom_merge_tag . '}', |
|
248 | + 'tag' => '{'.$this->_custom_merge_tag.'}', |
|
249 | 249 | ), |
250 | 250 | ); |
251 | 251 | |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return array |
264 | 264 | */ |
265 | - public function _filter_sortable_fields( $not_sortable ) { |
|
265 | + public function _filter_sortable_fields($not_sortable) { |
|
266 | 266 | |
267 | - if( ! $this->is_sortable ) { |
|
267 | + if (!$this->is_sortable) { |
|
268 | 268 | $not_sortable[] = $this->name; |
269 | 269 | } |
270 | 270 | |
@@ -275,35 +275,35 @@ discard block |
||
275 | 275 | $options = array( |
276 | 276 | 'link_to_post' => array( |
277 | 277 | 'type' => 'checkbox', |
278 | - 'label' => __( 'Link to the post', 'gravityview' ), |
|
279 | - 'desc' => __( 'Link to the post created by the entry.', 'gravityview' ), |
|
278 | + 'label' => __('Link to the post', 'gravityview'), |
|
279 | + 'desc' => __('Link to the post created by the entry.', 'gravityview'), |
|
280 | 280 | 'value' => false, |
281 | 281 | ), |
282 | 282 | 'link_to_term' => array( |
283 | 283 | 'type' => 'checkbox', |
284 | - 'label' => __( 'Link to the category or tag', 'gravityview' ), |
|
285 | - 'desc' => __( 'Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview' ), |
|
284 | + 'label' => __('Link to the category or tag', 'gravityview'), |
|
285 | + 'desc' => __('Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview'), |
|
286 | 286 | 'value' => false, |
287 | 287 | ), |
288 | 288 | 'dynamic_data' => array( |
289 | 289 | 'type' => 'checkbox', |
290 | - 'label' => __( 'Use the live post data', 'gravityview' ), |
|
291 | - 'desc' => __( 'Instead of using the entry data, instead use the current post data.', 'gravityview' ), |
|
290 | + 'label' => __('Use the live post data', 'gravityview'), |
|
291 | + 'desc' => __('Instead of using the entry data, instead use the current post data.', 'gravityview'), |
|
292 | 292 | 'value' => true, |
293 | 293 | ), |
294 | 294 | 'date_display' => array( |
295 | 295 | 'type' => 'text', |
296 | - 'label' => __( 'Override Date Format', 'gravityview' ), |
|
297 | - '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>' ), |
|
296 | + 'label' => __('Override Date Format', 'gravityview'), |
|
297 | + '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>'), |
|
298 | 298 | /** |
299 | 299 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
300 | 300 | * @param[in,out] null|string $date_format Date Format (default: null) |
301 | 301 | */ |
302 | - 'value' => apply_filters( 'gravityview_date_format', null ) |
|
302 | + 'value' => apply_filters('gravityview_date_format', null) |
|
303 | 303 | ), |
304 | 304 | 'new_window' => array( |
305 | 305 | 'type' => 'checkbox', |
306 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
306 | + 'label' => __('Open link in a new tab or window?', 'gravityview'), |
|
307 | 307 | 'value' => false, |
308 | 308 | ), |
309 | 309 | ); |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | * @filter `gravityview_field_support_options` Modify the settings that a field supports |
313 | 313 | * @param array $options Options multidimensional array with each key being the input name, with each array setting having `type`, `label`, `desc` and `value` (default values) keys |
314 | 314 | */ |
315 | - return apply_filters( 'gravityview_field_support_options', $options ); |
|
315 | + return apply_filters('gravityview_field_support_options', $options); |
|
316 | 316 | } |
317 | 317 | |
318 | - function add_field_support( $key = '', &$field_options ) { |
|
318 | + function add_field_support($key = '', &$field_options) { |
|
319 | 319 | |
320 | 320 | $options = $this->field_support_options(); |
321 | 321 | |
322 | - if( isset( $options[ $key ] ) ) { |
|
323 | - $field_options[ $key ] = $options[ $key ]; |
|
322 | + if (isset($options[$key])) { |
|
323 | + $field_options[$key] = $options[$key]; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | return $field_options; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param [type] $input_type [description] |
357 | 357 | * @return [type] [description] |
358 | 358 | */ |
359 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
359 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
360 | 360 | |
361 | 361 | $this->_field_options = $field_options; |
362 | 362 | $this->_field_id = $field_id; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | var $is_searchable = true; |
14 | 14 | |
15 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot' ); |
|
15 | + var $search_operators = array('is', 'in', 'not in', 'isnot'); |
|
16 | 16 | |
17 | 17 | var $group = 'pricing'; |
18 | 18 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * GravityView_Field_Payment_Status constructor. |
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | - $this->label = esc_html__( 'Payment Status', 'gravityview' ); |
|
26 | - $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
25 | + $this->label = esc_html__('Payment Status', 'gravityview'); |
|
26 | + $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview'); |
|
27 | 27 | parent::__construct(); |
28 | 28 | } |
29 | 29 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'date_created'; |
11 | 11 | |
12 | - var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' ); |
|
12 | + var $search_operators = array('less_than', 'greater_than', 'is', 'isnot'); |
|
13 | 13 | |
14 | 14 | var $group = 'meta'; |
15 | 15 | |
16 | - var $contexts = array( 'single', 'multiple', 'export' ); |
|
16 | + var $contexts = array('single', 'multiple', 'export'); |
|
17 | 17 | |
18 | 18 | var $_custom_merge_tag = 'date_created'; |
19 | 19 | |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | |
25 | - $this->label = esc_attr__( 'Date Created', 'gravityview' ); |
|
26 | - $this->description = esc_attr__( 'The date the entry was created.', 'gravityview' ); |
|
25 | + $this->label = esc_attr__('Date Created', 'gravityview'); |
|
26 | + $this->description = esc_attr__('The date the entry was created.', 'gravityview'); |
|
27 | 27 | |
28 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
28 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
29 | 29 | |
30 | 30 | parent::__construct(); |
31 | 31 | } |
32 | 32 | |
33 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
33 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
34 | 34 | |
35 | - if( 'edit' === $context ) { |
|
35 | + if ('edit' === $context) { |
|
36 | 36 | return $field_options; |
37 | 37 | } |
38 | 38 | |
39 | - $this->add_field_support('date_display', $field_options ); |
|
39 | + $this->add_field_support('date_display', $field_options); |
|
40 | 40 | |
41 | 41 | return $field_options; |
42 | 42 | } |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return String values for this field based on the numeric values used by Gravity Forms |
57 | 57 | */ |
58 | - public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
|
58 | + public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array()) { |
|
59 | 59 | |
60 | 60 | /** Overridden by a template. */ |
61 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
61 | + if (!empty($field['field_path'])) { return $output; } |
|
62 | 62 | |
63 | - return GVCommon::format_date( $field['value'], 'format='.rgar( $field_settings, 'date_display' ) ); |
|
63 | + return GVCommon::format_date($field['value'], 'format='.rgar($field_settings, 'date_display')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -78,21 +78,21 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
80 | 80 | */ |
81 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
81 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
82 | 82 | |
83 | 83 | $return = $text; |
84 | 84 | |
85 | 85 | /** Use $this->name instead of date_created because Payment Date uses this as well*/ |
86 | - $date_created = rgar( $entry, $this->name ); |
|
86 | + $date_created = rgar($entry, $this->name); |
|
87 | 87 | |
88 | - foreach ( $matches as $match ) { |
|
88 | + foreach ($matches as $match) { |
|
89 | 89 | |
90 | 90 | $full_tag = $match[0]; |
91 | 91 | $property = $match[1]; |
92 | 92 | |
93 | - $formatted_date = GravityView_Merge_Tags::format_date( $date_created, $property ); |
|
93 | + $formatted_date = GravityView_Merge_Tags::format_date($date_created, $property); |
|
94 | 94 | |
95 | - $return = str_replace( $full_tag, $formatted_date, $return ); |
|
95 | + $return = str_replace($full_tag, $formatted_date, $return); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $return; |