@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
313 | 313 | |
314 | 314 | |
315 | - /** |
|
316 | - * When an entry is created, check if we need to update the custom slug meta |
|
317 | - * todo: move this to its own class.. |
|
318 | - */ |
|
319 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
315 | + /** |
|
316 | + * When an entry is created, check if we need to update the custom slug meta |
|
317 | + * todo: move this to its own class.. |
|
318 | + */ |
|
319 | + add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
320 | 320 | |
321 | 321 | /** |
322 | 322 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
@@ -347,34 +347,34 @@ discard block |
||
347 | 347 | |
348 | 348 | /** DEBUG */ |
349 | 349 | |
350 | - /** |
|
351 | - * Logs messages using Gravity Forms logging add-on |
|
352 | - * @param string $message log message |
|
353 | - * @param mixed $data Additional data to display |
|
354 | - * @return void |
|
355 | - */ |
|
356 | - public static function log_debug( $message, $data = null ){ |
|
357 | - /** |
|
358 | - * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
359 | - * @param string $message Message to display |
|
360 | - * @param mixed $data Supporting data to print alongside it |
|
361 | - */ |
|
362 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
363 | - } |
|
364 | - |
|
365 | - /** |
|
366 | - * Logs messages using Gravity Forms logging add-on |
|
367 | - * @param string $message log message |
|
368 | - * @return void |
|
369 | - */ |
|
370 | - public static function log_error( $message, $data = null ){ |
|
371 | - /** |
|
372 | - * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
373 | - * @param string $message Error message to display |
|
374 | - * @param mixed $data Supporting data to print alongside it |
|
375 | - */ |
|
376 | - do_action( 'gravityview_log_error', $message, $data ); |
|
377 | - } |
|
350 | + /** |
|
351 | + * Logs messages using Gravity Forms logging add-on |
|
352 | + * @param string $message log message |
|
353 | + * @param mixed $data Additional data to display |
|
354 | + * @return void |
|
355 | + */ |
|
356 | + public static function log_debug( $message, $data = null ){ |
|
357 | + /** |
|
358 | + * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
359 | + * @param string $message Message to display |
|
360 | + * @param mixed $data Supporting data to print alongside it |
|
361 | + */ |
|
362 | + do_action( 'gravityview_log_debug', $message, $data ); |
|
363 | + } |
|
364 | + |
|
365 | + /** |
|
366 | + * Logs messages using Gravity Forms logging add-on |
|
367 | + * @param string $message log message |
|
368 | + * @return void |
|
369 | + */ |
|
370 | + public static function log_error( $message, $data = null ){ |
|
371 | + /** |
|
372 | + * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
373 | + * @param string $message Error message to display |
|
374 | + * @param mixed $data Supporting data to print alongside it |
|
375 | + */ |
|
376 | + do_action( 'gravityview_log_error', $message, $data ); |
|
377 | + } |
|
378 | 378 | |
379 | 379 | } // end class GravityView_Plugin |
380 | 380 |
@@ -10,158 +10,158 @@ 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 | - 'id' => NULL, |
|
70 | - 'type' => 'text', |
|
71 | - 'options' => NULL, |
|
72 | - 'merge_tags' => true, |
|
73 | - 'class' => '', |
|
74 | - 'tooltip' => NULL |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - function get_tooltip() { |
|
80 | - if( !function_exists('gform_tooltip') ) { |
|
81 | - return NULL; |
|
82 | - } |
|
83 | - |
|
84 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Build input id based on the name |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - function get_field_id() { |
|
92 | - if( isset( $this->field['id'] ) ) { |
|
93 | - return esc_attr( $this->field['id'] ); |
|
94 | - } |
|
95 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Retrieve field label |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function get_field_label() { |
|
103 | - return esc_html( trim( $this->field['label'] ) ); |
|
104 | - } |
|
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 | + 'id' => NULL, |
|
70 | + 'type' => 'text', |
|
71 | + 'options' => NULL, |
|
72 | + 'merge_tags' => true, |
|
73 | + 'class' => '', |
|
74 | + 'tooltip' => NULL |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + function get_tooltip() { |
|
80 | + if( !function_exists('gform_tooltip') ) { |
|
81 | + return NULL; |
|
82 | + } |
|
83 | + |
|
84 | + return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Build input id based on the name |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + function get_field_id() { |
|
92 | + if( isset( $this->field['id'] ) ) { |
|
93 | + return esc_attr( $this->field['id'] ); |
|
94 | + } |
|
95 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Retrieve field label |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function get_field_label() { |
|
103 | + return esc_html( trim( $this->field['label'] ) ); |
|
104 | + } |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Retrieve field left label |
108 | - * |
|
109 | - * @since 1.7 |
|
110 | - * |
|
108 | + * |
|
109 | + * @since 1.7 |
|
110 | + * |
|
111 | 111 | * @return string |
112 | 112 | */ |
113 | 113 | function get_field_left_label() { |
114 | 114 | return isset( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Retrieve field label class |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - function get_label_class() { |
|
122 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Retrieve field description |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - function get_field_desc() { |
|
131 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * Verify if field should have merge tags |
|
137 | - * @return boolean |
|
138 | - */ |
|
139 | - function show_merge_tags() { |
|
140 | - // Show the merge tags if the field is a list view |
|
141 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
142 | - // Or is a single entry view |
|
143 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
144 | - |
|
145 | - return ( $is_single || $is_list ); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * important! Override this class |
|
152 | - * outputs the field option html |
|
153 | - */ |
|
154 | - function render_option() { |
|
155 | - // to replace on each field |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * important! Override this class if needed |
|
160 | - * outputs the field setting html |
|
161 | - */ |
|
162 | - function render_setting( $override_input = NULL ) { |
|
163 | - |
|
164 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
117 | + /** |
|
118 | + * Retrieve field label class |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + function get_label_class() { |
|
122 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Retrieve field description |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + function get_field_desc() { |
|
131 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * Verify if field should have merge tags |
|
137 | + * @return boolean |
|
138 | + */ |
|
139 | + function show_merge_tags() { |
|
140 | + // Show the merge tags if the field is a list view |
|
141 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
142 | + // Or is a single entry view |
|
143 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
144 | + |
|
145 | + return ( $is_single || $is_list ); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * important! Override this class |
|
152 | + * outputs the field option html |
|
153 | + */ |
|
154 | + function render_option() { |
|
155 | + // to replace on each field |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * important! Override this class if needed |
|
160 | + * outputs the field setting html |
|
161 | + */ |
|
162 | + function render_setting( $override_input = NULL ) { |
|
163 | + |
|
164 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
165 | 165 | <th scope="row" colspan="2"> |
166 | 166 | <div> |
167 | 167 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | </td> |
182 | 182 | <?php } |
183 | 183 | |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - /** |
|
187 | - * important! Override this class |
|
188 | - * outputs the input html part |
|
189 | - */ |
|
190 | - function render_input( $override_input ) { |
|
191 | - echo ''; |
|
192 | - } |
|
186 | + /** |
|
187 | + * important! Override this class |
|
188 | + * outputs the input html part |
|
189 | + */ |
|
190 | + function render_input( $override_input ) { |
|
191 | + echo ''; |
|
192 | + } |
|
193 | 193 | |
194 | 194 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
18 | + $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
19 | 19 | |
20 | 20 | ?> |
21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -18,10 +18,10 @@ |
||
18 | 18 | |
19 | 19 | $show_mt = $this->show_merge_tags(); |
20 | 20 | |
21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
22 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
23 | - } |
|
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
21 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
22 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
23 | + } |
|
24 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -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 ); ?>"> |
@@ -28,14 +28,14 @@ |
||
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 '; |
|
33 | - |
|
34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | - $class .= ' mt-hide_all_fields'; |
|
36 | - } |
|
37 | - } |
|
38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $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 '; |
|
33 | + |
|
34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | + $class .= ' mt-hide_all_fields'; |
|
36 | + } |
|
37 | + } |
|
38 | + $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
39 | 39 | |
40 | 40 | ?> |
41 | 41 | <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | if( !GravityView_Compatibility::is_valid() ) { return; } |
16 | 16 | |
17 | - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
17 | + self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
18 | 18 | |
19 | 19 | include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; |
20 | 20 | |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
229 | 229 | |
230 | 230 | if( isset( $form['id'] ) ) { |
231 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
231 | + $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
232 | 232 | |
233 | - // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
234 | - $_GET['id'] = $form['id']; |
|
233 | + // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
234 | + $_GET['id'] = $form['id']; |
|
235 | 235 | |
236 | 236 | } else { |
237 | - $form_script = 'var form = new Form();'; |
|
237 | + $form_script = 'var form = new Form();'; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the tab panels for the Settings metabox |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
7 | - * @since 1.8 |
|
8 | - * |
|
9 | - * @global array $metaboxes |
|
10 | - * @global WP_Post $post |
|
11 | - */ |
|
3 | + * Display the tab panels for the Settings metabox |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
7 | + * @since 1.8 |
|
8 | + * |
|
9 | + * @global array $metaboxes |
|
10 | + * @global WP_Post $post |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the tab navigation for the Settings metabox |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
7 | - * @since 1.8 |
|
8 | - * |
|
9 | - * @global GravityView_Metabox_Tab[] $metaboxes |
|
10 | - * @global WP_Post $post |
|
11 | - */ |
|
3 | + * Display the tab navigation for the Settings metabox |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
7 | + * @since 1.8 |
|
8 | + * |
|
9 | + * @global GravityView_Metabox_Tab[] $metaboxes |
|
10 | + * @global WP_Post $post |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |