@@ -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 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function getInstance() { |
92 | 92 | |
93 | - if( empty( self::$instance ) ) { |
|
93 | + if ( empty( self::$instance ) ) { |
|
94 | 94 | self::$instance = new self; |
95 | 95 | } |
96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | self::require_files(); |
103 | 103 | |
104 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
104 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private static function require_files() { |
118 | 118 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
119 | - require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
120 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-html-elements.php'); |
|
121 | - require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
119 | + require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
120 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-html-elements.php' ); |
|
121 | + require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
122 | 122 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
123 | 123 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
124 | 124 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
125 | 125 | require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
126 | - require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
127 | - require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
126 | + require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
127 | + require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -157,22 +157,22 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
160 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
160 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
161 | 161 | |
162 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
163 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
162 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
163 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
164 | 164 | |
165 | 165 | // Load Extensions |
166 | 166 | // @todo: Convert to a scan of the directory or a method where this all lives |
167 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
168 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
169 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
167 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
168 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
169 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
170 | 170 | |
171 | 171 | // Load WordPress Widgets |
172 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
172 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
173 | 173 | |
174 | 174 | // Load GravityView Widgets |
175 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
175 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
176 | 176 | |
177 | 177 | // Add oEmbed |
178 | 178 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
186 | 186 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
187 | 187 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
188 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
188 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
189 | 189 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
190 | 190 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
191 | 191 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return bool |
201 | 201 | */ |
202 | 202 | public static function is_network_activated() { |
203 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
203 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | |
222 | 222 | if ( php_sapi_name() == 'cli' ) { |
223 | 223 | printf( __( "GravityView requires PHP Version %s or newer. You're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), |
224 | - GV_FUTURE_MIN_PHP_VERSION , phpversion() ); |
|
224 | + GV_FUTURE_MIN_PHP_VERSION, phpversion() ); |
|
225 | 225 | } else { |
226 | 226 | printf( '<body style="padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">' ); |
227 | 227 | printf( '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" alt="The GravityView Astronaut Says:" style="float: left; height: 60px; margin-right : 10px;" />' ); |
228 | 228 | printf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), |
229 | - '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_FUTURE_MIN_PHP_VERSION , "</h3>\n\n", $version ); |
|
229 | + '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", $version ); |
|
230 | 230 | printf( '</body>' ); |
231 | 231 | } |
232 | 232 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @since 1.7.5.1 |
297 | 297 | */ |
298 | 298 | public static function include_widget_class() { |
299 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
299 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | if ( ! $loaded ) { |
320 | 320 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
321 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
321 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
322 | 322 | load_textdomain( 'gravityview', $mofile ); |
323 | 323 | } |
324 | 324 | |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function frontend_actions( $force = false ) { |
357 | 357 | |
358 | - if( self::is_admin() && ! $force ) { return; } |
|
358 | + if ( self::is_admin() && ! $force ) { return; } |
|
359 | 359 | |
360 | 360 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
361 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
362 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
363 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
361 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
362 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
363 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
364 | 364 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
365 | 365 | |
366 | 366 | |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public static function get_default_widget_areas() { |
387 | 387 | $default_areas = array( |
388 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
389 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
388 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
389 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
390 | 390 | ); |
391 | 391 | |
392 | 392 | /** |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @param mixed $data Additional data to display |
405 | 405 | * @return void |
406 | 406 | */ |
407 | - public static function log_debug( $message, $data = null ){ |
|
407 | + public static function log_debug( $message, $data = null ) { |
|
408 | 408 | /** |
409 | 409 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
410 | 410 | * @param string $message Message to display |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param string $message log message |
419 | 419 | * @return void |
420 | 420 | */ |
421 | - public static function log_error( $message, $data = null ){ |
|
421 | + public static function log_error( $message, $data = null ) { |
|
422 | 422 | /** |
423 | 423 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
424 | 424 | * @param string $message Error message to display |
@@ -429,4 +429,4 @@ discard block |
||
429 | 429 | |
430 | 430 | } // end class GravityView_Plugin |
431 | 431 | |
432 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
432 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -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 ); ?>" /> |
@@ -10,12 +10,12 @@ |
||
10 | 10 | |
11 | 11 | function render_input( $override_input = null ) { |
12 | 12 | |
13 | - if( isset( $override_input ) ) { |
|
13 | + if ( isset( $override_input ) ) { |
|
14 | 14 | echo $override_input; |
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 ); ?>"> |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | * number input type |
4 | 4 | */ |
5 | 5 | |
6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
6 | +if ( ! class_exists( 'GravityView_FieldType_text' ) ) { |
|
7 | 7 | include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
8 | 8 | } |
9 | 9 | class GravityView_FieldType_number extends GravityView_FieldType_text { |
10 | 10 | |
11 | 11 | function render_input( $override_input = null ) { |
12 | - if( isset( $override_input ) ) { |
|
12 | + if ( isset( $override_input ) ) { |
|
13 | 13 | echo $override_input; |
14 | 14 | return; |
15 | 15 | } |
@@ -18,10 +18,10 @@ discard block |
||
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' ) { |
|
21 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
22 | 22 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
23 | 23 | } |
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
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 ); ?>"> |
@@ -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>'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function __construct() { |
19 | 19 | |
20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
21 | 21 | |
22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function initialize() { |
37 | 37 | |
38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
39 | 39 | |
40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
41 | 41 | |
42 | 42 | // information box |
43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function update_priority() { |
52 | 52 | global $wp_meta_boxes; |
53 | 53 | |
54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | global $post; |
70 | 70 | |
71 | 71 | // On Comment Edit, for example, $post isn't set. |
72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | */ |
153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
154 | 154 | |
155 | - foreach( $metaboxes as $m ) { |
|
155 | + foreach ( $metaboxes as $m ) { |
|
156 | 156 | |
157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
158 | 158 | |
159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | |
181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
182 | 182 | |
183 | - if( !empty( $links ) ) { |
|
184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
183 | + if ( ! empty( $links ) ) { |
|
184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
222 | 222 | |
223 | - if( empty( $curr_form )) { |
|
223 | + if ( empty( $curr_form ) ) { |
|
224 | 224 | return NULL; |
225 | 225 | } |
226 | 226 | |
227 | 227 | $form = gravityview_get_form( $curr_form ); |
228 | 228 | |
229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
230 | 230 | |
231 | - if( isset( $form['id'] ) ) { |
|
232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
231 | + if ( isset( $form[ 'id' ] ) ) { |
|
232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
233 | 233 | |
234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
235 | - $_GET['id'] = $form['id']; |
|
235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
236 | 236 | |
237 | 237 | } else { |
238 | 238 | $form_script = 'var form = new Form();'; |
239 | 239 | } |
240 | 240 | |
241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
242 | 242 | |
243 | 243 | // Restore previous $_GET setting |
244 | - $_GET['id'] = $get_id_backup; |
|
244 | + $_GET[ 'id' ] = $get_id_backup; |
|
245 | 245 | |
246 | 246 | return $output; |
247 | 247 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | global $post; |
298 | 298 | |
299 | 299 | // Only show this on GravityView post types. |
300 | - if( false === gravityview_is_admin_page() ) { return; } |
|
300 | + if ( false === gravityview_is_admin_page() ) { return; } |
|
301 | 301 | |
302 | 302 | // If the View hasn't been configured yet, don't show embed shortcode |
303 | - if( !gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
303 | + if ( ! gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
304 | 304 | |
305 | 305 | include self::$metaboxes_dir . 'views/shortcode-hint.php'; |
306 | 306 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | // template areas |
138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
139 | - $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
139 | + $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
140 | 140 | |
141 | 141 | // widget areas |
142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
@@ -328,40 +328,40 @@ discard block |
||
328 | 328 | // load file |
329 | 329 | $xmlstr = file_get_contents( $form_file ); |
330 | 330 | |
331 | - $options = array( |
|
332 | - "page" => array("unserialize_as_array" => true), |
|
333 | - "form"=> array("unserialize_as_array" => true), |
|
334 | - "field"=> array("unserialize_as_array" => true), |
|
335 | - "rule"=> array("unserialize_as_array" => true), |
|
336 | - "choice"=> array("unserialize_as_array" => true), |
|
337 | - "input"=> array("unserialize_as_array" => true), |
|
338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
340 | - "routin"=> array("unserialize_as_array" => true), |
|
341 | - "confirmation" => array("unserialize_as_array" => true), |
|
342 | - "notification" => array("unserialize_as_array" => true) |
|
343 | - ); |
|
331 | + $options = array( |
|
332 | + "page" => array("unserialize_as_array" => true), |
|
333 | + "form"=> array("unserialize_as_array" => true), |
|
334 | + "field"=> array("unserialize_as_array" => true), |
|
335 | + "rule"=> array("unserialize_as_array" => true), |
|
336 | + "choice"=> array("unserialize_as_array" => true), |
|
337 | + "input"=> array("unserialize_as_array" => true), |
|
338 | + "routing_item"=> array("unserialize_as_array" => true), |
|
339 | + "creditCard"=> array("unserialize_as_array" => true), |
|
340 | + "routin"=> array("unserialize_as_array" => true), |
|
341 | + "confirmation" => array("unserialize_as_array" => true), |
|
342 | + "notification" => array("unserialize_as_array" => true) |
|
343 | + ); |
|
344 | 344 | |
345 | 345 | $xml = new RGXML($options); |
346 | - $forms = $xml->unserialize($xmlstr); |
|
346 | + $forms = $xml->unserialize($xmlstr); |
|
347 | 347 | |
348 | - if( !$forms ) { |
|
349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
350 | - return false; |
|
351 | - } |
|
348 | + if( !$forms ) { |
|
349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
350 | + return false; |
|
351 | + } |
|
352 | 352 | |
353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
354 | - $form = $forms[0]; |
|
355 | - } |
|
353 | + if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
354 | + $form = $forms[0]; |
|
355 | + } |
|
356 | 356 | |
357 | - if( empty( $form ) ) { |
|
358 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
359 | - return false; |
|
360 | - } |
|
357 | + if( empty( $form ) ) { |
|
358 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
359 | + return false; |
|
360 | + } |
|
361 | 361 | |
362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
363 | 363 | |
364 | - return $form; |
|
364 | + return $form; |
|
365 | 365 | |
366 | 366 | } |
367 | 367 |
@@ -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 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | //check nonce |
68 | 68 | $this->check_ajax_nonce(); |
69 | 69 | |
70 | - $context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory'; |
|
70 | + $context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory'; |
|
71 | 71 | |
72 | 72 | // If Form was changed, JS sends form ID, if start fresh, JS sends template_id |
73 | - if( !empty( $_POST['form_id'] ) ) { |
|
74 | - do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context ); |
|
73 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
74 | + do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context ); |
|
75 | 75 | $this->_exit(); |
76 | - } elseif( !empty( $_POST['template_id'] ) ) { |
|
77 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
76 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
77 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
78 | 78 | |
79 | 79 | /** @see GravityView_Admin_Views::render_available_fields */ |
80 | 80 | do_action( 'gravityview_render_available_fields', $form, $context ); |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | function get_active_areas() { |
97 | 97 | $this->check_ajax_nonce(); |
98 | 98 | |
99 | - if( empty( $_POST['template_id'] ) ) { |
|
99 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
100 | 100 | $this->_exit( false ); |
101 | 101 | } |
102 | 102 | |
103 | 103 | ob_start(); |
104 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true ); |
|
105 | - $response['directory'] = ob_get_clean(); |
|
104 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true ); |
|
105 | + $response[ 'directory' ] = ob_get_clean(); |
|
106 | 106 | |
107 | 107 | ob_start(); |
108 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'single', '', true ); |
|
109 | - $response['single'] = ob_get_clean(); |
|
108 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true ); |
|
109 | + $response[ 'single' ] = ob_get_clean(); |
|
110 | 110 | |
111 | 111 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
112 | 112 | |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | |
122 | 122 | $this->check_ajax_nonce(); |
123 | 123 | |
124 | - if( empty( $_POST['template_id'] ) ) { |
|
124 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
125 | 125 | $this->_exit( false ); |
126 | 126 | } |
127 | 127 | |
128 | 128 | // get the fields xml config file for this specific preset |
129 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
129 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
130 | 130 | // import fields |
131 | - if( !empty( $preset_fields_path ) ) { |
|
131 | + if ( ! empty( $preset_fields_path ) ) { |
|
132 | 132 | $presets = $this->import_fields( $preset_fields_path ); |
133 | 133 | } else { |
134 | 134 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
135 | 135 | } |
136 | 136 | |
137 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
137 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
138 | 138 | |
139 | 139 | // template areas |
140 | 140 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
145 | 145 | |
146 | 146 | ob_start(); |
147 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
148 | - $response['header'] = ob_get_clean(); |
|
147 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
148 | + $response[ 'header' ] = ob_get_clean(); |
|
149 | 149 | |
150 | 150 | ob_start(); |
151 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
152 | - $response['footer'] = ob_get_clean(); |
|
151 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
152 | + $response[ 'footer' ] = ob_get_clean(); |
|
153 | 153 | |
154 | 154 | ob_start(); |
155 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
156 | - $response['directory'] = ob_get_clean(); |
|
155 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
156 | + $response[ 'directory' ] = ob_get_clean(); |
|
157 | 157 | |
158 | 158 | ob_start(); |
159 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
160 | - $response['single'] = ob_get_clean(); |
|
159 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
160 | + $response[ 'single' ] = ob_get_clean(); |
|
161 | 161 | |
162 | 162 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
163 | 163 | |
@@ -175,26 +175,26 @@ discard block |
||
175 | 175 | |
176 | 176 | $this->check_ajax_nonce(); |
177 | 177 | |
178 | - if( empty( $_POST['template_id'] ) ) { |
|
178 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
179 | 179 | do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' ); |
180 | 180 | $this->_exit( false ); |
181 | 181 | } |
182 | 182 | |
183 | 183 | // get the xml for this specific template_id |
184 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
184 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
185 | 185 | |
186 | 186 | // import form |
187 | 187 | $form = $this->import_form( $preset_form_xml_path ); |
188 | 188 | |
189 | 189 | // get the form ID |
190 | - if( false === $form ) { |
|
190 | + if ( false === $form ) { |
|
191 | 191 | // send error to user |
192 | - do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] ); |
|
192 | + do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] ); |
|
193 | 193 | |
194 | 194 | $this->_exit( false ); |
195 | 195 | } |
196 | 196 | |
197 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
197 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path ); |
210 | 210 | |
211 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
211 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
212 | 212 | do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path ); |
213 | 213 | return false; |
214 | 214 | } |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count ); |
221 | 221 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms ); |
222 | 222 | |
223 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
223 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
224 | 224 | do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' ); |
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | |
228 | 228 | // import success - return form id |
229 | - return $forms[0]; |
|
229 | + return $forms[ 0 ]; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function get_field_options() { |
241 | 241 | $this->check_ajax_nonce(); |
242 | 242 | |
243 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
243 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
244 | 244 | do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' ); |
245 | 245 | $this->_exit( false ); |
246 | 246 | } |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | $_post = array_map( 'esc_attr', $_post ); |
253 | 253 | |
254 | 254 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
255 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
256 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
255 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
256 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
257 | 257 | |
258 | - $response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
258 | + $response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
259 | 259 | |
260 | 260 | $response = gravityview_strip_whitespace( $response ); |
261 | 261 | |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | $form = ''; |
277 | 277 | |
278 | 278 | // if form id is set, use it, else, get form from preset |
279 | - if( !empty( $_POST['form_id'] ) ) { |
|
279 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
280 | 280 | |
281 | - $form = (int) $_POST['form_id']; |
|
281 | + $form = (int)$_POST[ 'form_id' ]; |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | // get form from preset |
285 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
285 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
286 | 286 | |
287 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
287 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | |
@@ -300,27 +300,27 @@ discard block |
||
300 | 300 | * @param string $template_id Preset template |
301 | 301 | * |
302 | 302 | */ |
303 | - static function pre_get_form_fields( $template_id = '') { |
|
303 | + static function pre_get_form_fields( $template_id = '' ) { |
|
304 | 304 | |
305 | - if( empty( $template_id ) ) { |
|
305 | + if ( empty( $template_id ) ) { |
|
306 | 306 | do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' ); |
307 | 307 | return false; |
308 | 308 | } else { |
309 | 309 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
310 | - if( !file_exists( $form_file ) ) { |
|
311 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file ); |
|
310 | + if ( ! file_exists( $form_file ) ) { |
|
311 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file ); |
|
312 | 312 | return false; |
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | 316 | // Load xml parser (from GravityForms) |
317 | - if( class_exists( 'GFCommon' ) ) { |
|
317 | + if ( class_exists( 'GFCommon' ) ) { |
|
318 | 318 | $xml_parser = GFCommon::get_base_path() . '/xml.php'; |
319 | 319 | } else { |
320 | 320 | $xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php'; |
321 | 321 | } |
322 | 322 | |
323 | - if( file_exists( $xml_parser ) ) { |
|
323 | + if ( file_exists( $xml_parser ) ) { |
|
324 | 324 | require_once( $xml_parser ); |
325 | 325 | } else { |
326 | 326 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser ); |
@@ -331,37 +331,37 @@ discard block |
||
331 | 331 | $xmlstr = file_get_contents( $form_file ); |
332 | 332 | |
333 | 333 | $options = array( |
334 | - "page" => array("unserialize_as_array" => true), |
|
335 | - "form"=> array("unserialize_as_array" => true), |
|
336 | - "field"=> array("unserialize_as_array" => true), |
|
337 | - "rule"=> array("unserialize_as_array" => true), |
|
338 | - "choice"=> array("unserialize_as_array" => true), |
|
339 | - "input"=> array("unserialize_as_array" => true), |
|
340 | - "routing_item"=> array("unserialize_as_array" => true), |
|
341 | - "creditCard"=> array("unserialize_as_array" => true), |
|
342 | - "routin"=> array("unserialize_as_array" => true), |
|
343 | - "confirmation" => array("unserialize_as_array" => true), |
|
344 | - "notification" => array("unserialize_as_array" => true) |
|
334 | + "page" => array( "unserialize_as_array" => true ), |
|
335 | + "form"=> array( "unserialize_as_array" => true ), |
|
336 | + "field"=> array( "unserialize_as_array" => true ), |
|
337 | + "rule"=> array( "unserialize_as_array" => true ), |
|
338 | + "choice"=> array( "unserialize_as_array" => true ), |
|
339 | + "input"=> array( "unserialize_as_array" => true ), |
|
340 | + "routing_item"=> array( "unserialize_as_array" => true ), |
|
341 | + "creditCard"=> array( "unserialize_as_array" => true ), |
|
342 | + "routin"=> array( "unserialize_as_array" => true ), |
|
343 | + "confirmation" => array( "unserialize_as_array" => true ), |
|
344 | + "notification" => array( "unserialize_as_array" => true ) |
|
345 | 345 | ); |
346 | 346 | |
347 | - $xml = new RGXML($options); |
|
348 | - $forms = $xml->unserialize($xmlstr); |
|
347 | + $xml = new RGXML( $options ); |
|
348 | + $forms = $xml->unserialize( $xmlstr ); |
|
349 | 349 | |
350 | - if( !$forms ) { |
|
351 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
350 | + if ( ! $forms ) { |
|
351 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file ); |
|
352 | 352 | return false; |
353 | 353 | } |
354 | 354 | |
355 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
356 | - $form = $forms[0]; |
|
355 | + if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) { |
|
356 | + $form = $forms[ 0 ]; |
|
357 | 357 | } |
358 | 358 | |
359 | - if( empty( $form ) ) { |
|
359 | + if ( empty( $form ) ) { |
|
360 | 360 | do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
364 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
364 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form ); |
|
365 | 365 | |
366 | 366 | return $form; |
367 | 367 | |
@@ -375,38 +375,38 @@ discard block |
||
375 | 375 | */ |
376 | 376 | function import_fields( $file ) { |
377 | 377 | |
378 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
378 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
379 | 379 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file ); |
380 | 380 | return false; |
381 | 381 | } |
382 | 382 | |
383 | - if( !class_exists('WXR_Parser') ) { |
|
383 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
384 | 384 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
385 | 385 | } |
386 | 386 | |
387 | 387 | $parser = new WXR_Parser(); |
388 | 388 | $presets = $parser->parse( $file ); |
389 | 389 | |
390 | - if(is_wp_error( $presets )) { |
|
390 | + if ( is_wp_error( $presets ) ) { |
|
391 | 391 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets ); |
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | |
395 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
395 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
396 | 396 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file ); |
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | - do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] ); |
|
400 | + do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] ); |
|
401 | 401 | |
402 | 402 | $fields = $widgets = array(); |
403 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
404 | - switch ($meta['key']) { |
|
403 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
404 | + switch ( $meta[ 'key' ] ) { |
|
405 | 405 | case '_gravityview_directory_fields': |
406 | - $fields = maybe_unserialize( $meta['value'] ); |
|
406 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
407 | 407 | break; |
408 | 408 | case '_gravityview_directory_widgets': |
409 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
409 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
410 | 410 | break; |
411 | 411 | } |
412 | 412 | } |
@@ -204,7 +204,7 @@ |
||
204 | 204 | self::$notices['wp_version'] = array( |
205 | 205 | 'class' => 'error', |
206 | 206 | 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
207 | - 'cap' => 'update_core', |
|
207 | + 'cap' => 'update_core', |
|
208 | 208 | 'dismiss' => 'wp_version', |
209 | 209 | ); |
210 | 210 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return GravityView_Compatibility |
77 | 77 | */ |
78 | 78 | public static function getInstance() { |
79 | - if( self::$instance ) { |
|
79 | + if ( self::$instance ) { |
|
80 | 80 | return self::$instance; |
81 | 81 | } |
82 | 82 | return new self; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
155 | 155 | // show the notice, but not load any post types or process shortcodes. |
156 | 156 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
157 | - if( ! self::is_valid() ) { |
|
157 | + if ( ! self::is_valid() ) { |
|
158 | 158 | |
159 | 159 | // If the plugin's not loaded, might as well hide the shortcode for people. |
160 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
160 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | } |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
185 | 185 | |
186 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
186 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
187 | 187 | return null; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $notices = self::get_notices(); |
191 | 191 | |
192 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
193 | - foreach( (array)$notices as $notice ) { |
|
194 | - $message .= wpautop( $notice['message'] ); |
|
192 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
193 | + foreach ( (array)$notices as $notice ) { |
|
194 | + $message .= wpautop( $notice[ 'message' ] ); |
|
195 | 195 | } |
196 | 196 | $message .= '</div>'; |
197 | 197 | |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | |
212 | 212 | if ( |
213 | 213 | ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && ! gravityview()->plugin->is_compatible_php() ) |
214 | - || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) |
|
214 | + || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) |
|
215 | 215 | ) { |
216 | 216 | |
217 | - self::$notices['php_version'] = array( |
|
217 | + self::$notices[ 'php_version' ] = array( |
|
218 | 218 | 'class' => 'error', |
219 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
219 | + 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
220 | 220 | 'cap' => 'manage_options', |
221 | 221 | 'dismiss' => 'php_version', |
222 | 222 | ); |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
227 | - if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) { |
|
227 | + if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) { |
|
228 | 228 | |
229 | 229 | // Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking. |
230 | - $key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
230 | + $key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
231 | 231 | |
232 | 232 | self::$notices[ $key ] = array( |
233 | 233 | 'class' => 'error', |
234 | - 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
234 | + 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
235 | 235 | 'cap' => 'manage_options', |
236 | 236 | 'dismiss' => $key, |
237 | 237 | ); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | || ( false === version_compare( $wp_version, GV_MIN_WP_VERSION, '>=' ) ) |
256 | 256 | ) { |
257 | 257 | |
258 | - self::$notices['wp_version'] = array( |
|
258 | + self::$notices[ 'wp_version' ] = array( |
|
259 | 259 | 'class' => 'error', |
260 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
260 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
261 | 261 | 'cap' => 'update_core', |
262 | 262 | 'dismiss' => 'wp_version', |
263 | 263 | ); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | public static function check_gravityforms() { |
281 | 281 | |
282 | 282 | // Bypass other checks: if the class exists |
283 | - if( class_exists( 'GFCommon' ) ) { |
|
283 | + if ( class_exists( 'GFCommon' ) ) { |
|
284 | 284 | |
285 | 285 | // Does the version meet future requirements? |
286 | - if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
286 | + if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
287 | 287 | return true; |
288 | 288 | } |
289 | 289 | |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | $class = $meets_minimum ? 'notice-warning' : 'error'; |
298 | 298 | |
299 | 299 | // Show the notice even if the future version requirements aren't met |
300 | - self::$notices['gf_version'] = array( |
|
300 | + self::$notices[ 'gf_version' ] = array( |
|
301 | 301 | 'class' => $class, |
302 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
302 | + 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
303 | 303 | 'cap' => 'update_plugins', |
304 | 304 | 'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION, |
305 | 305 | ); |
@@ -315,42 +315,42 @@ discard block |
||
315 | 315 | * OR |
316 | 316 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
317 | 317 | */ |
318 | - if( true === $gf_status || is_network_admin() ) { |
|
318 | + if ( true === $gf_status || is_network_admin() ) { |
|
319 | 319 | return true; |
320 | 320 | } |
321 | 321 | |
322 | 322 | // If GFCommon doesn't exist, assume GF not active |
323 | 323 | $return = false; |
324 | 324 | |
325 | - switch( $gf_status ) { |
|
325 | + switch ( $gf_status ) { |
|
326 | 326 | case 'inactive': |
327 | 327 | |
328 | 328 | // Required for multisite |
329 | - if( ! function_exists('wp_create_nonce') ) { |
|
329 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
330 | 330 | require_once ABSPATH . WPINC . '/pluggable.php'; |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
334 | - if( is_multisite() ) { |
|
334 | + if ( is_multisite() ) { |
|
335 | 335 | wp_cookie_constants(); |
336 | 336 | } |
337 | 337 | |
338 | 338 | $return = false; |
339 | 339 | |
340 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
340 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
341 | 341 | |
342 | - self::$notices['gf_inactive'] = array( |
|
342 | + self::$notices[ 'gf_inactive' ] = array( |
|
343 | 343 | 'class' => 'error', |
344 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
344 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
345 | 345 | 'cap' => 'activate_plugins', |
346 | 346 | 'dismiss' => 'gf_inactive', |
347 | 347 | ); |
348 | 348 | |
349 | 349 | break; |
350 | 350 | default: |
351 | - self::$notices['gf_installed'] = array( |
|
351 | + self::$notices[ 'gf_installed' ] = array( |
|
352 | 352 | 'class' => 'error', |
353 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
353 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
354 | 354 | 'cap' => 'install_plugins', |
355 | 355 | 'dismiss' => 'gf_installed', |
356 | 356 | ); |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | */ |
368 | 368 | private static function check_gf_directory() { |
369 | 369 | |
370 | - if( class_exists( 'GFDirectory' ) ) { |
|
371 | - self::$notices['gf_directory'] = array( |
|
370 | + if ( class_exists( 'GFDirectory' ) ) { |
|
371 | + self::$notices[ 'gf_directory' ] = array( |
|
372 | 372 | 'class' => 'error is-dismissible', |
373 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
373 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
374 | 374 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
375 | 375 | 'dismiss' => 'gf_directory', |
376 | 376 | 'cap' => 'activate_plugins', |
@@ -389,21 +389,21 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public static function get_plugin_status( $location = '' ) { |
391 | 391 | |
392 | - if( ! function_exists('is_plugin_active') ) { |
|
392 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
393 | 393 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
394 | 394 | } |
395 | 395 | |
396 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
396 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
397 | 397 | return true; |
398 | 398 | } |
399 | 399 | |
400 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
400 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
401 | 401 | return true; |
402 | 402 | } |
403 | 403 | |
404 | - if( |
|
405 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
404 | + if ( |
|
405 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
407 | 407 | ) { |
408 | 408 | return false; |
409 | 409 | } |
@@ -244,13 +244,13 @@ |
||
244 | 244 | $this->_remote_update_url, |
245 | 245 | $this->_path, |
246 | 246 | array( |
247 | - 'version' => $this->_version, // current version number |
|
248 | - 'license' => $license['license'], |
|
249 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
250 | - 'item_name' => $this->_title, // name of this plugin |
|
251 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
252 | - ) |
|
253 | - ); |
|
247 | + 'version' => $this->_version, // current version number |
|
248 | + 'license' => $license['license'], |
|
249 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
250 | + 'item_name' => $this->_title, // name of this plugin |
|
251 | + 'author' => strip_tags( $this->_author ) // author of this plugin |
|
252 | + ) |
|
253 | + ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | |
72 | 72 | add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
73 | 73 | |
74 | - add_action( 'admin_init', array( $this, 'settings') ); |
|
74 | + add_action( 'admin_init', array( $this, 'settings' ) ); |
|
75 | 75 | |
76 | 76 | add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
77 | 77 | |
78 | 78 | add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) ); |
79 | 79 | |
80 | - if( false === $this->is_extension_supported() ) { |
|
80 | + if ( false === $this->is_extension_supported() ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $tab_settings = $this->tab_settings(); |
117 | 117 | |
118 | 118 | // Don't add a tab if it's empty. |
119 | - if( empty( $tab_settings ) ) { |
|
119 | + if ( empty( $tab_settings ) ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
135 | 135 | |
136 | 136 | // Force the screen to be GravityView |
137 | - $tab['screen'] = 'gravityview'; |
|
137 | + $tab[ 'screen' ] = 'gravityview'; |
|
138 | 138 | |
139 | - if( class_exists('GravityView_Metabox_Tab') ) { |
|
139 | + if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
|
140 | 140 | |
141 | - $metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
141 | + $metabox = new GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
142 | 142 | |
143 | 143 | GravityView_Metabox_Tabs::add( $metabox ); |
144 | 144 | |
145 | 145 | } else { |
146 | 146 | |
147 | - add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
147 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function load_plugin_textdomain() { |
162 | 162 | |
163 | - if( empty( $this->_text_domain ) ) { |
|
163 | + if ( empty( $this->_text_domain ) ) { |
|
164 | 164 | do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this ); |
165 | 165 | return; |
166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
173 | 173 | |
174 | 174 | // Traditional WordPress plugin locale filter |
175 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
175 | + $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
176 | 176 | |
177 | 177 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
178 | 178 | |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function get_license() { |
204 | 204 | |
205 | - if( !class_exists( 'GravityView_Settings' ) ) { |
|
205 | + if ( ! class_exists( 'GravityView_Settings' ) ) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
209 | - $license = GravityView_Settings::getSetting('license'); |
|
209 | + $license = GravityView_Settings::getSetting( 'license' ); |
|
210 | 210 | |
211 | 211 | return $license; |
212 | 212 | } |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | public function settings() { |
220 | 220 | |
221 | 221 | // If doing ajax, get outta here |
222 | - if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
222 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
226 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
227 | 227 | |
228 | 228 | $file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php'; |
229 | 229 | |
230 | 230 | // This file may be in the lib/ directory already |
231 | - if( ! file_exists( $file_path ) ) { |
|
231 | + if ( ! file_exists( $file_path ) ) { |
|
232 | 232 | $file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php'; |
233 | 233 | } |
234 | 234 | |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | $license = $this->get_license(); |
239 | 239 | |
240 | 240 | // Don't update if invalid license. |
241 | - if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; } |
|
241 | + if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { return; } |
|
242 | 242 | |
243 | 243 | new EDD_SL_Plugin_Updater( |
244 | 244 | $this->_remote_update_url, |
245 | 245 | $this->_path, |
246 | 246 | array( |
247 | 247 | 'version' => $this->_version, // current version number |
248 | - 'license' => $license['license'], |
|
248 | + 'license' => $license[ 'license' ], |
|
249 | 249 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
250 | - 'item_name' => $this->_title, // name of this plugin |
|
250 | + 'item_name' => $this->_title, // name of this plugin |
|
251 | 251 | 'author' => strip_tags( $this->_author ) // author of this plugin |
252 | 252 | ) |
253 | 253 | ); |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function admin_notice() { |
262 | 262 | |
263 | - if( empty( self::$admin_notices ) ) { |
|
263 | + if ( empty( self::$admin_notices ) ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - foreach( self::$admin_notices as $key => $notice ) { |
|
267 | + foreach ( self::$admin_notices as $key => $notice ) { |
|
268 | 268 | |
269 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
270 | - echo wpautop( $notice['message'] ); |
|
269 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
270 | + echo wpautop( $notice[ 'message' ] ); |
|
271 | 271 | echo '<div class="clear"></div>'; |
272 | 272 | echo '</div>'; |
273 | 273 | } |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function add_notice( $notice = array() ) { |
284 | 284 | |
285 | - if( is_array( $notice ) && !isset( $notice['message'] ) ) { |
|
286 | - do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice ); |
|
285 | + if ( is_array( $notice ) && ! isset( $notice[ 'message' ] ) ) { |
|
286 | + do_action( 'gravityview_log_error', __CLASS__ . '[add_notice] Notice not set', $notice ); |
|
287 | 287 | return; |
288 | - } else if( is_string( $notice ) ) { |
|
288 | + } else if ( is_string( $notice ) ) { |
|
289 | 289 | $notice = array( 'message' => $notice ); |
290 | 290 | } |
291 | 291 | |
292 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
292 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
293 | 293 | |
294 | - self::$admin_notices[] = $notice; |
|
294 | + self::$admin_notices[ ] = $notice; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -346,17 +346,17 @@ discard block |
||
346 | 346 | |
347 | 347 | $message = ''; |
348 | 348 | |
349 | - if( !class_exists( 'GravityView_Plugin' ) ) { |
|
349 | + if ( ! class_exists( 'GravityView_Plugin' ) ) { |
|
350 | 350 | |
351 | - $message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title ); |
|
351 | + $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), $this->_title ); |
|
352 | 352 | |
353 | - } else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) { |
|
353 | + } else if ( false === version_compare( GravityView_Plugin::version, $this->_min_gravityview_version, ">=" ) ) { |
|
354 | 354 | |
355 | - $message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
355 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
356 | 356 | |
357 | - } else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) { |
|
357 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
358 | 358 | |
359 | - $message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' ); |
|
359 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_php_version . '</tt>' ); |
|
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | self::add_notice( $message ); |
370 | 370 | |
371 | - do_action( 'gravityview_log_error', __METHOD__. ' ' . $message ); |
|
371 | + do_action( 'gravityview_log_error', __METHOD__ . ' ' . $message ); |
|
372 | 372 | |
373 | 373 | self::$is_compatible = false; |
374 | 374 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | var $style = NULL; |
24 | 24 | |
25 | 25 | /** |
26 | - * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
26 | + * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
27 | 27 | * @var string |
28 | 28 | */ |
29 | 29 | var $size = NULL; |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $atts = wp_parse_args( $atts, $defaults ); |
67 | 67 | |
68 | - foreach( $atts as $key => $val ) { |
|
68 | + foreach ( $atts as $key => $val ) { |
|
69 | 69 | $this->{$key} = $val; |
70 | 70 | } |
71 | 71 | |
72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
72 | + $this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
73 | 73 | |
74 | 74 | $this->set_image_size(); |
75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function validate_image_src() { |
87 | 87 | |
88 | - if ( !$this->validate_src ) { return true; } |
|
88 | + if ( ! $this->validate_src ) { return true; } |
|
89 | 89 | |
90 | 90 | $info = pathinfo( $this->src ); |
91 | 91 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag |
94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` |
95 | 95 | */ |
96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); |
|
96 | + $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) ); |
|
97 | 97 | |
98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); |
|
98 | + return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | |
112 | 112 | // And there is no string size passed |
113 | 113 | // And we want to get the image size using PHP |
114 | - if ( empty( $string ) && !empty( $this->getimagesize ) ) { |
|
114 | + if ( empty( $string ) && ! empty( $this->getimagesize ) ) { |
|
115 | 115 | |
116 | 116 | $image_size = @getimagesize( $this->src ); |
117 | 117 | |
118 | 118 | // If it didn't return a response, it may be a HTTPS/SSL error |
119 | - if ( empty( $image_size[0] ) ) { |
|
119 | + if ( empty( $image_size[ 0 ] ) ) { |
|
120 | 120 | $image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) ); |
121 | 121 | } |
122 | 122 | |
123 | - if ( !empty( $image_size ) ) { |
|
123 | + if ( ! empty( $image_size ) ) { |
|
124 | 124 | list( $width, $height ) = $image_size; |
125 | 125 | } |
126 | 126 | |
@@ -133,33 +133,33 @@ discard block |
||
133 | 133 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels |
134 | 134 | */ |
135 | 135 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
136 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
137 | - 'small' => array('width' => 100, 'height' => 75), |
|
138 | - 'medium' => array('width' => 250, 'height' => 188), |
|
139 | - 'large' => array('width' => 448, 'height' => 336), |
|
136 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
137 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
138 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
139 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
140 | 140 | ) ); |
141 | 141 | |
142 | - switch( $this->size ) { |
|
142 | + switch ( $this->size ) { |
|
143 | 143 | case 'tiny': |
144 | - extract($image_sizes['tiny']); |
|
144 | + extract( $image_sizes[ 'tiny' ] ); |
|
145 | 145 | break; |
146 | 146 | case 'small': |
147 | 147 | case 's': |
148 | 148 | case 'thumb': |
149 | - extract($image_sizes['small']); |
|
149 | + extract( $image_sizes[ 'small' ] ); |
|
150 | 150 | break; |
151 | 151 | case 'm': |
152 | 152 | case 'medium': |
153 | - extract($image_sizes['medium']); |
|
153 | + extract( $image_sizes[ 'medium' ] ); |
|
154 | 154 | break; |
155 | 155 | case 'large': |
156 | 156 | case 'l': |
157 | - extract($image_sizes['large']); |
|
157 | + extract( $image_sizes[ 'large' ] ); |
|
158 | 158 | break; |
159 | 159 | default: |
160 | 160 | // Verify that the passed sizes are integers. |
161 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
162 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
161 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
162 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | } |
@@ -180,8 +180,8 @@ |
||
180 | 180 | |
181 | 181 | // check widget settings: |
182 | 182 | // [search_free] => 1 |
183 | - // [search_date] => 1 |
|
184 | - $search_generic = array(); |
|
183 | + // [search_date] => 1 |
|
184 | + $search_generic = array(); |
|
185 | 185 | if( !empty( $widget['search_free'] ) ) { |
186 | 186 | $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
187 | 187 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
65 | 65 | |
66 | - if( false === $approved_result || false === $disapproved_result ) { |
|
66 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
67 | 67 | do_action( 'gravityview_log_error', __METHOD__ . ': There was an error processing the query.', $wpdb->last_error ); |
68 | 68 | } else { |
69 | 69 | // All done: Meta values are migrated |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $redux_settings = $this->get_redux_settings(); |
97 | 97 | |
98 | 98 | // No need to process |
99 | - if( false === $redux_settings ) { |
|
99 | + if ( false === $redux_settings ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
103 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
104 | 104 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
105 | 105 | } |
106 | 106 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
115 | 115 | |
116 | 116 | // And now remove the previous option, so this is a one-time thing. |
117 | - delete_option('gravityview_settings'); |
|
118 | - delete_option('gravityview_settings-transients'); |
|
117 | + delete_option( 'gravityview_settings' ); |
|
118 | + delete_option( 'gravityview_settings-transients' ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $data = array( |
133 | 133 | 'edd_action' => 'check_license', |
134 | - 'license' => rgget('license_key', $redux_settings ), |
|
134 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
135 | 135 | 'update' => false, |
136 | 136 | 'format' => 'object', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
140 | 140 | |
141 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | - $redux_settings['license_key_status'] = $license_call->license; |
|
143 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
141 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
143 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $redux_settings; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | function get_redux_settings() { |
155 | 155 | |
156 | 156 | // Previous settings set by Redux |
157 | - $redux_option = get_option('gravityview_settings'); |
|
157 | + $redux_option = get_option( 'gravityview_settings' ); |
|
158 | 158 | |
159 | 159 | // No Redux settings? Don't proceed. |
160 | - if( false === $redux_option ) { |
|
160 | + if ( false === $redux_option ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
168 | 168 | ); |
169 | 169 | |
170 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
170 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
171 | 171 | |
172 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
172 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
173 | 173 | |
174 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
174 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
175 | 175 | |
176 | 176 | // This contains the last response for license validation |
177 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
177 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
178 | 178 | |
179 | - $saved_license = rgget('license', $saved_values ); |
|
179 | + $saved_license = rgget( 'license', $saved_values ); |
|
180 | 180 | |
181 | 181 | // Only use the last-saved values if they are for the same license |
182 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
184 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
182 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
184 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** ---- Migrate from old search widget to new search widget ---- */ |
194 | 194 | function update_search_on_views() { |
195 | 195 | |
196 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
197 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
196 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
197 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Loop through all the views |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | $views = get_posts( $query_args ); |
208 | 208 | |
209 | - foreach( $views as $view ) { |
|
209 | + foreach ( $views as $view ) { |
|
210 | 210 | |
211 | 211 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
212 | 212 | $search_fields = null; |
213 | 213 | |
214 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
214 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
215 | 215 | |
216 | 216 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
217 | 217 | |
218 | - foreach( $widgets as $area => $ws ) { |
|
219 | - foreach( $ws as $k => $widget ) { |
|
220 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
218 | + foreach ( $widgets as $area => $ws ) { |
|
219 | + foreach ( $ws as $k => $widget ) { |
|
220 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
221 | 221 | |
222 | - if( is_null( $search_fields ) ) { |
|
222 | + if ( is_null( $search_fields ) ) { |
|
223 | 223 | $search_fields = $this->get_search_fields( $view->ID ); |
224 | 224 | } |
225 | 225 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | // [search_free] => 1 |
228 | 228 | // [search_date] => 1 |
229 | 229 | $search_generic = array(); |
230 | - if( !empty( $widget['search_free'] ) ) { |
|
231 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
230 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
231 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
232 | 232 | } |
233 | - if( !empty( $widget['search_date'] ) ) { |
|
234 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
233 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
234 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $search_config = array_merge( $search_generic, $search_fields ); |
238 | 238 | |
239 | 239 | // don't throw '[]' when json_encode an empty array |
240 | - if( empty( $search_config ) ) { |
|
240 | + if ( empty( $search_config ) ) { |
|
241 | 241 | $search_config = ''; |
242 | 242 | } else { |
243 | 243 | $search_config = json_encode( $search_config ); |
244 | 244 | } |
245 | 245 | |
246 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
247 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
246 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
247 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
248 | 248 | |
249 | 249 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
250 | 250 | } |
@@ -272,26 +272,26 @@ discard block |
||
272 | 272 | // check view fields' settings |
273 | 273 | $fields = gravityview_get_directory_fields( $view_id, false ); |
274 | 274 | |
275 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
275 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
276 | 276 | |
277 | - foreach( $fields as $t => $fs ) { |
|
277 | + foreach ( $fields as $t => $fs ) { |
|
278 | 278 | |
279 | - foreach( $fs as $k => $field ) { |
|
279 | + foreach ( $fs as $k => $field ) { |
|
280 | 280 | // is field a search_filter ? |
281 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
281 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
282 | 282 | |
283 | 283 | // get field type & calculate the input type (by default) |
284 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
284 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
285 | 285 | |
286 | - if( empty( $form_field['type'] ) ) { |
|
286 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // depending on the field type assign a group of possible search field types |
291 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
291 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
292 | 292 | |
293 | 293 | // add field to config |
294 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
294 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |