@@ -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 |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param mixed $data Additional data to display |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function log_debug( $message, $data = null ){ |
|
354 | + public static function log_debug( $message, $data = null ) { |
|
355 | 355 | /** |
356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param string $message log message |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - public static function log_error( $message, $data = null ){ |
|
368 | + public static function log_error( $message, $data = null ) { |
|
369 | 369 | /** |
370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
371 | 371 | * @param string $message Error message to display |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | |
67 | 67 | /** Load common & connector functions */ |
68 | 68 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
69 | +require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
70 | +require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
71 | 71 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
72 | 72 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
73 | 73 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
74 | 74 | |
75 | 75 | /** Register Post Types and Rewrite Rules */ |
76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
76 | +require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
77 | 77 | |
78 | 78 | /** Add Cache Class */ |
79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
79 | +require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
80 | 80 | |
81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
82 | -if( is_admin() ) { |
|
82 | +if ( is_admin() ) { |
|
83 | 83 | register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
84 | 84 | register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
85 | 85 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function getInstance() { |
102 | 102 | |
103 | - if( empty( self::$instance ) ) { |
|
103 | + if ( empty( self::$instance ) ) { |
|
104 | 104 | self::$instance = new self; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function __construct() { |
111 | 111 | |
112 | 112 | |
113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
113 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function include_files() { |
141 | 141 | |
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
143 | 143 | |
144 | 144 | // Load fields |
145 | 145 | include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | include_once( $gv_field_filename ); |
151 | 151 | } |
152 | 152 | |
153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
154 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
155 | 155 | |
156 | 156 | // Load Extensions |
157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
160 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
158 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
160 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
161 | 161 | |
162 | 162 | // Load WordPress Widgets |
163 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
163 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
164 | 164 | |
165 | 165 | // Load GravityView Widgets |
166 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
166 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
167 | 167 | |
168 | 168 | // Add oEmbed |
169 | 169 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
178 | 178 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
182 | 182 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @return bool |
192 | 192 | */ |
193 | 193 | public static function is_network_activated() { |
194 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
194 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @since 1.7.5.1 |
257 | 257 | */ |
258 | 258 | public static function include_widget_class() { |
259 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
259 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | if ( ! $loaded ) { |
280 | 280 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
281 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
281 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
282 | 282 | load_textdomain( 'gravityview', $mofile ); |
283 | 283 | } |
284 | 284 | |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function frontend_actions( $force = false ) { |
311 | 311 | |
312 | - if( self::is_admin() && ! $force ) { return; } |
|
312 | + if ( self::is_admin() && ! $force ) { return; } |
|
313 | 313 | |
314 | 314 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
315 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
316 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
317 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
315 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
316 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
317 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
318 | 318 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
319 | 319 | |
320 | 320 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | */ |
340 | 340 | public static function get_default_widget_areas() { |
341 | 341 | $default_areas = array( |
342 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
343 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
342 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
343 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
344 | 344 | ); |
345 | 345 | |
346 | 346 | /** |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @param mixed $data Additional data to display |
359 | 359 | * @return void |
360 | 360 | */ |
361 | - public static function log_debug( $message, $data = null ){ |
|
361 | + public static function log_debug( $message, $data = null ) { |
|
362 | 362 | /** |
363 | 363 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
364 | 364 | * @param string $message Message to display |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @param string $message log message |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public static function log_error( $message, $data = null ){ |
|
375 | + public static function log_error( $message, $data = null ) { |
|
376 | 376 | /** |
377 | 377 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
378 | 378 | * @param string $message Error message to display |
@@ -383,4 +383,4 @@ discard block |
||
383 | 383 | |
384 | 384 | } // end class GravityView_Plugin |
385 | 385 | |
386 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
386 | +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 ); ?>" /> |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
13 | 13 | ?><div> |
14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | function render_input( $override_input = null ) { |
21 | 21 | |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
33 | 33 | } |
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
34 | + $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -28,14 +28,14 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = ' merge-tag-support mt-position-right '; |
|
33 | - |
|
34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | - $class .= ' mt-hide_all_fields'; |
|
36 | - } |
|
37 | - } |
|
38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = ' merge-tag-support mt-position-right '; |
|
33 | + |
|
34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
35 | + $class .= ' mt-hide_all_fields'; |
|
36 | + } |
|
37 | + } |
|
38 | + $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
39 | 39 | |
40 | 40 | ?> |
41 | 41 | <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | ?> |
10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
11 | 11 | |
12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
14 | 14 | ?><div> |
15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
32 | 32 | $class = ' merge-tag-support mt-position-right '; |
33 | 33 | |
34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
35 | 35 | $class .= ' mt-hide_all_fields'; |
36 | 36 | } |
37 | 37 | } |
38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
38 | + $class .= ! empty( $this->field[ 'class' ] ) ? 'widefat ' . $this->field[ 'class' ] : 'widefat'; |
|
39 | 39 | |
40 | 40 | ?> |
41 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
41 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
42 | 42 | <?php |
43 | 43 | } |
44 | 44 |
@@ -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 | } |
@@ -432,23 +432,17 @@ |
||
432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
433 | 433 | |
434 | 434 | $result = false; |
435 | - } |
|
436 | - |
|
437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
438 | 436 | |
439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
440 | 438 | |
441 | 439 | $result = false; |
442 | - } |
|
443 | - |
|
444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
445 | 441 | |
446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
447 | 443 | |
448 | 444 | $result = false; |
449 | - } |
|
450 | - |
|
451 | - else { |
|
445 | + } else { |
|
452 | 446 | |
453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
454 | 448 |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
172 | 172 | * @access public |
173 | - * @return void|boolean |
|
173 | + * @return null|false |
|
174 | 174 | */ |
175 | 175 | public function process_bulk_action() { |
176 | 176 | if ( ! class_exists( 'RGForms' ) ) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
253 | 253 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
254 | 254 | * @param int $form_id The Gravity Forms Form ID |
255 | - * @return boolean|void |
|
255 | + * @return false|null |
|
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @access public |
471 | 471 | * @static |
472 | 472 | * @param mixed $form GF Form or Form ID |
473 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
473 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
474 | 474 | */ |
475 | 475 | static public function get_approved_column( $form ) { |
476 | 476 |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | |
364 | 364 | $approvedcolumn = self::get_approved_column( $form['id'] ); |
365 | 365 | |
366 | - /** |
|
367 | - * If the form doesn't contain the approve field, don't assume anything. |
|
368 | - */ |
|
369 | - if( empty( $approvedcolumn ) ) { |
|
370 | - return; |
|
371 | - } |
|
366 | + /** |
|
367 | + * If the form doesn't contain the approve field, don't assume anything. |
|
368 | + */ |
|
369 | + if( empty( $approvedcolumn ) ) { |
|
370 | + return; |
|
371 | + } |
|
372 | 372 | |
373 | 373 | $entry = GFAPI::get_entry( $entry_id ); |
374 | 374 | |
@@ -481,17 +481,17 @@ discard block |
||
481 | 481 | */ |
482 | 482 | static public function get_approved_column( $form ) { |
483 | 483 | |
484 | - if( empty( $form ) ) { |
|
485 | - return null; |
|
486 | - } |
|
484 | + if( empty( $form ) ) { |
|
485 | + return null; |
|
486 | + } |
|
487 | 487 | |
488 | - if( !is_array( $form ) ) { |
|
489 | - $form = GVCommon::get_form( $form ); |
|
490 | - } |
|
488 | + if( !is_array( $form ) ) { |
|
489 | + $form = GVCommon::get_form( $form ); |
|
490 | + } |
|
491 | 491 | |
492 | 492 | foreach( $form['fields'] as $key => $field ) { |
493 | 493 | |
494 | - $field = (array) $field; |
|
494 | + $field = (array) $field; |
|
495 | 495 | |
496 | 496 | if( !empty( $field['gravityview_approved'] ) ) { |
497 | 497 | if( !empty($field['inputs'][0]['id']) ) { |
@@ -499,14 +499,14 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | - // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | - return $input['id']; |
|
507 | - } |
|
508 | - } |
|
509 | - } |
|
502 | + // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
503 | + if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | + foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | + if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | + return $input['id']; |
|
507 | + } |
|
508 | + } |
|
509 | + } |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | return null; |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | /** gf_entries page - entries table screen */ |
35 | 35 | |
36 | 36 | // capture bulk actions |
37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
38 | 38 | // add hidden field with approve status |
39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
40 | 40 | // process ajax approve entry requests |
41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
42 | 42 | |
43 | 43 | // when using the User opt-in field, check on entry submission |
44 | 44 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
45 | 45 | |
46 | 46 | // in case entry is edited (on admin or frontend) |
47 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
47 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
51 | 51 | |
52 | 52 | // adding styles and scripts |
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
53 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
54 | 54 | // bypass Gravity Forms no-conflict mode |
55 | 55 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
56 | 56 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function tooltips( $tooltips ) { |
67 | 67 | |
68 | - $tooltips['form_gravityview_fields'] = array( |
|
69 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
70 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
68 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
69 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
70 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | return $tooltips; |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
185 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
185 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
186 | 186 | |
187 | 187 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
188 | 188 | |
189 | 189 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
190 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
190 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
191 | 191 | |
192 | 192 | /** |
193 | 193 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | // All entries are set to be updated, not just the visible ones |
206 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
206 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
207 | 207 | |
208 | 208 | // Convert the current entry search into GF-formatted search criteria |
209 | 209 | $search = array( |
210 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
211 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
212 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
210 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
211 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
212 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | } else { |
221 | 221 | |
222 | - $entries = $_POST['lead']; |
|
222 | + $entries = $_POST[ 'lead' ]; |
|
223 | 223 | |
224 | 224 | } |
225 | 225 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | */ |
261 | 261 | private static function update_bulk( $entries, $approved, $form_id ) { |
262 | 262 | |
263 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
263 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
264 | 264 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | |
268 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
268 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
269 | 269 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
270 | 270 | return false; |
271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | // calculate approved field id |
276 | 276 | $approved_column_id = self::get_approved_column( $form_id ); |
277 | 277 | |
278 | - foreach( $entries as $entry_id ) { |
|
278 | + foreach ( $entries as $entry_id ) { |
|
279 | 279 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
280 | 280 | } |
281 | 281 | } |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | * @param int $approvedcolumn (default: 0) |
295 | 295 | * @return boolean True: It worked; False: it failed |
296 | 296 | */ |
297 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
297 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
298 | 298 | |
299 | - if( !class_exists( 'GFAPI' ) ) { |
|
299 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
300 | 300 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | |
304 | - if( empty( $approvedcolumn ) ) { |
|
304 | + if ( empty( $approvedcolumn ) ) { |
|
305 | 305 | $approvedcolumn = self::get_approved_column( $form_id ); |
306 | 306 | } |
307 | 307 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | self::update_approved_meta( $entry_id, $approved ); |
321 | 321 | |
322 | 322 | // add note to entry |
323 | - if( $result === true ) { |
|
323 | + if ( $result === true ) { |
|
324 | 324 | |
325 | 325 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
326 | 326 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
333 | 333 | |
334 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
334 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
335 | 335 | $current_user = wp_get_current_user(); |
336 | 336 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
337 | 337 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | do_action( 'gravityview_clear_form_cache', $form_id ); |
345 | 345 | |
346 | - } else if( is_wp_error( $result ) ) { |
|
346 | + } else if ( is_wp_error( $result ) ) { |
|
347 | 347 | |
348 | 348 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
349 | 349 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @param $form array Gravity Forms form object |
365 | 365 | */ |
366 | 366 | public function after_submission( $entry, $form ) { |
367 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
367 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
382 | 382 | |
383 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
383 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
384 | 384 | |
385 | 385 | /** |
386 | 386 | * If the form doesn't contain the approve field, don't assume anything. |
387 | 387 | */ |
388 | - if( empty( $approvedcolumn ) ) { |
|
388 | + if ( empty( $approvedcolumn ) ) { |
|
389 | 389 | return; |
390 | 390 | } |
391 | 391 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $is_approved = empty( $is_approved ) ? 0 : 'Approved'; |
414 | 414 | |
415 | 415 | // update entry meta |
416 | - if( function_exists('gform_update_meta') ) { |
|
416 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
417 | 417 | |
418 | 418 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
419 | 419 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
427 | 427 | |
428 | - if( empty( $is_approved ) ) { |
|
428 | + if ( empty( $is_approved ) ) { |
|
429 | 429 | |
430 | 430 | /** |
431 | 431 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | |
448 | 448 | } else { |
449 | 449 | |
450 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
450 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | } |
@@ -459,21 +459,21 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function ajax_update_approved() { |
461 | 461 | |
462 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
462 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
463 | 463 | |
464 | 464 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
465 | 465 | |
466 | 466 | $result = false; |
467 | 467 | } |
468 | 468 | |
469 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
469 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
470 | 470 | |
471 | 471 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
472 | 472 | |
473 | 473 | $result = false; |
474 | 474 | } |
475 | 475 | |
476 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
476 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
477 | 477 | |
478 | 478 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
479 | 479 | |
@@ -482,11 +482,11 @@ discard block |
||
482 | 482 | |
483 | 483 | else { |
484 | 484 | |
485 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
485 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
486 | 486 | |
487 | - if( is_wp_error( $result ) ) { |
|
487 | + if ( is_wp_error( $result ) ) { |
|
488 | 488 | /** @var WP_Error $result */ |
489 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
489 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
490 | 490 | $result = false; |
491 | 491 | } |
492 | 492 | |
@@ -506,29 +506,29 @@ discard block |
||
506 | 506 | */ |
507 | 507 | static public function get_approved_column( $form ) { |
508 | 508 | |
509 | - if( empty( $form ) ) { |
|
509 | + if ( empty( $form ) ) { |
|
510 | 510 | return null; |
511 | 511 | } |
512 | 512 | |
513 | - if( !is_array( $form ) ) { |
|
513 | + if ( ! is_array( $form ) ) { |
|
514 | 514 | $form = GVCommon::get_form( $form ); |
515 | 515 | } |
516 | 516 | |
517 | - foreach( $form['fields'] as $key => $field ) { |
|
517 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
518 | 518 | |
519 | - $field = (array) $field; |
|
519 | + $field = (array)$field; |
|
520 | 520 | |
521 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
522 | - if( !empty($field['inputs'][0]['id']) ) { |
|
523 | - return $field['inputs'][0]['id']; |
|
521 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
522 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
523 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | 527 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
528 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
529 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
530 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
531 | - return $input['id']; |
|
528 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
529 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
530 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
531 | + return $input[ 'id' ]; |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } |
@@ -539,18 +539,18 @@ discard block |
||
539 | 539 | |
540 | 540 | |
541 | 541 | |
542 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
542 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
543 | 543 | |
544 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
544 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - if( empty( $entry['id'] ) ) { |
|
548 | + if ( empty( $entry[ 'id' ] ) ) { |
|
549 | 549 | return; |
550 | 550 | } |
551 | 551 | |
552 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
553 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
552 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
553 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | function add_scripts_and_styles( $hook ) { |
561 | 561 | |
562 | - if( !class_exists( 'RGForms' ) ) { |
|
562 | + if ( ! class_exists( 'RGForms' ) ) { |
|
563 | 563 | |
564 | 564 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
565 | 565 | |
@@ -568,39 +568,39 @@ discard block |
||
568 | 568 | |
569 | 569 | // enqueue styles & scripts gf_entries |
570 | 570 | // But only if we're on the main Entries page, not on reports pages |
571 | - if( RGForms::get_page() === 'entry_list' ) { |
|
571 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
572 | 572 | |
573 | - $form_id = RGForms::get('id'); |
|
573 | + $form_id = RGForms::get( 'id' ); |
|
574 | 574 | |
575 | 575 | // If there are no forms identified, use the first form. That's how GF does it. |
576 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
576 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
577 | 577 | $forms = gravityview_get_forms(); |
578 | - if( !empty( $forms ) ) { |
|
579 | - $form_id = $forms[0]['id']; |
|
578 | + if ( ! empty( $forms ) ) { |
|
579 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
583 | 583 | $approvedcolumn = self::get_approved_column( $form_id ); |
584 | 584 | |
585 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
585 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
586 | 586 | wp_enqueue_style( 'gravityview_entries_list' ); |
587 | 587 | |
588 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
588 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
589 | 589 | |
590 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
590 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
591 | 591 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
592 | 592 | |
593 | 593 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
594 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
594 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
595 | 595 | 'form_id' => $form_id, |
596 | 596 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
597 | 597 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
598 | 598 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
599 | 599 | 'bulk_message' => $this->bulk_update_message, |
600 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
601 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
602 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
603 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
600 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
601 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
602 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
603 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
604 | 604 | ) ); |
605 | 605 | |
606 | 606 | } |
@@ -643,8 +643,8 @@ discard block |
||
643 | 643 | // Sanitize the values, just to be sure. |
644 | 644 | foreach ( $bulk_actions as $key => $group ) { |
645 | 645 | foreach ( $group as $i => $action ) { |
646 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
647 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
646 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
647 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
@@ -669,13 +669,13 @@ discard block |
||
669 | 669 | * @since 1.7.2 |
670 | 670 | * @param boolean $hide_if_no_connections |
671 | 671 | */ |
672 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
672 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
673 | 673 | |
674 | - if( $hide_if_no_connections ) { |
|
674 | + if ( $hide_if_no_connections ) { |
|
675 | 675 | |
676 | 676 | $connected_views = gravityview_get_connected_views( $form_id ); |
677 | 677 | |
678 | - if( empty( $connected_views ) ) { |
|
678 | + if ( empty( $connected_views ) ) { |
|
679 | 679 | $show_approve_column = false; |
680 | 680 | } |
681 | 681 | } |
@@ -685,18 +685,18 @@ discard block |
||
685 | 685 | * @param boolean $show_approve_column Whether the column will be shown |
686 | 686 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
687 | 687 | */ |
688 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
688 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
689 | 689 | |
690 | 690 | return $show_approve_column; |
691 | 691 | } |
692 | 692 | |
693 | 693 | function register_gform_noconflict_script( $scripts ) { |
694 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
694 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
695 | 695 | return $scripts; |
696 | 696 | } |
697 | 697 | |
698 | 698 | function register_gform_noconflict_style( $styles ) { |
699 | - $styles[] = 'gravityview_entries_list'; |
|
699 | + $styles[ ] = 'gravityview_entries_list'; |
|
700 | 700 | return $styles; |
701 | 701 | } |
702 | 702 |
@@ -5,220 +5,220 @@ |
||
5 | 5 | */ |
6 | 6 | class GravityView_Change_Entry_Creator { |
7 | 7 | |
8 | - function __construct() { |
|
9 | - |
|
10 | - /** |
|
11 | - * @since 1.5.1 |
|
12 | - */ |
|
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
14 | - |
|
15 | - // ONLY ADMIN FROM HERE ON. |
|
16 | - if( !is_admin() ) { return; } |
|
17 | - |
|
18 | - /** |
|
19 | - * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
20 | - * @since 1.7.4 |
|
21 | - * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
22 | - */ |
|
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
24 | - return; |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Use `init` to fix bbPress warning |
|
29 | - * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
30 | - */ |
|
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
32 | - |
|
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
8 | + function __construct() { |
|
9 | + |
|
10 | + /** |
|
11 | + * @since 1.5.1 |
|
12 | + */ |
|
13 | + add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
14 | + |
|
15 | + // ONLY ADMIN FROM HERE ON. |
|
16 | + if( !is_admin() ) { return; } |
|
17 | + |
|
18 | + /** |
|
19 | + * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
20 | + * @since 1.7.4 |
|
21 | + * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
22 | + */ |
|
23 | + if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
24 | + return; |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Use `init` to fix bbPress warning |
|
29 | + * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
30 | + */ |
|
31 | + add_action('init', array( $this, 'load'), 100 ); |
|
32 | + |
|
33 | + add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
34 | 34 | |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * When an user is created using the User Registration add-on, assign the entry to them |
|
39 | - * |
|
40 | - * @since 1.5.1 |
|
41 | - * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
42 | - * @param int $user_id WordPress User ID |
|
43 | - * @param array $config User registration feed configuration |
|
44 | - * @param array $entry GF Entry array |
|
45 | - * @param string $password User password |
|
46 | - * @return void |
|
47 | - */ |
|
48 | - function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
37 | + /** |
|
38 | + * When an user is created using the User Registration add-on, assign the entry to them |
|
39 | + * |
|
40 | + * @since 1.5.1 |
|
41 | + * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
42 | + * @param int $user_id WordPress User ID |
|
43 | + * @param array $config User registration feed configuration |
|
44 | + * @param array $entry GF Entry array |
|
45 | + * @param string $password User password |
|
46 | + * @return void |
|
47 | + */ |
|
48 | + function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
49 | 49 | |
50 | - /** |
|
51 | - * Disable assigning the new user to the entry by returning false. |
|
52 | - * @param int $user_id WordPress User ID |
|
53 | - * @param array $config User registration feed configuration |
|
54 | - * @param array $entry GF Entry array |
|
55 | - */ |
|
56 | - $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
57 | - |
|
58 | - // If filter returns false, do not process |
|
59 | - if( empty( $assign_to_lead ) ) { |
|
60 | - return; |
|
61 | - } |
|
50 | + /** |
|
51 | + * Disable assigning the new user to the entry by returning false. |
|
52 | + * @param int $user_id WordPress User ID |
|
53 | + * @param array $config User registration feed configuration |
|
54 | + * @param array $entry GF Entry array |
|
55 | + */ |
|
56 | + $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
57 | + |
|
58 | + // If filter returns false, do not process |
|
59 | + if( empty( $assign_to_lead ) ) { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
|
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
63 | + // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
|
64 | + $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
68 | - } else { |
|
69 | - $status = __('Success', 'gravityview'); |
|
70 | - } |
|
71 | - |
|
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
66 | + if( empty( $result ) ) { |
|
67 | + $status = __('Error', 'gravityview'); |
|
68 | + } else { |
|
69 | + $status = __('Success', 'gravityview'); |
|
70 | + } |
|
71 | + |
|
72 | + $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Disable previous functionality; use this one as the canonical. |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - function prevent_conflicts() { |
|
80 | + /** |
|
81 | + * Disable previous functionality; use this one as the canonical. |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + function prevent_conflicts() { |
|
85 | 85 | |
86 | - // Plugin that was provided here: |
|
87 | - // @link https://gravityview.co/support/documentation/201991205/ |
|
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
86 | + // Plugin that was provided here: |
|
87 | + // @link https://gravityview.co/support/documentation/201991205/ |
|
88 | + remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | + remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
90 | 90 | |
91 | - // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
91 | + // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
92 | + if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | - $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
94 | + $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
95 | 95 | |
96 | - // Now, no validation is required in the methods; let's hook in. |
|
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
96 | + // Now, no validation is required in the methods; let's hook in. |
|
97 | + remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
99 | + remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
102 | - } |
|
101 | + remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
102 | + } |
|
103 | 103 | |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * @since 3.6.3 |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - function load() { |
|
106 | + /** |
|
107 | + * @since 3.6.3 |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + function load() { |
|
111 | 111 | |
112 | - // Does GF exist? |
|
113 | - if( !class_exists('GFCommon') ) { |
|
114 | - return; |
|
115 | - } |
|
112 | + // Does GF exist? |
|
113 | + if( !class_exists('GFCommon') ) { |
|
114 | + return; |
|
115 | + } |
|
116 | 116 | |
117 | - // Can the user edit entries? |
|
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | - return; |
|
120 | - } |
|
117 | + // Can the user edit entries? |
|
118 | + if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | + return; |
|
120 | + } |
|
121 | 121 | |
122 | - // If screen mode isn't set, then we're in the wrong place. |
|
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
124 | - return; |
|
125 | - } |
|
122 | + // If screen mode isn't set, then we're in the wrong place. |
|
123 | + if( empty( $_REQUEST['screen_mode'] ) ) { |
|
124 | + return; |
|
125 | + } |
|
126 | 126 | |
127 | - // Now, no validation is required in the methods; let's hook in. |
|
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
127 | + // Now, no validation is required in the methods; let's hook in. |
|
128 | + add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
138 | - * @return void |
|
139 | - */ |
|
140 | - function set_screen_mode() { |
|
136 | + /** |
|
137 | + * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
138 | + * @return void |
|
139 | + */ |
|
140 | + function set_screen_mode() { |
|
141 | 141 | |
142 | - // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
145 | - } |
|
142 | + // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
143 | + if( rgget('screen_mode') === 'edit' ) { |
|
144 | + $_POST["screen_mode"] = 'edit'; |
|
145 | + } |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * When the entry creator is changed, add a note to the entry |
|
151 | - * @param array $form GF entry array |
|
152 | - * @param int $entry_id Entry ID |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - function update_entry_creator($form, $entry_id) { |
|
156 | - global $current_user; |
|
149 | + /** |
|
150 | + * When the entry creator is changed, add a note to the entry |
|
151 | + * @param array $form GF entry array |
|
152 | + * @param int $entry_id Entry ID |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + function update_entry_creator($form, $entry_id) { |
|
156 | + global $current_user; |
|
157 | 157 | |
158 | - // Update the entry |
|
159 | - $created_by = absint( rgpost('created_by') ); |
|
158 | + // Update the entry |
|
159 | + $created_by = absint( rgpost('created_by') ); |
|
160 | 160 | |
161 | - RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
161 | + RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
162 | 162 | |
163 | - // If the creator has changed, let's add a note about who it used to be. |
|
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
163 | + // If the creator has changed, let's add a note about who it used to be. |
|
164 | + $originally_created_by = rgpost('originally_created_by'); |
|
165 | 165 | |
166 | - // If there's no owner and there didn't used to be, keep going |
|
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | - return; |
|
169 | - } |
|
166 | + // If there's no owner and there didn't used to be, keep going |
|
167 | + if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | + return; |
|
169 | + } |
|
170 | 170 | |
171 | - // If the values have changed |
|
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
171 | + // If the values have changed |
|
172 | + if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata($current_user->ID); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
182 | - $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
183 | - } |
|
180 | + if( !empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata($originally_created_by); |
|
182 | + $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
183 | + } |
|
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
187 | - $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
188 | - } |
|
185 | + if( !empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata($created_by); |
|
187 | + $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
188 | + } |
|
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
191 | - } |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
191 | + } |
|
192 | 192 | |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - /** |
|
196 | - * Output the select to change the entry creator |
|
197 | - * @param int $form_id GF Form ID |
|
198 | - * @param array $entry GF entry array |
|
199 | - * @return void |
|
200 | - */ |
|
201 | - function add_select($form_id, $entry ) { |
|
195 | + /** |
|
196 | + * Output the select to change the entry creator |
|
197 | + * @param int $form_id GF Form ID |
|
198 | + * @param array $entry GF entry array |
|
199 | + * @return void |
|
200 | + */ |
|
201 | + function add_select($form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
204 | - return; |
|
205 | - } |
|
203 | + if( rgpost('screen_mode') !== 'edit' ) { |
|
204 | + return; |
|
205 | + } |
|
206 | 206 | |
207 | - $users = GVCommon::get_users( 'change_entry_creator' ); |
|
207 | + $users = GVCommon::get_users( 'change_entry_creator' ); |
|
208 | 208 | |
209 | - $output = '<label for="change_created_by">'; |
|
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
211 | - $output .= '</label> |
|
209 | + $output = '<label for="change_created_by">'; |
|
210 | + $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
211 | + $output .= '</label> |
|
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
216 | - } |
|
217 | - $output .= '</select>'; |
|
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
219 | - echo $output; |
|
220 | - |
|
221 | - } |
|
213 | + $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | + foreach($users as $user) { |
|
215 | + $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
216 | + } |
|
217 | + $output .= '</select>'; |
|
218 | + $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
219 | + echo $output; |
|
220 | + |
|
221 | + } |
|
222 | 222 | |
223 | 223 | } |
224 | 224 |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @since 1.5.1 |
12 | 12 | */ |
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
14 | 14 | |
15 | 15 | // ONLY ADMIN FROM HERE ON. |
16 | - if( !is_admin() ) { return; } |
|
16 | + if ( ! is_admin() ) { return; } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
20 | 20 | * @since 1.7.4 |
21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
22 | 22 | */ |
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * Use `init` to fix bbPress warning |
29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
30 | 30 | */ |
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
32 | 32 | |
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
57 | 57 | |
58 | 58 | // If filter returns false, do not process |
59 | - if( empty( $assign_to_lead ) ) { |
|
59 | + if ( empty( $assign_to_lead ) ) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
64 | + $result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
66 | + if ( empty( $result ) ) { |
|
67 | + $status = __( 'Error', 'gravityview' ); |
|
68 | 68 | } else { |
69 | - $status = __('Success', 'gravityview'); |
|
69 | + $status = __( 'Success', 'gravityview' ); |
|
70 | 70 | } |
71 | 71 | |
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | // Plugin that was provided here: |
87 | 87 | // @link https://gravityview.co/support/documentation/201991205/ |
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
88 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2 ); |
|
89 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2 ); |
|
90 | 90 | |
91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
92 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
95 | 95 | |
96 | 96 | // Now, no validation is required in the methods; let's hook in. |
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
97 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
99 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2 ); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
101 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2 ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | function load() { |
111 | 111 | |
112 | 112 | // Does GF exist? |
113 | - if( !class_exists('GFCommon') ) { |
|
113 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Can the user edit entries? |
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
118 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
123 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Now, no validation is required in the methods; let's hook in. |
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
128 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | function set_screen_mode() { |
141 | 141 | |
142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
143 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
144 | + $_POST[ "screen_mode" ] = 'edit'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -152,42 +152,42 @@ discard block |
||
152 | 152 | * @param int $entry_id Entry ID |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - function update_entry_creator($form, $entry_id) { |
|
155 | + function update_entry_creator( $form, $entry_id ) { |
|
156 | 156 | global $current_user; |
157 | 157 | |
158 | 158 | // Update the entry |
159 | - $created_by = absint( rgpost('created_by') ); |
|
159 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
160 | 160 | |
161 | 161 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
162 | 162 | |
163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
164 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
165 | 165 | |
166 | 166 | // If there's no owner and there didn't used to be, keep going |
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
167 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | 171 | // If the values have changed |
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
172 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata( $current_user->ID ); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
180 | + if ( ! empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
182 | 182 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
183 | 183 | } |
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
185 | + if ( ! empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata( $created_by ); |
|
187 | 187 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
188 | 188 | } |
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
198 | 198 | * @param array $entry GF entry array |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - function add_select($form_id, $entry ) { |
|
201 | + function add_select( $form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
203 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | 207 | $users = GVCommon::get_users( 'change_entry_creator' ); |
208 | 208 | |
209 | 209 | $output = '<label for="change_created_by">'; |
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
210 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
211 | 211 | $output .= '</label> |
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
213 | + $output .= '<option value=""> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
214 | + foreach ( $users as $user ) { |
|
215 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
216 | 216 | } |
217 | 217 | $output .= '</select>'; |
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
218 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
219 | 219 | echo $output; |
220 | 220 | |
221 | 221 | } |
@@ -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,11 +111,11 @@ 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 | - if ( !empty( $image_size ) ) { |
|
118 | + if ( ! empty( $image_size ) ) { |
|
119 | 119 | list( $width, $height ) = $image_size; |
120 | 120 | } |
121 | 121 | |
@@ -128,33 +128,33 @@ discard block |
||
128 | 128 | * @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 |
129 | 129 | */ |
130 | 130 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
131 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
132 | - 'small' => array('width' => 100, 'height' => 75), |
|
133 | - 'medium' => array('width' => 250, 'height' => 188), |
|
134 | - 'large' => array('width' => 448, 'height' => 336), |
|
131 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
132 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
133 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
134 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
135 | 135 | ) ); |
136 | 136 | |
137 | - switch( $this->size ) { |
|
137 | + switch ( $this->size ) { |
|
138 | 138 | case 'tiny': |
139 | - extract($image_sizes['tiny']); |
|
139 | + extract( $image_sizes[ 'tiny' ] ); |
|
140 | 140 | break; |
141 | 141 | case 'small': |
142 | 142 | case 's': |
143 | 143 | case 'thumb': |
144 | - extract($image_sizes['small']); |
|
144 | + extract( $image_sizes[ 'small' ] ); |
|
145 | 145 | break; |
146 | 146 | case 'm': |
147 | 147 | case 'medium': |
148 | - extract($image_sizes['medium']); |
|
148 | + extract( $image_sizes[ 'medium' ] ); |
|
149 | 149 | break; |
150 | 150 | case 'large': |
151 | 151 | case 'l': |
152 | - extract($image_sizes['large']); |
|
152 | + extract( $image_sizes[ 'large' ] ); |
|
153 | 153 | break; |
154 | 154 | default: |
155 | 155 | // Verify that the passed sizes are integers. |
156 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
156 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | - add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
15 | + add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
16 | 16 | |
17 | - // Load Debug Bar integration |
|
18 | - add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
17 | + // Load Debug Bar integration |
|
18 | + add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | - return $supported_plugins; |
|
47 | + $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | + return $supported_plugins; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | if ( class_exists("GFLogging") ) { |
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
101 | - } |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | static function log_error( $message = '', $data = null ) { |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | if ( class_exists("GFLogging") ) { |
119 | - GFLogging::include_logger(); |
|
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
119 | + GFLogging::include_logger(); |
|
120 | + GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct() { |
9 | 9 | |
10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
11 | 11 | |
12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
12 | + add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 ); |
|
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
35 | 35 | } |
36 | 36 | |
37 | - $panels[] = new GravityView_Debug_Bar; |
|
37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
38 | 38 | |
39 | 39 | return $panels; |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
48 | 48 | return $supported_plugins; |
49 | 49 | } |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string "print_r" or "var_export" |
73 | 73 | */ |
74 | 74 | static function get_print_function() { |
75 | - if( ob_get_level() > 0 ) { |
|
75 | + if ( ob_get_level() > 0 ) { |
|
76 | 76 | $function = 'var_export'; |
77 | 77 | } else { |
78 | 78 | $function = 'print_r'; |
@@ -88,36 +88,36 @@ discard block |
||
88 | 88 | $notice = array( |
89 | 89 | 'message' => $function( $message, true ), |
90 | 90 | 'data' => $data, |
91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
91 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
92 | 92 | ); |
93 | 93 | |
94 | - if( !in_array( $notice, self::$notices ) ) { |
|
95 | - self::$notices[] = $notice; |
|
94 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
95 | + self::$notices[ ] = $notice; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( class_exists("GFLogging") ) { |
|
98 | + if ( class_exists( "GFLogging" ) ) { |
|
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - static function log_error( $message = '', $data = null ) { |
|
104 | + static function log_error( $message = '', $data = null ) { |
|
105 | 105 | |
106 | 106 | $function = self::get_print_function(); |
107 | 107 | |
108 | 108 | $error = array( |
109 | 109 | 'message' => $message, |
110 | 110 | 'data' => $data, |
111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
111 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
112 | 112 | ); |
113 | 113 | |
114 | - if( !in_array( $error, self::$errors ) ) { |
|
115 | - self::$errors[] = $error; |
|
114 | + if ( ! in_array( $error, self::$errors ) ) { |
|
115 | + self::$errors[ ] = $error; |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( class_exists("GFLogging") ) { |
|
118 | + if ( class_exists( "GFLogging" ) ) { |
|
119 | 119 | GFLogging::include_logger(); |
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
120 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |