@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Don't exit if we're running test suite. |
37 | 37 | * @since 1.15 |
38 | 38 | */ |
39 | - if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
39 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
40 | 40 | return $mixed; |
41 | 41 | } |
42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | function check_ajax_nonce() { |
53 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) { |
|
53 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) { |
|
54 | 54 | $this->_exit( false ); |
55 | 55 | } |
56 | 56 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $context = rgpost( 'context' ); |
69 | 69 | |
70 | 70 | // Return markup for a single or multiple contexts |
71 | - if( $context ) { |
|
71 | + if ( $context ) { |
|
72 | 72 | $data = array( |
73 | 73 | esc_attr( $context ) => '' |
74 | 74 | ); |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | function get_active_areas() { |
112 | 112 | $this->check_ajax_nonce(); |
113 | 113 | |
114 | - if( empty( $_POST['template_id'] ) ) { |
|
114 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
115 | 115 | $this->_exit( false ); |
116 | 116 | } |
117 | 117 | |
118 | 118 | ob_start(); |
119 | - do_action( 'gravityview_render_directory_active_areas', \GV\Utils::_POST('template_id'), 'directory', '', true, \GV\Utils::_POST( 'form_id', 0 ) ); |
|
120 | - $response['directory'] = ob_get_clean(); |
|
119 | + do_action( 'gravityview_render_directory_active_areas', \GV\Utils::_POST( 'template_id' ), 'directory', '', true, \GV\Utils::_POST( 'form_id', 0 ) ); |
|
120 | + $response[ 'directory' ] = ob_get_clean(); |
|
121 | 121 | |
122 | 122 | ob_start(); |
123 | - do_action( 'gravityview_render_directory_active_areas', \GV\Utils::_POST('template_id'), 'single', '', true, \GV\Utils::_POST( 'form_id', 0 ) ); |
|
124 | - $response['single'] = ob_get_clean(); |
|
123 | + do_action( 'gravityview_render_directory_active_areas', \GV\Utils::_POST( 'template_id' ), 'single', '', true, \GV\Utils::_POST( 'form_id', 0 ) ); |
|
124 | + $response[ 'single' ] = ob_get_clean(); |
|
125 | 125 | |
126 | 126 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
127 | 127 | |
@@ -136,20 +136,20 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->check_ajax_nonce(); |
138 | 138 | |
139 | - if( empty( $_POST['template_id'] ) ) { |
|
139 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
140 | 140 | $this->_exit( false ); |
141 | 141 | } |
142 | 142 | |
143 | 143 | // get the fields xml config file for this specific preset |
144 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
144 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
145 | 145 | // import fields |
146 | - if( !empty( $preset_fields_path ) ) { |
|
146 | + if ( ! empty( $preset_fields_path ) ) { |
|
147 | 147 | $presets = $this->import_fields( $preset_fields_path ); |
148 | 148 | } else { |
149 | 149 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
150 | 150 | } |
151 | 151 | |
152 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
152 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
153 | 153 | |
154 | 154 | // template areas |
155 | 155 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -159,20 +159,20 @@ discard block |
||
159 | 159 | $default_widget_areas = \GV\Widget::get_default_widget_areas(); |
160 | 160 | |
161 | 161 | ob_start(); |
162 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
163 | - $response['header'] = ob_get_clean(); |
|
162 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
163 | + $response[ 'header' ] = ob_get_clean(); |
|
164 | 164 | |
165 | 165 | ob_start(); |
166 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
167 | - $response['footer'] = ob_get_clean(); |
|
166 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
167 | + $response[ 'footer' ] = ob_get_clean(); |
|
168 | 168 | |
169 | 169 | ob_start(); |
170 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
171 | - $response['directory'] = ob_get_clean(); |
|
170 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
171 | + $response[ 'directory' ] = ob_get_clean(); |
|
172 | 172 | |
173 | 173 | ob_start(); |
174 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
175 | - $response['single'] = ob_get_clean(); |
|
174 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
175 | + $response[ 'single' ] = ob_get_clean(); |
|
176 | 176 | |
177 | 177 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
178 | 178 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | |
191 | 191 | $this->check_ajax_nonce(); |
192 | 192 | |
193 | - if( empty( $_POST['template_id'] ) ) { |
|
193 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
194 | 194 | gravityview()->log->error( 'Cannot create preset form; the template_id is empty.' ); |
195 | 195 | $this->_exit( false ); |
196 | 196 | } |
197 | 197 | |
198 | 198 | // get the xml for this specific template_id |
199 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
199 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
200 | 200 | |
201 | 201 | // import form |
202 | 202 | $form = $this->import_form( $preset_form_xml_path ); |
203 | 203 | |
204 | 204 | // get the form ID |
205 | - if( false === $form ) { |
|
205 | + if ( false === $form ) { |
|
206 | 206 | // send error to user |
207 | - gravityview()->log->error( 'Error importing form for template id: {template_id}', array( 'template_id' => (int) $_POST['template_id'] ) ); |
|
207 | + gravityview()->log->error( 'Error importing form for template id: {template_id}', array( 'template_id' => (int)$_POST[ 'template_id' ] ) ); |
|
208 | 208 | |
209 | 209 | $this->_exit( false ); |
210 | 210 | } |
211 | 211 | |
212 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
212 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | gravityview()->log->debug( '[import_form] Import Preset Form. (File) {path}', array( 'path' => $xml_or_json_path ) ); |
225 | 225 | |
226 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
226 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
227 | 227 | gravityview()->log->error( 'Class GFExport or file not found. file: {path}', array( 'path' => $xml_or_json_path ) ); |
228 | 228 | return false; |
229 | 229 | } |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | gravityview()->log->debug( '[import_form] Importing form (Result) {count}', array( 'count' => $count ) ); |
236 | 236 | gravityview()->log->debug( '[import_form] Importing form (Form) ', array( 'data' => $forms ) ); |
237 | 237 | |
238 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
238 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
239 | 239 | gravityview()->log->error( 'Form Import Failed!' ); |
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | 243 | // import success - return form id |
244 | - return $forms[0]; |
|
244 | + return $forms[ 0 ]; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | function get_field_options() { |
255 | 255 | $this->check_ajax_nonce(); |
256 | 256 | |
257 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
257 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
258 | 258 | gravityview()->log->error( 'Required fields were not set in the $_POST request. ' ); |
259 | 259 | $this->_exit( false ); |
260 | 260 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $_post = array_map( 'esc_attr', $_post ); |
267 | 267 | |
268 | 268 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
269 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
270 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
269 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
270 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
271 | 271 | |
272 | - $form_id = empty( $_post['form_id'] ) ? null : $_post['form_id']; |
|
273 | - $response = GravityView_Render_Settings::render_field_options( $form_id, $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
272 | + $form_id = empty( $_post[ 'form_id' ] ) ? null : $_post[ 'form_id' ]; |
|
273 | + $response = GravityView_Render_Settings::render_field_options( $form_id, $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
274 | 274 | |
275 | 275 | $response = gravityview_strip_whitespace( $response ); |
276 | 276 | |
@@ -290,15 +290,15 @@ discard block |
||
290 | 290 | $form = ''; |
291 | 291 | |
292 | 292 | // if form id is set, use it, else, get form from preset |
293 | - if( !empty( $_POST['form_id'] ) ) { |
|
293 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
294 | 294 | |
295 | - $form = (int) $_POST['form_id']; |
|
295 | + $form = (int)$_POST[ 'form_id' ]; |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | // get form from preset |
299 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
299 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
300 | 300 | |
301 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
301 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
302 | 302 | |
303 | 303 | } |
304 | 304 | |
@@ -316,13 +316,13 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return array|false |
318 | 318 | */ |
319 | - static function pre_get_form_fields( $template_id = '') { |
|
320 | - if( empty( $template_id ) ) { |
|
319 | + static function pre_get_form_fields( $template_id = '' ) { |
|
320 | + if ( empty( $template_id ) ) { |
|
321 | 321 | gravityview()->log->error( 'Template ID not set.' ); |
322 | 322 | return false; |
323 | 323 | } else { |
324 | 324 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
325 | - if( !file_exists( $form_file ) ) { |
|
325 | + if ( ! file_exists( $form_file ) ) { |
|
326 | 326 | gravityview()->log->error( '[{template_id}] form file does not exist: {path}.', array( 'template_id' => $template_id, 'path' => $form_file ) ); |
327 | 327 | return false; |
328 | 328 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | return false; |
340 | 340 | } |
341 | 341 | |
342 | - $form = GFFormsModel::convert_field_objects( $forms[0] ); |
|
342 | + $form = GFFormsModel::convert_field_objects( $forms[ 0 ] ); |
|
343 | 343 | $form = GFFormsModel::sanitize_settings( $form ); |
344 | 344 | |
345 | 345 | gravityview()->log->debug( '[pre_get_form_fields] Importing Form Fields for preset [{template_id}]. (Form)', array( 'template_id' => $template_id, 'data' => $form ) ); |
@@ -354,38 +354,38 @@ discard block |
||
354 | 354 | */ |
355 | 355 | function import_fields( $file ) { |
356 | 356 | |
357 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
357 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
358 | 358 | gravityview()->log->error( 'Importing Preset Fields. File not found. (File) {path}', array( 'path' => $file ) ); |
359 | 359 | return false; |
360 | 360 | } |
361 | 361 | |
362 | - if( !class_exists('WXR_Parser') ) { |
|
362 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
363 | 363 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
364 | 364 | } |
365 | 365 | |
366 | 366 | $parser = new WXR_Parser(); |
367 | 367 | $presets = $parser->parse( $file ); |
368 | 368 | |
369 | - if(is_wp_error( $presets )) { |
|
369 | + if ( is_wp_error( $presets ) ) { |
|
370 | 370 | gravityview()->log->error( 'Importing Preset Fields failed. Threw WP_Error.', array( 'data' => $presets ) ); |
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
374 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
374 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
375 | 375 | gravityview()->log->error( 'Importing Preset Fields failed. Meta not found in file. {path}', array( 'path' => $file ) ); |
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | |
379 | - gravityview()->log->debug( '[import_fields] postmeta', array( 'data' => $presets['posts'][0]['postmeta'] ) ); |
|
379 | + gravityview()->log->debug( '[import_fields] postmeta', array( 'data' => $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ); |
|
380 | 380 | |
381 | 381 | $fields = $widgets = array(); |
382 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
383 | - switch ($meta['key']) { |
|
382 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
383 | + switch ( $meta[ 'key' ] ) { |
|
384 | 384 | case '_gravityview_directory_fields': |
385 | - $fields = maybe_unserialize( $meta['value'] ); |
|
385 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
386 | 386 | break; |
387 | 387 | case '_gravityview_directory_widgets': |
388 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
388 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
389 | 389 | break; |
390 | 390 | } |
391 | 391 | } |
@@ -27,35 +27,35 @@ discard block |
||
27 | 27 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 ); |
28 | 28 | |
29 | 29 | // Tooltips |
30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
31 | 31 | |
32 | 32 | add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) ); |
33 | 33 | |
34 | 34 | // adding styles and scripts |
35 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
36 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
39 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
40 | - |
|
41 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 5 ); |
|
42 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
43 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
47 | - add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields'), 10, 3 ); |
|
35 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
36 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
39 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
40 | + |
|
41 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 5 ); |
|
42 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
43 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
47 | + add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields' ), 10, 3 ); |
|
48 | 48 | |
49 | 49 | // @todo check if this hook is needed.. |
50 | 50 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
51 | 51 | |
52 | 52 | // Add Connected Form column |
53 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
53 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
54 | 54 | |
55 | 55 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
56 | 56 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
57 | 57 | |
58 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
58 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
59 | 59 | |
60 | 60 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
61 | 61 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $major_version = explode( '.', GFForms::$version ); |
88 | 88 | |
89 | 89 | if ( 2 <= sizeof( $major_version ) ) { |
90 | - $class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] ); |
|
90 | + $class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $class; |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function suggest_support_articles( $localization_data = array() ) { |
104 | 104 | |
105 | - if( ! gravityview()->request->is_view( false ) ) { |
|
105 | + if ( ! gravityview()->request->is_view( false ) ) { |
|
106 | 106 | return $localization_data; |
107 | 107 | } |
108 | 108 | |
109 | - $localization_data['suggest'] = array( |
|
109 | + $localization_data[ 'suggest' ] = array( |
|
110 | 110 | '57ef23539033602e61d4a560', |
111 | 111 | '54c67bb9e4b0512429885513', |
112 | 112 | '54c67bb9e4b0512429885512', |
@@ -135,20 +135,20 @@ discard block |
||
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
138 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
142 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
146 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
147 | 147 | |
148 | 148 | $meta_query = array(); |
149 | 149 | |
150 | 150 | if ( $form_id ) { |
151 | - $meta_query[] = array( |
|
151 | + $meta_query[ ] = array( |
|
152 | 152 | 'key' => '_gravityview_form_id', |
153 | 153 | 'value' => $form_id, |
154 | 154 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
158 | 158 | |
159 | 159 | if ( $layout_id ) { |
160 | - $meta_query[] = array( |
|
160 | + $meta_query[ ] = array( |
|
161 | 161 | 'key' => '_gravityview_directory_template', |
162 | 162 | 'value' => esc_attr( $layout_id ), |
163 | 163 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function add_view_dropdown() { |
175 | 175 | $current_screen = get_current_screen(); |
176 | 176 | |
177 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
177 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
183 | 183 | |
184 | 184 | // If there are no forms to select, show no forms. |
185 | - if( ! empty( $forms ) ) { ?> |
|
185 | + if ( ! empty( $forms ) ) { ?> |
|
186 | 186 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gk-gravityview' ); ?></label> |
187 | 187 | <select name="gravityview_form_id" id="gravityview_form_id"> |
188 | 188 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gk-gravityview' ); ?></option> |
189 | - <?php foreach( $forms as $form ) { ?> |
|
190 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
189 | + <?php foreach ( $forms as $form ) { ?> |
|
190 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
191 | 191 | <?php } ?> |
192 | 192 | </select> |
193 | 193 | <?php } |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
197 | 197 | |
198 | 198 | // If there are no forms to select, show no forms. |
199 | - if( ! empty( $layouts ) ) { ?> |
|
199 | + if ( ! empty( $layouts ) ) { ?> |
|
200 | 200 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gk-gravityview' ); ?></label> |
201 | 201 | <select name="gravityview_layout" id="gravityview_layout_name"> |
202 | 202 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gk-gravityview' ); ?></option> |
203 | 203 | <optgroup label="<?php esc_html_e( 'Layouts', 'gk-gravityview' ); ?>"> |
204 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
205 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
204 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
205 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | ?> |
209 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
209 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
210 | 210 | <?php } ?> |
211 | 211 | </optgroup> |
212 | 212 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gk-gravityview' ); ?>"> |
213 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
214 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
213 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
214 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | ?> |
218 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
218 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
219 | 219 | <?php } ?> |
220 | 220 | </optgroup> |
221 | 221 | </select> |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
231 | 231 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
232 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
232 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $priority = 0; |
261 | 261 | |
262 | - if( 'form_list' === GFForms::get_page() ) { |
|
262 | + if ( 'form_list' === GFForms::get_page() ) { |
|
263 | 263 | $priority = 790; |
264 | 264 | } |
265 | 265 | |
266 | - if( empty( $connected_views ) ) { |
|
266 | + if ( empty( $connected_views ) ) { |
|
267 | 267 | |
268 | - $menu_items['gravityview'] = array( |
|
268 | + $menu_items[ 'gravityview' ] = array( |
|
269 | 269 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
270 | 270 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
271 | 271 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -281,23 +281,23 @@ discard block |
||
281 | 281 | $sub_menu_items = array(); |
282 | 282 | foreach ( (array)$connected_views as $view ) { |
283 | 283 | |
284 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
284 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
288 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
289 | 289 | |
290 | - $sub_menu_items[] = array( |
|
290 | + $sub_menu_items[ ] = array( |
|
291 | 291 | 'label' => esc_attr( $label ), |
292 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
292 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
293 | 293 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
294 | 294 | ); |
295 | 295 | } |
296 | 296 | |
297 | 297 | // If there were no items added, then let's create the parent menu |
298 | - if( $sub_menu_items ) { |
|
298 | + if ( $sub_menu_items ) { |
|
299 | 299 | |
300 | - $sub_menu_items[] = array( |
|
300 | + $sub_menu_items[ ] = array( |
|
301 | 301 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
302 | 302 | 'icon' => '<span class="dashicons dashicons-plus"></span>', |
303 | 303 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -306,14 +306,14 @@ discard block |
||
306 | 306 | ); |
307 | 307 | |
308 | 308 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
309 | - $sub_menu_items[] = array( |
|
309 | + $sub_menu_items[ ] = array( |
|
310 | 310 | 'url' => '#', |
311 | 311 | 'label' => '', |
312 | 312 | 'menu_class' => 'hidden', |
313 | 313 | 'capabilities' => '', |
314 | 314 | ); |
315 | 315 | |
316 | - $menu_items['gravityview'] = array( |
|
316 | + $menu_items[ 'gravityview' ] = array( |
|
317 | 317 | 'label' => __( 'Connected Views', 'gk-gravityview' ), |
318 | 318 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
319 | 319 | 'title' => __( 'GravityView Views using this form as a data source', 'gk-gravityview' ), |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | $add = array( 'captcha', 'page' ); |
345 | 345 | |
346 | 346 | // Don't allowing editing the following values: |
347 | - if( $context === 'edit' ) { |
|
348 | - $add[] = 'post_id'; |
|
347 | + if ( $context === 'edit' ) { |
|
348 | + $add[ ] = 'post_id'; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | $return = array_merge( $array, $add ); |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | foreach ( $default_args as $key => $arg ) { |
377 | 377 | |
378 | 378 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
379 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
379 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
380 | 380 | |
381 | 381 | // By default, use `tooltip` if defined. |
382 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
382 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
383 | 383 | |
384 | 384 | // If there's no tooltip set, continue |
385 | - if( empty( $tooltip ) ) { |
|
385 | + if ( empty( $tooltip ) ) { |
|
386 | 386 | continue; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // Add the tooltip |
390 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
391 | - 'title' => $arg['label'], |
|
390 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
391 | + 'title' => $arg[ 'label' ], |
|
392 | 392 | 'value' => $tooltip, |
393 | 393 | ); |
394 | 394 | |
395 | 395 | } |
396 | 396 | |
397 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
398 | - 'title' => __('CSS Merge Tags', 'gk-gravityview'), |
|
399 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview'), '<code>', '</code>' ) |
|
397 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
398 | + 'title' => __( 'CSS Merge Tags', 'gk-gravityview' ), |
|
399 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview' ), '<code>', '</code>' ) |
|
400 | 400 | ); |
401 | 401 | |
402 | 402 | /** |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | foreach ( $gv_tooltips as $key => $tooltip ) { |
416 | 416 | |
417 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
417 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
418 | 418 | |
419 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
419 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return $tooltips; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return void |
432 | 432 | */ |
433 | - public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
433 | + public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
434 | 434 | |
435 | 435 | $output = ''; |
436 | 436 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
453 | 453 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
454 | 454 | |
455 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
455 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
456 | 456 | |
457 | 457 | break; |
458 | 458 | |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
494 | 494 | |
495 | 495 | // Either the form is empty or the form ID is 0, not yet set. |
496 | - if( empty( $form ) ) { |
|
496 | + if ( empty( $form ) ) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | |
500 | 500 | // The $form is passed as the form ID |
501 | - if( !is_array( $form ) ) { |
|
501 | + if ( ! is_array( $form ) ) { |
|
502 | 502 | $form = gravityview_get_form( $form ); |
503 | 503 | } |
504 | 504 | |
@@ -506,35 +506,35 @@ discard block |
||
506 | 506 | return ''; |
507 | 507 | } |
508 | 508 | |
509 | - $form_id = $form['id']; |
|
509 | + $form_id = $form[ 'id' ]; |
|
510 | 510 | $links = array(); |
511 | 511 | |
512 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
512 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
513 | 513 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
514 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
515 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gk-gravityview') ).'</span>'; |
|
514 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
515 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gk-gravityview' ) ) . '</span>'; |
|
516 | 516 | } else { |
517 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
517 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
518 | 518 | } |
519 | 519 | |
520 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
520 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
521 | 521 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
522 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gk-gravityview') ).'</span>'; |
|
522 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gk-gravityview' ) ) . '</span>'; |
|
523 | 523 | } |
524 | 524 | |
525 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
525 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
526 | 526 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
527 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gk-gravityview'), 'title='.__('Edit settings for this form', 'gk-gravityview') ).'</span>'; |
|
527 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gk-gravityview' ), 'title=' . __( 'Edit settings for this form', 'gk-gravityview' ) ) . '</span>'; |
|
528 | 528 | } |
529 | 529 | |
530 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
530 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
531 | 531 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
532 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gk-gravityview'), 'title='.__('Preview this form', 'gk-gravityview') ).'</span>'; |
|
532 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gk-gravityview' ), 'title=' . __( 'Preview this form', 'gk-gravityview' ) ) . '</span>'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $output = ''; |
536 | 536 | |
537 | - if( !empty( $include_form_link ) ) { |
|
537 | + if ( ! empty( $include_form_link ) ) { |
|
538 | 538 | $output .= $form_link; |
539 | 539 | } |
540 | 540 | |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | $css_class = 'row-actions'; |
550 | 550 | |
551 | 551 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
552 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
552 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
553 | 553 | $css_class = 'row-actions visible'; |
554 | 554 | } |
555 | 555 | |
556 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
556 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
557 | 557 | |
558 | 558 | return $output; |
559 | 559 | } |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | // Get the date column and save it for later to add back in. |
568 | 568 | // This adds it after the Data Source column. |
569 | 569 | // This way, we don't need to do array_slice, array_merge, etc. |
570 | - $date = $columns['date']; |
|
571 | - unset( $columns['date'] ); |
|
570 | + $date = $columns[ 'date' ]; |
|
571 | + unset( $columns[ 'date' ] ); |
|
572 | 572 | |
573 | 573 | $data_source_required_caps = array( |
574 | 574 | 'gravityforms_edit_forms', |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | 'gravityforms_preview_forms', |
580 | 580 | ); |
581 | 581 | |
582 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | - $columns['gv_connected_form'] = __( 'Data Source', 'gk-gravityview' ); |
|
582 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gk-gravityview' ); |
|
584 | 584 | } |
585 | 585 | |
586 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
586 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
587 | 587 | |
588 | 588 | // Add the date back in. |
589 | - $columns['date'] = $date; |
|
589 | + $columns[ 'date' ] = $date; |
|
590 | 590 | |
591 | 591 | return $columns; |
592 | 592 | } |
@@ -599,12 +599,12 @@ discard block |
||
599 | 599 | */ |
600 | 600 | function save_postdata( $post_id ) { |
601 | 601 | |
602 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
602 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
603 | 603 | return; |
604 | 604 | } |
605 | 605 | |
606 | 606 | // validate post_type |
607 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
607 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
608 | 608 | return; |
609 | 609 | } |
610 | 610 | |
@@ -619,63 +619,63 @@ discard block |
||
619 | 619 | $statii = array(); |
620 | 620 | |
621 | 621 | // check if this is a start fresh View |
622 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
622 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
623 | 623 | |
624 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
624 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
625 | 625 | // save form id |
626 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
626 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
627 | 627 | |
628 | 628 | } |
629 | 629 | |
630 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
630 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
631 | 631 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | 635 | // Was this a start fresh? |
636 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
637 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
636 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
637 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
638 | 638 | } else { |
639 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
639 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | // Check if we have a template id |
643 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
643 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
644 | 644 | |
645 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
645 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
646 | 646 | |
647 | 647 | // now save template id |
648 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
648 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
652 | 652 | // save View Configuration metabox |
653 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
653 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
654 | 654 | |
655 | 655 | // template settings |
656 | - if( empty( $_POST['template_settings'] ) ) { |
|
657 | - $_POST['template_settings'] = array(); |
|
656 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
657 | + $_POST[ 'template_settings' ] = array(); |
|
658 | 658 | } |
659 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
659 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
660 | 660 | |
661 | 661 | // guard against unloaded View configuration page |
662 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
662 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
663 | 663 | $fields = array(); |
664 | 664 | |
665 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
665 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
666 | 666 | $fields = _gravityview_process_posted_fields(); |
667 | 667 | } |
668 | 668 | |
669 | 669 | $fields = wp_slash( $fields ); |
670 | 670 | |
671 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
671 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | // Directory Visible Widgets |
675 | - if( empty( $_POST['widgets'] ) ) { |
|
676 | - $_POST['widgets'] = array(); |
|
675 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
676 | + $_POST[ 'widgets' ] = array(); |
|
677 | 677 | } |
678 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
678 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
679 | 679 | |
680 | 680 | } // end save view configuration |
681 | 681 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
686 | 686 | * @since 1.17.2 |
687 | 687 | */ |
688 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
688 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
689 | 689 | |
690 | 690 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
691 | 691 | } |
@@ -734,20 +734,20 @@ discard block |
||
734 | 734 | |
735 | 735 | $output = ''; |
736 | 736 | |
737 | - if( !empty( $fields ) ) { |
|
737 | + if ( ! empty( $fields ) ) { |
|
738 | 738 | |
739 | - foreach( $fields as $id => $details ) { |
|
739 | + foreach ( $fields as $id => $details ) { |
|
740 | 740 | |
741 | - if( in_array( $details['type'], (array) $blocklist_field_types ) ) { |
|
741 | + if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) { |
|
742 | 742 | continue; |
743 | 743 | } |
744 | 744 | |
745 | 745 | // Edit mode only allows editing the parent fields, not single inputs. |
746 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
746 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
747 | 747 | continue; |
748 | 748 | } |
749 | 749 | |
750 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form_id, $form ); |
|
750 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form_id, $form ); |
|
751 | 751 | |
752 | 752 | } // End foreach |
753 | 753 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | echo $output; |
756 | 756 | |
757 | 757 | // For the EDIT view we only want to allow the form fields. |
758 | - if( $context === 'edit' ) { |
|
758 | + if ( $context === 'edit' ) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | $additional_fields = array( |
777 | 777 | array( |
778 | 778 | 'label_text' => __( 'Add All Form Fields', 'gk-gravityview' ), |
779 | - 'desc' => __('Insert all the form fields at once.', 'gk-gravityview'), |
|
779 | + 'desc' => __( 'Insert all the form fields at once.', 'gk-gravityview' ), |
|
780 | 780 | 'field_id' => 'all-fields', |
781 | 781 | 'label_type' => 'field', |
782 | 782 | 'input_type' => null, |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
794 | 794 | |
795 | - foreach ( (array) $additional_fields as $item ) { |
|
795 | + foreach ( (array)$additional_fields as $item ) { |
|
796 | 796 | |
797 | 797 | // Prevent items from not having index set |
798 | 798 | $item = wp_parse_args( $item, array( |
@@ -803,16 +803,16 @@ discard block |
||
803 | 803 | 'field_options' => null, |
804 | 804 | 'settings_html' => null, |
805 | 805 | 'icon' => null, |
806 | - )); |
|
806 | + ) ); |
|
807 | 807 | |
808 | 808 | // Backward compat. |
809 | - if( !empty( $item['field_options'] ) ) { |
|
809 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
810 | 810 | // Use settings_html from now on. |
811 | - $item['settings_html'] = $item['field_options']; |
|
811 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | // Render a label for each of them |
815 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form_id, $form ); |
|
815 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form_id, $form ); |
|
816 | 816 | |
817 | 817 | } |
818 | 818 | |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
825 | 825 | * @return array |
826 | 826 | */ |
827 | - function get_entry_default_fields($form, $zone) { |
|
827 | + function get_entry_default_fields( $form, $zone ) { |
|
828 | 828 | |
829 | 829 | $entry_default_fields = array(); |
830 | 830 | |
831 | 831 | // if in zone directory or single |
832 | - if( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
832 | + if ( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
833 | 833 | |
834 | 834 | $meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) ); |
835 | 835 | |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * @param string|array $form form_ID or form object |
847 | 847 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
848 | 848 | */ |
849 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
849 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | /** |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function get_available_fields( $form = '', $zone = NULL ) { |
859 | 859 | |
860 | - if( empty( $form ) ) { |
|
860 | + if ( empty( $form ) ) { |
|
861 | 861 | gravityview()->log->error( '$form is empty' ); |
862 | 862 | return array(); |
863 | 863 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $fields = gravityview_get_form_fields( $form, true ); |
867 | 867 | |
868 | 868 | // get meta fields ( only if form was already created ) |
869 | - if( !is_array( $form ) ) { |
|
869 | + if ( ! is_array( $form ) ) { |
|
870 | 870 | $meta_fields = gravityview_get_entry_meta( $form ); |
871 | 871 | } else { |
872 | 872 | $meta_fields = array(); |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | $fields = $fields + $meta_fields + $default_fields; |
880 | 880 | |
881 | 881 | // Move Custom Content to top |
882 | - if ( isset( $fields['custom'] ) ) { |
|
883 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
882 | + if ( isset( $fields[ 'custom' ] ) ) { |
|
883 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | $gv_fields = GravityView_Fields::get_all(); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | foreach ( $fields as &$field ) { |
889 | 889 | foreach ( $gv_fields as $gv_field ) { |
890 | 890 | if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) { |
891 | - $field['icon'] = \GV\Utils::get( $gv_field, 'icon' ); |
|
891 | + $field[ 'icon' ] = \GV\Utils::get( $gv_field, 'icon' ); |
|
892 | 892 | } |
893 | 893 | } |
894 | 894 | } |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } |
917 | 917 | |
918 | 918 | foreach ( $widgets as $id => $details ) { |
919 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
919 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
947 | 947 | global $post; |
948 | 948 | |
949 | - if( $type === 'widget' ) { |
|
949 | + if ( $type === 'widget' ) { |
|
950 | 950 | $button_label = __( 'Add Widget', 'gk-gravityview' ); |
951 | 951 | } else { |
952 | 952 | $button_label = __( 'Add Field', 'gk-gravityview' ); |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | $form = false; |
974 | 974 | |
975 | 975 | // if saved values, get available fields to label everyone |
976 | - if( !empty( $values ) && ( !empty( $post->ID ) || ! empty( $_POST['template_id'] ) || ! empty( $_POST['form_id'] ) ) ) { |
|
976 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) || ! empty( $_POST[ 'form_id' ] ) ) ) { |
|
977 | 977 | |
978 | - if ( ! empty( $_POST['form_id'] ) ) { |
|
979 | - $form_id = (int) \GV\Utils::_POST( 'form_id', 0 ); |
|
978 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
979 | + $form_id = (int)\GV\Utils::_POST( 'form_id', 0 ); |
|
980 | 980 | $form = gravityview_get_form( $form_id ); |
981 | - } elseif( ! empty( $_POST['template_id'] ) ) { |
|
982 | - $form_id = esc_attr( $_POST['template_id'] ); |
|
983 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
981 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
982 | + $form_id = esc_attr( $_POST[ 'template_id' ] ); |
|
983 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
984 | 984 | } else { |
985 | 985 | $form_id = gravityview_get_form_id( $post->ID ); |
986 | 986 | $form = gravityview_get_form( $form_id ); |
@@ -999,47 +999,47 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - foreach( $rows as $row ) : |
|
1003 | - foreach( $row as $col => $areas ) : |
|
1004 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
1002 | + foreach ( $rows as $row ) : |
|
1003 | + foreach ( $row as $col => $areas ) : |
|
1004 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
1005 | 1005 | |
1006 | 1006 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
1007 | 1007 | |
1008 | - <?php foreach( $areas as $area ) : ?> |
|
1008 | + <?php foreach ( $areas as $area ) : ?> |
|
1009 | 1009 | |
1010 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1011 | - <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1012 | - <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong> |
|
1010 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1011 | + <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1012 | + <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong> |
|
1013 | 1013 | |
1014 | 1014 | <?php if ( 'widget' !== $type ) { ?> |
1015 | - <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1015 | + <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1016 | 1016 | <?php } ?> |
1017 | 1017 | |
1018 | - <?php if ( ! empty( $area['subtitle'] ) ) { ?> |
|
1019 | - <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span> |
|
1018 | + <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?> |
|
1019 | + <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span> |
|
1020 | 1020 | <?php } ?> |
1021 | 1021 | </p> |
1022 | 1022 | <div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>"> |
1023 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields |
|
1024 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
1023 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields |
|
1024 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
1025 | 1025 | |
1026 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
1026 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
1027 | 1027 | |
1028 | 1028 | // Maybe has a form ID |
1029 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
1029 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
1030 | 1030 | |
1031 | 1031 | $input_type = NULL; |
1032 | 1032 | |
1033 | 1033 | if ( $form_id ) { |
1034 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
1034 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
1035 | 1035 | } else { |
1036 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
1036 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | if ( ! $original_item ) { |
1040 | 1040 | |
1041 | 1041 | global $pagenow; |
1042 | - if ( 'post-new.php' !== $pagenow ) { |
|
1042 | + if ( 'post-new.php' !== $pagenow ) { |
|
1043 | 1043 | gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( |
1044 | 1044 | ' data' => array( |
1045 | 1045 | 'available_items' => $available_items, |
@@ -1050,11 +1050,11 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | $original_item = $field; |
1052 | 1052 | } else { |
1053 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
1053 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | // Field options dialog box |
1057 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1057 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1058 | 1058 | |
1059 | 1059 | $item = array( |
1060 | 1060 | 'input_type' => $input_type, |
@@ -1067,12 +1067,12 @@ discard block |
||
1067 | 1067 | $item = wp_parse_args( $item, $original_item ); |
1068 | 1068 | } |
1069 | 1069 | |
1070 | - switch( $type ) { |
|
1070 | + switch ( $type ) { |
|
1071 | 1071 | case 'widget': |
1072 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
1072 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
1073 | 1073 | break; |
1074 | 1074 | default: |
1075 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id, $form ); |
|
1075 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id, $form ); |
|
1076 | 1076 | } |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | <div class="gv-droppable-area-action"> |
1081 | 1081 | <a href="#" class="gv-add-field button button-link button-hero" title="" |
1082 | 1082 | data-objecttype="<?php echo esc_attr( $type ); ?>" |
1083 | - data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" |
|
1083 | + data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" |
|
1084 | 1084 | data-context="<?php echo esc_attr( $zone ); ?>" |
1085 | 1085 | data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a> |
1086 | 1086 | </div> |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | // This is a new View, prefill the widgets |
1114 | 1114 | $widgets = array( |
1115 | 1115 | 'header_top' => array( |
1116 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
1116 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
1117 | 1117 | 'id' => 'search_bar', |
1118 | 1118 | 'label' => __( 'Search Bar', 'gk-gravityview' ), |
1119 | 1119 | 'search_layout' => 'horizontal', |
@@ -1188,12 +1188,12 @@ discard block |
||
1188 | 1188 | if ( $post ) { |
1189 | 1189 | $source_form_id = gravityview_get_form_id( $post->ID ); |
1190 | 1190 | if ( $source_form_id ) { |
1191 | - $form_ids[] = $source_form_id; |
|
1191 | + $form_ids[ ] = $source_form_id; |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
1195 | 1195 | foreach ( $joined_forms as $joined_form ) { |
1196 | - $form_ids[] = $joined_form->ID; |
|
1196 | + $form_ids[ ] = $joined_form->ID; |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string HTML of the active areas |
1235 | 1235 | */ |
1236 | 1236 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = 0, $echo = false, $form_id = 0 ) { |
1237 | - if( empty( $template_id ) ) { |
|
1237 | + if ( empty( $template_id ) ) { |
|
1238 | 1238 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1239 | 1239 | return ''; |
1240 | 1240 | } |
@@ -1248,13 +1248,13 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1250 | 1250 | |
1251 | - if( empty( $template_areas ) ) { |
|
1251 | + if ( empty( $template_areas ) ) { |
|
1252 | 1252 | |
1253 | 1253 | gravityview()->log->error( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1254 | 1254 | |
1255 | 1255 | $output = '<div>'; |
1256 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
1257 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview').'</p>'; |
|
1256 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
1257 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview' ) . '</p>'; |
|
1258 | 1258 | $output .= '</div>'; |
1259 | 1259 | } else { |
1260 | 1260 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - if( $echo ) { |
|
1269 | + if ( $echo ) { |
|
1270 | 1270 | echo $output; |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | |
1298 | 1298 | foreach ( $columns as $column_id => $column ) { |
1299 | 1299 | |
1300 | - $gv_field = GravityView_Fields::get_instance( $column['type'] ); |
|
1300 | + $gv_field = GravityView_Fields::get_instance( $column[ 'type' ] ); |
|
1301 | 1301 | |
1302 | 1302 | $directory_fields[ uniqid( '', true ) ] = array( |
1303 | 1303 | 'label' => \GV\Utils::get( $column, 'label' ), |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | $form = GV\GF_Form::by_id( $form_id ); |
1313 | 1313 | $entry_fields = array(); |
1314 | 1314 | |
1315 | - foreach( $form->form['fields'] as $gv_field ) { |
|
1315 | + foreach ( $form->form[ 'fields' ] as $gv_field ) { |
|
1316 | 1316 | |
1317 | 1317 | $entry_fields[ uniqid( '', true ) ] = array( |
1318 | 1318 | 'label' => $gv_field->label, |
@@ -1360,18 +1360,18 @@ discard block |
||
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | // Add the GV font (with the Astronaut) |
1363 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1363 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
1364 | 1364 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1365 | 1365 | |
1366 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1366 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1367 | 1367 | |
1368 | - if( GFForms::get_page() === 'form_list' ) { |
|
1368 | + if ( GFForms::get_page() === 'form_list' ) { |
|
1369 | 1369 | wp_enqueue_style( 'gravityview_views_styles' ); |
1370 | 1370 | return; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | // Don't process any scripts below here if it's not a GravityView page. |
1374 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1374 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1375 | 1375 | return; |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | |
1380 | 1380 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1381 | 1381 | |
1382 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1382 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
1383 | 1383 | |
1384 | 1384 | // Enqueue scripts |
1385 | 1385 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
@@ -1387,8 +1387,8 @@ discard block |
||
1387 | 1387 | wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
1388 | 1388 | 'cookiepath' => COOKIEPATH, |
1389 | 1389 | 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
1390 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1391 | - 'has_merge_tag_listener' => (bool) version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1390 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1391 | + 'has_merge_tag_listener' => (bool)version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1392 | 1392 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1393 | 1393 | 'label_viewname' => __( 'Enter View name here', 'gk-gravityview' ), |
1394 | 1394 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gk-gravityview' ), |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | self::enqueue_gravity_forms_scripts(); |
1416 | 1416 | |
1417 | 1417 | // 2.5 changed how Merge Tags are enqueued |
1418 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
1418 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
1419 | 1419 | GFCommon::output_hooks_javascript(); |
1420 | 1420 | } |
1421 | 1421 | } |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | ); |
1440 | 1440 | |
1441 | 1441 | if ( wp_is_mobile() ) { |
1442 | - $scripts[] = 'jquery-touch-punch'; |
|
1442 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | wp_enqueue_script( $scripts ); |