@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -227,7 +227,7 @@ |
||
227 | 227 | */ |
228 | 228 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() ); |
229 | 229 | |
230 | - $content = gravityview_get_link( $link, $content, $link_atts ); |
|
230 | + $content = gravityview_get_link( $link, $content, $link_atts ); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $output_arr[] = array( |
@@ -21,13 +21,13 @@ |
||
21 | 21 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
22 | 22 | ); |
23 | 23 | |
24 | - $field_options['make_clickable'] = array( |
|
25 | - 'type' => 'checkbox', |
|
26 | - 'merge_tags' => false, |
|
27 | - 'value' => 0, |
|
28 | - 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | - 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | - ); |
|
24 | + $field_options['make_clickable'] = array( |
|
25 | + 'type' => 'checkbox', |
|
26 | + 'merge_tags' => false, |
|
27 | + 'value' => 0, |
|
28 | + 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | + 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | + ); |
|
31 | 31 | |
32 | 32 | return $field_options; |
33 | 33 | } |
@@ -255,7 +255,6 @@ |
||
255 | 255 | * Get the default date format for a field based on the field ID and the time format setting |
256 | 256 | * |
257 | 257 | * @since 1.14 |
258 | - |
|
259 | 258 | * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14} |
260 | 259 | * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14} |
261 | 260 | * |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @file class-gravityview-field-address.php |
|
4 | - * @package GravityView |
|
5 | - * @subpackage includes\fields |
|
6 | - */ |
|
3 | + * @file class-gravityview-field-address.php |
|
4 | + * @package GravityView |
|
5 | + * @subpackage includes\fields |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Add custom options for address fields |
@@ -10,159 +10,159 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @var string |
12 | 12 | */ |
13 | - protected $name; |
|
13 | + protected $name; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Field settings |
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected $field; |
|
20 | + protected $field; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Field current value |
24 | 24 | * |
25 | 25 | * @var mixed |
26 | 26 | */ |
27 | - protected $value; |
|
28 | - |
|
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | - |
|
31 | - $this->name = $name; |
|
32 | - |
|
33 | - $defaults = self::get_field_defaults(); |
|
34 | - |
|
35 | - // Backward compatibility |
|
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
39 | - } |
|
40 | - |
|
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
42 | - |
|
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the default details for a field option |
|
49 | - * |
|
50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | - * - desc // option description |
|
52 | - * - value // the option default value |
|
53 | - * - label // the option label |
|
54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | - * - id // the field id |
|
56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | - * - merge_tags // if the option supports merge tags feature |
|
59 | - * - class // (new) define extra classes for the field |
|
60 | - * - tooltip // |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public static function get_field_defaults() { |
|
65 | - return array( |
|
66 | - 'desc' => '', |
|
67 | - 'value' => NULL, |
|
68 | - 'label' => '', |
|
69 | - 'left_label' => NULL, |
|
70 | - 'id' => NULL, |
|
71 | - 'type' => 'text', |
|
72 | - 'options' => NULL, |
|
73 | - 'merge_tags' => true, |
|
74 | - 'class' => '', |
|
75 | - 'tooltip' => NULL |
|
76 | - ); |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - function get_tooltip() { |
|
81 | - if( !function_exists('gform_tooltip') ) { |
|
82 | - return NULL; |
|
83 | - } |
|
84 | - |
|
85 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Build input id based on the name |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - function get_field_id() { |
|
93 | - if( isset( $this->field['id'] ) ) { |
|
94 | - return esc_attr( $this->field['id'] ); |
|
95 | - } |
|
96 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Retrieve field label |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function get_field_label() { |
|
104 | - return esc_html( trim( $this->field['label'] ) ); |
|
105 | - } |
|
27 | + protected $value; |
|
28 | + |
|
29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | + |
|
31 | + $this->name = $name; |
|
32 | + |
|
33 | + $defaults = self::get_field_defaults(); |
|
34 | + |
|
35 | + // Backward compatibility |
|
36 | + if( !empty( $field['choices'] ) ) { |
|
37 | + $field['options'] = $field['choices']; |
|
38 | + unset( $field['choices'] ); |
|
39 | + } |
|
40 | + |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | + |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the default details for a field option |
|
49 | + * |
|
50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | + * - desc // option description |
|
52 | + * - value // the option default value |
|
53 | + * - label // the option label |
|
54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | + * - id // the field id |
|
56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | + * - merge_tags // if the option supports merge tags feature |
|
59 | + * - class // (new) define extra classes for the field |
|
60 | + * - tooltip // |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public static function get_field_defaults() { |
|
65 | + return array( |
|
66 | + 'desc' => '', |
|
67 | + 'value' => NULL, |
|
68 | + 'label' => '', |
|
69 | + 'left_label' => NULL, |
|
70 | + 'id' => NULL, |
|
71 | + 'type' => 'text', |
|
72 | + 'options' => NULL, |
|
73 | + 'merge_tags' => true, |
|
74 | + 'class' => '', |
|
75 | + 'tooltip' => NULL |
|
76 | + ); |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + function get_tooltip() { |
|
81 | + if( !function_exists('gform_tooltip') ) { |
|
82 | + return NULL; |
|
83 | + } |
|
84 | + |
|
85 | + return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Build input id based on the name |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + function get_field_id() { |
|
93 | + if( isset( $this->field['id'] ) ) { |
|
94 | + return esc_attr( $this->field['id'] ); |
|
95 | + } |
|
96 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Retrieve field label |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function get_field_label() { |
|
104 | + return esc_html( trim( $this->field['label'] ) ); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Retrieve field left label |
109 | - * |
|
110 | - * @since 1.7 |
|
111 | - * |
|
109 | + * |
|
110 | + * @since 1.7 |
|
111 | + * |
|
112 | 112 | * @return string |
113 | 113 | */ |
114 | 114 | function get_field_left_label() { |
115 | 115 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Retrieve field label class |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - function get_label_class() { |
|
123 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * Retrieve field description |
|
129 | - * @return string |
|
130 | - */ |
|
131 | - function get_field_desc() { |
|
132 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * Verify if field should have merge tags |
|
138 | - * @return boolean |
|
139 | - */ |
|
140 | - function show_merge_tags() { |
|
141 | - // Show the merge tags if the field is a list view |
|
142 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
143 | - // Or is a single entry view |
|
144 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
145 | - |
|
146 | - return ( $is_single || $is_list ); |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * important! Override this class |
|
153 | - * outputs the field option html |
|
154 | - */ |
|
155 | - function render_option() { |
|
156 | - // to replace on each field |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * important! Override this class if needed |
|
161 | - * outputs the field setting html |
|
162 | - */ |
|
163 | - function render_setting( $override_input = NULL ) { |
|
164 | - |
|
165 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
118 | + /** |
|
119 | + * Retrieve field label class |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + function get_label_class() { |
|
123 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * Retrieve field description |
|
129 | + * @return string |
|
130 | + */ |
|
131 | + function get_field_desc() { |
|
132 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * Verify if field should have merge tags |
|
138 | + * @return boolean |
|
139 | + */ |
|
140 | + function show_merge_tags() { |
|
141 | + // Show the merge tags if the field is a list view |
|
142 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
143 | + // Or is a single entry view |
|
144 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
145 | + |
|
146 | + return ( $is_single || $is_list ); |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * important! Override this class |
|
153 | + * outputs the field option html |
|
154 | + */ |
|
155 | + function render_option() { |
|
156 | + // to replace on each field |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * important! Override this class if needed |
|
161 | + * outputs the field setting html |
|
162 | + */ |
|
163 | + function render_setting( $override_input = NULL ) { |
|
164 | + |
|
165 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
166 | 166 | <th scope="row" colspan="2"> |
167 | 167 | <div> |
168 | 168 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | </td> |
183 | 183 | <?php } |
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * important! Override this class |
|
189 | - * outputs the input html part |
|
190 | - */ |
|
191 | - function render_input( $override_input ) { |
|
192 | - echo ''; |
|
193 | - } |
|
187 | + /** |
|
188 | + * important! Override this class |
|
189 | + * outputs the input html part |
|
190 | + */ |
|
191 | + function render_input( $override_input ) { |
|
192 | + echo ''; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | } |
@@ -122,7 +122,7 @@ |
||
122 | 122 | |
123 | 123 | $atts = array( |
124 | 124 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
125 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
125 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
126 | 126 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
127 | 127 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
128 | 128 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | |
147 | 147 | if( !empty( $field['custom_class'] ) ) { |
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field['custom_class']; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if( !empty( $entry ) ) { |
|
152 | 152 | |
153 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | - // replaced by a multiple-word value that should be output as a single class. |
|
155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
153 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | + // replaced by a multiple-word value that should be output as a single class. |
|
155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
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 | - // And then we want life to return to normal |
|
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | - } |
|
160 | + // And then we want life to return to normal |
|
161 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | 'format' => $format, |
293 | 293 | 'entry' => $entry, |
294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
295 | - 'field_path' => $field_path, /** {@since 1.16} */ |
|
295 | + 'field_path' => $field_path, /** {@since 1.16} */ |
|
296 | 296 | )); |
297 | 297 | |
298 | 298 | if( ! empty( $field_path ) ) { |
@@ -603,29 +603,29 @@ discard block |
||
603 | 603 | return sanitize_title( $slug ); |
604 | 604 | } |
605 | 605 | |
606 | - /** |
|
607 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | - * |
|
609 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | - * |
|
611 | - * @param $entry array Gravity Forms entry object |
|
612 | - * @param $form array Gravity Forms form object |
|
613 | - */ |
|
614 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | - /** |
|
616 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | - * @param boolean $custom Should we process the custom entry slug? |
|
618 | - */ |
|
619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | - if( $custom ) { |
|
621 | - // create the gravityview_unique_id and save it |
|
606 | + /** |
|
607 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | + * |
|
609 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | + * |
|
611 | + * @param $entry array Gravity Forms entry object |
|
612 | + * @param $form array Gravity Forms form object |
|
613 | + */ |
|
614 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | + /** |
|
616 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | + * @param boolean $custom Should we process the custom entry slug? |
|
618 | + */ |
|
619 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | + if( $custom ) { |
|
621 | + // create the gravityview_unique_id and save it |
|
622 | 622 | |
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 ); |
|
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 ); |
|
626 | 626 | |
627 | - } |
|
628 | - } |
|
627 | + } |
|
628 | + } |
|
629 | 629 | |
630 | 630 | |
631 | 631 | |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | |
890 | 890 | // If there was an error, continue to the next term. |
891 | 891 | if ( is_wp_error( $term_link ) ) { |
892 | - continue; |
|
892 | + continue; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -1037,15 +1037,15 @@ |
||
1037 | 1037 | GFForms::register_scripts(); |
1038 | 1038 | |
1039 | 1039 | $scripts = array( |
1040 | - 'sack', |
|
1041 | - 'gform_gravityforms', |
|
1042 | - 'gform_forms', |
|
1043 | - 'gform_form_admin', |
|
1044 | - 'jquery-ui-autocomplete' |
|
1040 | + 'sack', |
|
1041 | + 'gform_gravityforms', |
|
1042 | + 'gform_forms', |
|
1043 | + 'gform_form_admin', |
|
1044 | + 'jquery-ui-autocomplete' |
|
1045 | 1045 | ); |
1046 | 1046 | |
1047 | 1047 | if ( wp_is_mobile() ) { |
1048 | - $scripts[] = 'jquery-touch-punch'; |
|
1048 | + $scripts[] = 'jquery-touch-punch'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | foreach ($scripts as $script) { |