@@ -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 | |
@@ -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,19 +150,19 @@ 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' ); |
|
| 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 | 160 | |
| 161 | 161 | // Load WordPress Widgets |
| 162 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 162 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 163 | 163 | |
| 164 | 164 | // Load GravityView Widgets |
| 165 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 165 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 166 | 166 | |
| 167 | 167 | // Add oEmbed |
| 168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 178 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 179 | 179 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @return bool |
| 191 | 191 | */ |
| 192 | 192 | public static function is_network_activated() { |
| 193 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 193 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @since 1.7.5.1 |
| 256 | 256 | */ |
| 257 | 257 | public static function include_widget_class() { |
| 258 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 258 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | if ( ! $loaded ) { |
| 278 | 278 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 279 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 279 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 280 | 280 | load_textdomain( 'gravityview', $mofile ); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -302,12 +302,12 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function frontend_actions() { |
| 304 | 304 | |
| 305 | - if( self::is_admin() ) { return; } |
|
| 305 | + if ( self::is_admin() ) { return; } |
|
| 306 | 306 | |
| 307 | 307 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 308 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 309 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 310 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 308 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 309 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 310 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 311 | 311 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 312 | 312 | |
| 313 | 313 | |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | public static function get_default_widget_areas() { |
| 334 | 334 | $default_areas = array( |
| 335 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 336 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 335 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 336 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 337 | 337 | ); |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -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 |
@@ -376,4 +376,4 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | } // end class GravityView_Plugin |
| 378 | 378 | |
| 379 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 379 | +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 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // template areas |
| 138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
| 139 | - $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
| 139 | + $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
| 140 | 140 | |
| 141 | 141 | // widget areas |
| 142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
@@ -328,40 +328,40 @@ discard block |
||
| 328 | 328 | // load file |
| 329 | 329 | $xmlstr = file_get_contents( $form_file ); |
| 330 | 330 | |
| 331 | - $options = array( |
|
| 332 | - "page" => array("unserialize_as_array" => true), |
|
| 333 | - "form"=> array("unserialize_as_array" => true), |
|
| 334 | - "field"=> array("unserialize_as_array" => true), |
|
| 335 | - "rule"=> array("unserialize_as_array" => true), |
|
| 336 | - "choice"=> array("unserialize_as_array" => true), |
|
| 337 | - "input"=> array("unserialize_as_array" => true), |
|
| 338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | - "routin"=> array("unserialize_as_array" => true), |
|
| 341 | - "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | - "notification" => array("unserialize_as_array" => true) |
|
| 343 | - ); |
|
| 331 | + $options = array( |
|
| 332 | + "page" => array("unserialize_as_array" => true), |
|
| 333 | + "form"=> array("unserialize_as_array" => true), |
|
| 334 | + "field"=> array("unserialize_as_array" => true), |
|
| 335 | + "rule"=> array("unserialize_as_array" => true), |
|
| 336 | + "choice"=> array("unserialize_as_array" => true), |
|
| 337 | + "input"=> array("unserialize_as_array" => true), |
|
| 338 | + "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | + "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | + "routin"=> array("unserialize_as_array" => true), |
|
| 341 | + "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | + "notification" => array("unserialize_as_array" => true) |
|
| 343 | + ); |
|
| 344 | 344 | |
| 345 | 345 | $xml = new RGXML($options); |
| 346 | - $forms = $xml->unserialize($xmlstr); |
|
| 346 | + $forms = $xml->unserialize($xmlstr); |
|
| 347 | 347 | |
| 348 | - if( !$forms ) { |
|
| 349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 350 | - return false; |
|
| 351 | - } |
|
| 348 | + if( !$forms ) { |
|
| 349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | - $form = $forms[0]; |
|
| 355 | - } |
|
| 353 | + if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | + $form = $forms[0]; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - if( empty( $form ) ) { |
|
| 358 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
| 359 | - return false; |
|
| 360 | - } |
|
| 357 | + if( empty( $form ) ) { |
|
| 358 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
| 359 | + return false; |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 363 | 363 | |
| 364 | - return $form; |
|
| 364 | + return $form; |
|
| 365 | 365 | |
| 366 | 366 | } |
| 367 | 367 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Don't exit if we're running test suite. |
| 37 | 37 | * @since 1.15 |
| 38 | 38 | */ |
| 39 | - if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 39 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 40 | 40 | return $mixed; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | 52 | function check_ajax_nonce() { |
| 53 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) { |
|
| 53 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) { |
|
| 54 | 54 | $this->_exit( false ); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | //check nonce |
| 68 | 68 | $this->check_ajax_nonce(); |
| 69 | 69 | |
| 70 | - $context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory'; |
|
| 70 | + $context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory'; |
|
| 71 | 71 | |
| 72 | 72 | // If Form was changed, JS sends form ID, if start fresh, JS sends template_id |
| 73 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 74 | - do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context ); |
|
| 73 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 74 | + do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context ); |
|
| 75 | 75 | $this->_exit(); |
| 76 | - } elseif( !empty( $_POST['template_id'] ) ) { |
|
| 77 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 76 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 77 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 78 | 78 | do_action( 'gravityview_render_available_fields', $form, $context ); |
| 79 | 79 | $this->_exit(); |
| 80 | 80 | } |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | function get_active_areas() { |
| 95 | 95 | $this->check_ajax_nonce(); |
| 96 | 96 | |
| 97 | - if( empty( $_POST['template_id'] ) ) { |
|
| 97 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 98 | 98 | $this->_exit( false ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | ob_start(); |
| 102 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true ); |
|
| 103 | - $response['directory'] = ob_get_clean(); |
|
| 102 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true ); |
|
| 103 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 104 | 104 | |
| 105 | 105 | ob_start(); |
| 106 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'single', '', true ); |
|
| 107 | - $response['single'] = ob_get_clean(); |
|
| 106 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true ); |
|
| 107 | + $response[ 'single' ] = ob_get_clean(); |
|
| 108 | 108 | |
| 109 | 109 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 110 | 110 | |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $this->check_ajax_nonce(); |
| 121 | 121 | |
| 122 | - if( empty( $_POST['template_id'] ) ) { |
|
| 122 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 123 | 123 | $this->_exit( false ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // get the fields xml config file for this specific preset |
| 127 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
| 127 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
| 128 | 128 | // import fields |
| 129 | - if( !empty( $preset_fields_path ) ) { |
|
| 129 | + if ( ! empty( $preset_fields_path ) ) { |
|
| 130 | 130 | $presets = $this->import_fields( $preset_fields_path ); |
| 131 | 131 | } else { |
| 132 | 132 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
| 135 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
| 136 | 136 | |
| 137 | 137 | // template areas |
| 138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -142,20 +142,20 @@ discard block |
||
| 142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 143 | 143 | |
| 144 | 144 | ob_start(); |
| 145 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
| 146 | - $response['header'] = ob_get_clean(); |
|
| 145 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 146 | + $response[ 'header' ] = ob_get_clean(); |
|
| 147 | 147 | |
| 148 | 148 | ob_start(); |
| 149 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
| 150 | - $response['footer'] = ob_get_clean(); |
|
| 149 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 150 | + $response[ 'footer' ] = ob_get_clean(); |
|
| 151 | 151 | |
| 152 | 152 | ob_start(); |
| 153 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
| 154 | - $response['directory'] = ob_get_clean(); |
|
| 153 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
| 154 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 155 | 155 | |
| 156 | 156 | ob_start(); |
| 157 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
| 158 | - $response['single'] = ob_get_clean(); |
|
| 157 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
| 158 | + $response[ 'single' ] = ob_get_clean(); |
|
| 159 | 159 | |
| 160 | 160 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 161 | 161 | |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $this->check_ajax_nonce(); |
| 175 | 175 | |
| 176 | - if( empty( $_POST['template_id'] ) ) { |
|
| 176 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 177 | 177 | do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' ); |
| 178 | 178 | $this->_exit( false ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // get the xml for this specific template_id |
| 182 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
| 182 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
| 183 | 183 | |
| 184 | 184 | // import form |
| 185 | 185 | $form = $this->import_form( $preset_form_xml_path ); |
| 186 | 186 | |
| 187 | 187 | // get the form ID |
| 188 | - if( false === $form ) { |
|
| 188 | + if ( false === $form ) { |
|
| 189 | 189 | // send error to user |
| 190 | - do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] ); |
|
| 190 | + do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] ); |
|
| 191 | 191 | |
| 192 | 192 | $this->_exit( false ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
| 195 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path ); |
| 208 | 208 | |
| 209 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
| 209 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
| 210 | 210 | do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path ); |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count ); |
| 219 | 219 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms ); |
| 220 | 220 | |
| 221 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
| 221 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
| 222 | 222 | do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' ); |
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | // import success - return form id |
| 227 | - return $forms[0]; |
|
| 227 | + return $forms[ 0 ]; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | function get_field_options() { |
| 239 | 239 | $this->check_ajax_nonce(); |
| 240 | 240 | |
| 241 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
| 241 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
| 242 | 242 | do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' ); |
| 243 | 243 | $this->_exit( false ); |
| 244 | 244 | } |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | $_post = array_map( 'esc_attr', $_post ); |
| 251 | 251 | |
| 252 | 252 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
| 253 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
| 254 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
| 253 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
| 254 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
| 255 | 255 | |
| 256 | - $response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
| 256 | + $response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
| 257 | 257 | |
| 258 | 258 | $response = gravityview_strip_whitespace( $response ); |
| 259 | 259 | |
@@ -274,15 +274,15 @@ discard block |
||
| 274 | 274 | $form = ''; |
| 275 | 275 | |
| 276 | 276 | // if form id is set, use it, else, get form from preset |
| 277 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 277 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 278 | 278 | |
| 279 | - $form = (int) $_POST['form_id']; |
|
| 279 | + $form = (int)$_POST[ 'form_id' ]; |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | // get form from preset |
| 283 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
| 283 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 284 | 284 | |
| 285 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 285 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
@@ -298,27 +298,27 @@ discard block |
||
| 298 | 298 | * @param string $template_id Preset template |
| 299 | 299 | * |
| 300 | 300 | */ |
| 301 | - static function pre_get_form_fields( $template_id = '') { |
|
| 301 | + static function pre_get_form_fields( $template_id = '' ) { |
|
| 302 | 302 | |
| 303 | - if( empty( $template_id ) ) { |
|
| 303 | + if ( empty( $template_id ) ) { |
|
| 304 | 304 | do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' ); |
| 305 | 305 | return false; |
| 306 | 306 | } else { |
| 307 | 307 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
| 308 | - if( !file_exists( $form_file ) ) { |
|
| 309 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file ); |
|
| 308 | + if ( ! file_exists( $form_file ) ) { |
|
| 309 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file ); |
|
| 310 | 310 | return false; |
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Load xml parser (from GravityForms) |
| 315 | - if( class_exists( 'GFCommon' ) ) { |
|
| 315 | + if ( class_exists( 'GFCommon' ) ) { |
|
| 316 | 316 | $xml_parser = GFCommon::get_base_path() . '/xml.php'; |
| 317 | 317 | } else { |
| 318 | 318 | $xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php'; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if( file_exists( $xml_parser ) ) { |
|
| 321 | + if ( file_exists( $xml_parser ) ) { |
|
| 322 | 322 | require_once( $xml_parser ); |
| 323 | 323 | } else { |
| 324 | 324 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser ); |
@@ -329,37 +329,37 @@ discard block |
||
| 329 | 329 | $xmlstr = file_get_contents( $form_file ); |
| 330 | 330 | |
| 331 | 331 | $options = array( |
| 332 | - "page" => array("unserialize_as_array" => true), |
|
| 333 | - "form"=> array("unserialize_as_array" => true), |
|
| 334 | - "field"=> array("unserialize_as_array" => true), |
|
| 335 | - "rule"=> array("unserialize_as_array" => true), |
|
| 336 | - "choice"=> array("unserialize_as_array" => true), |
|
| 337 | - "input"=> array("unserialize_as_array" => true), |
|
| 338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | - "routin"=> array("unserialize_as_array" => true), |
|
| 341 | - "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | - "notification" => array("unserialize_as_array" => true) |
|
| 332 | + "page" => array( "unserialize_as_array" => true ), |
|
| 333 | + "form"=> array( "unserialize_as_array" => true ), |
|
| 334 | + "field"=> array( "unserialize_as_array" => true ), |
|
| 335 | + "rule"=> array( "unserialize_as_array" => true ), |
|
| 336 | + "choice"=> array( "unserialize_as_array" => true ), |
|
| 337 | + "input"=> array( "unserialize_as_array" => true ), |
|
| 338 | + "routing_item"=> array( "unserialize_as_array" => true ), |
|
| 339 | + "creditCard"=> array( "unserialize_as_array" => true ), |
|
| 340 | + "routin"=> array( "unserialize_as_array" => true ), |
|
| 341 | + "confirmation" => array( "unserialize_as_array" => true ), |
|
| 342 | + "notification" => array( "unserialize_as_array" => true ) |
|
| 343 | 343 | ); |
| 344 | 344 | |
| 345 | - $xml = new RGXML($options); |
|
| 346 | - $forms = $xml->unserialize($xmlstr); |
|
| 345 | + $xml = new RGXML( $options ); |
|
| 346 | + $forms = $xml->unserialize( $xmlstr ); |
|
| 347 | 347 | |
| 348 | - if( !$forms ) { |
|
| 349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 348 | + if ( ! $forms ) { |
|
| 349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file ); |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | - $form = $forms[0]; |
|
| 353 | + if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) { |
|
| 354 | + $form = $forms[ 0 ]; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if( empty( $form ) ) { |
|
| 357 | + if ( empty( $form ) ) { |
|
| 358 | 358 | do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form ); |
|
| 363 | 363 | |
| 364 | 364 | return $form; |
| 365 | 365 | |
@@ -373,38 +373,38 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | function import_fields( $file ) { |
| 375 | 375 | |
| 376 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
| 376 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
| 377 | 377 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file ); |
| 378 | 378 | return false; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if( !class_exists('WXR_Parser') ) { |
|
| 381 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
| 382 | 382 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | $parser = new WXR_Parser(); |
| 386 | 386 | $presets = $parser->parse( $file ); |
| 387 | 387 | |
| 388 | - if(is_wp_error( $presets )) { |
|
| 388 | + if ( is_wp_error( $presets ) ) { |
|
| 389 | 389 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets ); |
| 390 | 390 | return false; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
| 393 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
| 394 | 394 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file ); |
| 395 | 395 | return false; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] ); |
|
| 398 | + do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] ); |
|
| 399 | 399 | |
| 400 | 400 | $fields = $widgets = array(); |
| 401 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
| 402 | - switch ($meta['key']) { |
|
| 401 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
| 402 | + switch ( $meta[ 'key' ] ) { |
|
| 403 | 403 | case '_gravityview_directory_fields': |
| 404 | - $fields = maybe_unserialize( $meta['value'] ); |
|
| 404 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
| 405 | 405 | break; |
| 406 | 406 | case '_gravityview_directory_widgets': |
| 407 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
| 407 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
| 215 | 215 | foreach ( $field['inputs'] as $input ) { |
| 216 | - /** |
|
| 217 | - * @hack |
|
| 218 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | - */ |
|
| 220 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | - continue; |
|
| 222 | - } |
|
| 216 | + /** |
|
| 217 | + * @hack |
|
| 218 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | + */ |
|
| 220 | + if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | + continue; |
|
| 222 | + } |
|
| 223 | 223 | $fields[ (string)$input['id'] ] = array( |
| 224 | 224 | 'label' => rgar( $input, 'label' ), |
| 225 | 225 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 467 | 467 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
| 468 | 468 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
| 469 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 469 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 470 | 470 | $criteria['context_view_id'] = null; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | ), |
| 1083 | 1083 | ); |
| 1084 | 1084 | |
| 1085 | - $fields = $date_created + $fields; |
|
| 1085 | + $fields = $date_created + $fields; |
|
| 1086 | 1086 | |
| 1087 | 1087 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1088 | 1088 | |
@@ -1094,13 +1094,13 @@ discard block |
||
| 1094 | 1094 | } |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - /** |
|
| 1098 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | - * @since 1.12 |
|
| 1100 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | - */ |
|
| 1103 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1097 | + /** |
|
| 1098 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | + * @since 1.12 |
|
| 1100 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | + */ |
|
| 1103 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1104 | 1104 | |
| 1105 | 1105 | return $fields; |
| 1106 | 1106 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | |
| 1368 | - /** |
|
| 1369 | - * Display updated/error notice |
|
| 1370 | - * |
|
| 1371 | - * @param string $notice text/HTML of notice |
|
| 1372 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | - * |
|
| 1374 | - * @return string |
|
| 1375 | - */ |
|
| 1376 | - public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | - } |
|
| 1368 | + /** |
|
| 1369 | + * Display updated/error notice |
|
| 1370 | + * |
|
| 1371 | + * @param string $notice text/HTML of notice |
|
| 1372 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | + * |
|
| 1374 | + * @return string |
|
| 1375 | + */ |
|
| 1376 | + public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | + } |
|
| 1379 | 1379 | |
| 1380 | 1380 | |
| 1381 | 1381 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
| 126 | 126 | |
| 127 | - $form = self::get_form( $entry['form_id'] ); |
|
| 127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 128 | 128 | |
| 129 | 129 | return $form; |
| 130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
| 177 | 177 | |
| 178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
| 178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
| 179 | 179 | |
| 180 | 180 | return $result; |
| 181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
| 194 | 194 | $gf_forms = GFAPI::get_forms(); |
| 195 | 195 | foreach ( $gf_forms as $form ) { |
| 196 | - $forms[] = array( |
|
| 197 | - 'id' => $form['id'], |
|
| 198 | - 'title' => $form['title'], |
|
| 196 | + $forms[ ] = array( |
|
| 197 | + 'id' => $form[ 'id' ], |
|
| 198 | + 'title' => $form[ 'title' ], |
|
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ( $form ) { |
| 230 | - foreach ( $form['fields'] as $field ) { |
|
| 231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 232 | - $fields[ $field['id'] ] = array( |
|
| 230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 231 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 232 | + $fields[ $field[ 'id' ] ] = array( |
|
| 233 | 233 | 'label' => rgar( $field, 'label' ), |
| 234 | 234 | 'parent' => null, |
| 235 | 235 | 'type' => rgar( $field, 'type' ), |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 242 | - foreach ( $field['inputs'] as $input ) { |
|
| 241 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 242 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 243 | 243 | /** |
| 244 | 244 | * @hack |
| 245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 246 | 246 | */ |
| 247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 247 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | - $fields[ (string)$input['id'] ] = array( |
|
| 250 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
| 251 | 251 | 'label' => rgar( $input, 'label' ), |
| 252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 253 | 253 | 'parent' => $field, |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** @since 1.14 */ |
| 262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
| 262 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
| 263 | 263 | |
| 264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
| 264 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
| 265 | 265 | |
| 266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
| 266 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
| 267 | 267 | |
| 268 | 268 | $fields[ $input_id ] = array( |
| 269 | 269 | 'label' => rgar( $input, 'text' ), |
@@ -279,25 +279,25 @@ discard block |
||
| 279 | 279 | /** |
| 280 | 280 | * @since 1.8 |
| 281 | 281 | */ |
| 282 | - if( 'quiz' === $field['type'] ) { |
|
| 282 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
| 283 | 283 | $has_quiz_fields = true; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * @since 1.8 |
| 288 | 288 | */ |
| 289 | - if( 'poll' === $field['type'] ) { |
|
| 289 | + if ( 'poll' === $field[ 'type' ] ) { |
|
| 290 | 290 | $has_poll_fields = true; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 293 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 294 | 294 | $has_product_fields = true; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @hack Version 1.9 |
| 299 | 299 | */ |
| 300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
| 300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
| 301 | 301 | |
| 302 | 302 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
| 303 | 303 | $has_post_fields = true; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @since 1.7 |
| 310 | 310 | */ |
| 311 | 311 | if ( $has_post_fields ) { |
| 312 | - $fields['post_id'] = array( |
|
| 312 | + $fields[ 'post_id' ] = array( |
|
| 313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), |
| 314 | 314 | 'type' => 'post_id', |
| 315 | 315 | ); |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 321 | 321 | |
| 322 | 322 | foreach ( $payment_fields as $payment_field ) { |
| 323 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 323 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 324 | 324 | continue; |
| 325 | 325 | } |
| 326 | - $fields["{$payment_field->name}"] = array( |
|
| 326 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 327 | 327 | 'label' => $payment_field->label, |
| 328 | 328 | 'desc' => $payment_field->description, |
| 329 | 329 | 'type' => $payment_field->name, |
@@ -334,25 +334,25 @@ discard block |
||
| 334 | 334 | /** |
| 335 | 335 | * @since 1.8 |
| 336 | 336 | */ |
| 337 | - if( $has_quiz_fields ) { |
|
| 337 | + if ( $has_quiz_fields ) { |
|
| 338 | 338 | |
| 339 | - $fields['gquiz_score'] = array( |
|
| 339 | + $fields[ 'gquiz_score' ] = array( |
|
| 340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 341 | 341 | 'type' => 'quiz_score', |
| 342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 343 | 343 | ); |
| 344 | - $fields['gquiz_percent'] = array( |
|
| 344 | + $fields[ 'gquiz_percent' ] = array( |
|
| 345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 346 | 346 | 'type' => 'quiz_percent', |
| 347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 348 | 348 | ); |
| 349 | - $fields['gquiz_grade'] = array( |
|
| 349 | + $fields[ 'gquiz_grade' ] = array( |
|
| 350 | 350 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
| 351 | 351 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 352 | 352 | 'type' => 'quiz_grade', |
| 353 | 353 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 354 | 354 | ); |
| 355 | - $fields['gquiz_is_pass'] = array( |
|
| 355 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 356 | 356 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 357 | 357 | 'type' => 'quiz_is_pass', |
| 358 | 358 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $fields = array(); |
| 376 | 376 | |
| 377 | - foreach ( $extra_fields as $key => $field ){ |
|
| 378 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 379 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 377 | + foreach ( $extra_fields as $key => $field ) { |
|
| 378 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 379 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
@@ -416,32 +416,32 @@ discard block |
||
| 416 | 416 | 'search_criteria' => null, |
| 417 | 417 | 'sorting' => null, |
| 418 | 418 | 'paging' => null, |
| 419 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 419 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 420 | 420 | ); |
| 421 | 421 | |
| 422 | 422 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 423 | 423 | |
| 424 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 425 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 424 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 425 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 426 | 426 | |
| 427 | 427 | if ( ! is_array( $filter ) ) { |
| 428 | 428 | continue; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // By default, we want searches to be wildcard for each field. |
| 432 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 432 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | 435 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 436 | 436 | * @param string $operator Existing search operator |
| 437 | 437 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 438 | 438 | */ |
| 439 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 439 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // don't send just the [mode] without any field filter. |
| 443 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 444 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 443 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 444 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | } |
@@ -452,21 +452,21 @@ discard block |
||
| 452 | 452 | * Prepare date formats to be in Gravity Forms DB format; |
| 453 | 453 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 454 | 454 | */ |
| 455 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 455 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 456 | 456 | |
| 457 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 457 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 458 | 458 | |
| 459 | 459 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 460 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 460 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 461 | 461 | |
| 462 | 462 | if ( $date ) { |
| 463 | 463 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 464 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 464 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 465 | 465 | } else { |
| 466 | 466 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 467 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 467 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 468 | 468 | |
| 469 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 469 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | } |
@@ -474,12 +474,12 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 476 | 476 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 477 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 477 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 478 | 478 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 479 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
| 480 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 479 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; |
|
| 480 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 481 | 481 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 482 | - $criteria['context_view_id'] = null; |
|
| 482 | + $criteria[ 'context_view_id' ] = null; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * @param array $form_ids Forms to search |
| 489 | 489 | * @param int $view_id ID of the view being used to search |
| 490 | 490 | */ |
| 491 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 491 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 492 | 492 | |
| 493 | 493 | return (array)$criteria; |
| 494 | 494 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | /** Reduce # of database calls */ |
| 520 | 520 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 521 | 521 | |
| 522 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 522 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 523 | 523 | |
| 524 | 524 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | // Still update the total count when using cached results |
| 529 | 529 | if ( ! is_null( $total ) ) { |
| 530 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 530 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | $return = $entries; |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 548 | 548 | |
| 549 | 549 | // No entries returned from gravityview_before_get_entries |
| 550 | - if( is_null( $entries ) ) { |
|
| 550 | + if ( is_null( $entries ) ) { |
|
| 551 | 551 | |
| 552 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 552 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 553 | 553 | |
| 554 | 554 | if ( is_wp_error( $entries ) ) { |
| 555 | 555 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 561 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 562 | 562 | |
| 563 | 563 | // Cache results |
| 564 | 564 | $Cache->set( $entries, 'entries' ); |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
| 647 | 647 | |
| 648 | - if( $check_entry_display ) { |
|
| 648 | + if ( $check_entry_display ) { |
|
| 649 | 649 | // Is the entry allowed |
| 650 | 650 | $entry = self::check_entry_display( $entry ); |
| 651 | 651 | } |
@@ -678,12 +678,12 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | $value = false; |
| 680 | 680 | |
| 681 | - if( 'context' === $val1 ) { |
|
| 681 | + if ( 'context' === $val1 ) { |
|
| 682 | 682 | |
| 683 | 683 | $matching_contexts = array( $val2 ); |
| 684 | 684 | |
| 685 | 685 | // We allow for non-standard contexts. |
| 686 | - switch( $val2 ) { |
|
| 686 | + switch ( $val2 ) { |
|
| 687 | 687 | // Check for either single or edit |
| 688 | 688 | case 'singular': |
| 689 | 689 | $matching_contexts = array( 'single', 'edit' ); |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | return false; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - if ( empty( $entry['form_id'] ) ) { |
|
| 746 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 747 | 747 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 748 | 748 | return false; |
| 749 | 749 | } |
@@ -751,26 +751,26 @@ discard block |
||
| 751 | 751 | $criteria = self::calculate_get_entries_criteria(); |
| 752 | 752 | |
| 753 | 753 | // Make sure the current View is connected to the same form as the Entry |
| 754 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 755 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 754 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 755 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 756 | 756 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 757 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 758 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
| 757 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 758 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
| 759 | 759 | return false; |
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 763 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 764 | 764 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 765 | 765 | return $entry; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | - $search_criteria = $criteria['search_criteria']; |
|
| 768 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 769 | 769 | unset( $criteria ); |
| 770 | 770 | |
| 771 | 771 | // check entry status |
| 772 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 773 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 772 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 773 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 774 | 774 | return false; |
| 775 | 775 | } |
| 776 | 776 | |
@@ -778,37 +778,37 @@ discard block |
||
| 778 | 778 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 779 | 779 | |
| 780 | 780 | // field_filters |
| 781 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 781 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 782 | 782 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 783 | 783 | return $entry; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - $filters = $search_criteria['field_filters']; |
|
| 786 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 787 | 787 | unset( $search_criteria ); |
| 788 | 788 | |
| 789 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 790 | - unset( $filters['mode'] ); |
|
| 789 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 790 | + unset( $filters[ 'mode' ] ); |
|
| 791 | 791 | |
| 792 | - $form = self::get_form( $entry['form_id'] ); |
|
| 792 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 793 | 793 | |
| 794 | 794 | foreach ( $filters as $filter ) { |
| 795 | 795 | |
| 796 | - if ( ! isset( $filter['key'] ) ) { |
|
| 796 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 797 | 797 | continue; |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - $k = $filter['key']; |
|
| 800 | + $k = $filter[ 'key' ]; |
|
| 801 | 801 | |
| 802 | 802 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 803 | 803 | $field_value = $entry[ $k ]; |
| 804 | 804 | $field = null; |
| 805 | 805 | } else { |
| 806 | 806 | $field = self::get_field( $form, $k ); |
| 807 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 807 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 811 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 810 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 811 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 812 | 812 | |
| 813 | 813 | // verify if we are already free to go! |
| 814 | 814 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -866,18 +866,18 @@ discard block |
||
| 866 | 866 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 867 | 867 | * @see GFCommon::format_date() for original code |
| 868 | 868 | */ |
| 869 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 869 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 870 | 870 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 871 | 871 | |
| 872 | - $format = rgar( $atts, 'format' ); |
|
| 873 | - $is_human = ! empty( $atts['human'] ); |
|
| 874 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 875 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 876 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 877 | - $include_time = ! empty( $atts['time'] ); |
|
| 872 | + $format = rgar( $atts, 'format' ); |
|
| 873 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 874 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 875 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 876 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 877 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 878 | 878 | |
| 879 | 879 | // If we're using time diff, we want to have a different default format |
| 880 | - if( empty( $format ) ) { |
|
| 880 | + if ( empty( $format ) ) { |
|
| 881 | 881 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
| 882 | 882 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 883 | 883 | } |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | // If raw was specified, don't modify the stored value |
| 886 | 886 | if ( $is_raw ) { |
| 887 | 887 | $formatted_date = $date_string; |
| 888 | - } elseif( $is_timestamp ) { |
|
| 888 | + } elseif ( $is_timestamp ) { |
|
| 889 | 889 | $formatted_date = $date_local_timestamp; |
| 890 | 890 | } elseif ( $is_diff ) { |
| 891 | 891 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | $field = self::get_field( $form, $field_id ); |
| 916 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
| 916 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; |
|
| 917 | 917 | |
| 918 | 918 | } |
| 919 | 919 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
| 932 | 932 | */ |
| 933 | 933 | public static function get_field( $form, $field_id ) { |
| 934 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 934 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 935 | 935 | return GFFormsModel::get_field( $form, $field_id ); |
| 936 | 936 | } else { |
| 937 | 937 | return null; |
@@ -978,19 +978,19 @@ discard block |
||
| 978 | 978 | $shortcodes = array(); |
| 979 | 979 | |
| 980 | 980 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 981 | - if ( empty( $matches ) ){ |
|
| 981 | + if ( empty( $matches ) ) { |
|
| 982 | 982 | return false; |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | foreach ( $matches as $shortcode ) { |
| 986 | - if ( $tag === $shortcode[2] ) { |
|
| 986 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 987 | 987 | |
| 988 | 988 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 989 | - $shortcodes[] = $shortcode; |
|
| 989 | + $shortcodes[ ] = $shortcode; |
|
| 990 | 990 | |
| 991 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 992 | - foreach( $results as $result ) { |
|
| 993 | - $shortcodes[] = $result; |
|
| 991 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 992 | + foreach ( $results as $result ) { |
|
| 993 | + $shortcodes[ ] = $result; |
|
| 994 | 994 | } |
| 995 | 995 | } |
| 996 | 996 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | * @return string html |
| 1142 | 1142 | */ |
| 1143 | 1143 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1144 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1144 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1145 | 1145 | |
| 1146 | 1146 | if ( empty( $formid ) ) { |
| 1147 | 1147 | return $output; |
@@ -1154,11 +1154,11 @@ discard block |
||
| 1154 | 1154 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1155 | 1155 | |
| 1156 | 1156 | foreach ( $fields as $id => $field ) { |
| 1157 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1157 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1158 | 1158 | continue; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1161 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1162 | 1162 | } |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1193,9 +1193,9 @@ discard block |
||
| 1193 | 1193 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1194 | 1194 | |
| 1195 | 1195 | // TODO: Convert to using array_filter |
| 1196 | - foreach( $fields as $id => $field ) { |
|
| 1196 | + foreach ( $fields as $id => $field ) { |
|
| 1197 | 1197 | |
| 1198 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1198 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1199 | 1199 | unset( $fields[ $id ] ); |
| 1200 | 1200 | } |
| 1201 | 1201 | } |
@@ -1236,14 +1236,14 @@ discard block |
||
| 1236 | 1236 | * @param int|array $field field key or field array |
| 1237 | 1237 | * @return boolean |
| 1238 | 1238 | */ |
| 1239 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1239 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1240 | 1240 | |
| 1241 | 1241 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1242 | 1242 | $form = self::get_form( $form ); |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | // If entry meta, it's a string. Otherwise, numeric |
| 1246 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1246 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1247 | 1247 | $type = $field; |
| 1248 | 1248 | } else { |
| 1249 | 1249 | $type = self::get_field_type( $form, $field ); |
@@ -1257,9 +1257,9 @@ discard block |
||
| 1257 | 1257 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1258 | 1258 | |
| 1259 | 1259 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1260 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1261 | - if( true === $gv_field->is_numeric ) { |
|
| 1262 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1260 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1261 | + if ( true === $gv_field->is_numeric ) { |
|
| 1262 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | |
@@ -1409,11 +1409,11 @@ discard block |
||
| 1409 | 1409 | $final_atts = array_filter( $final_atts ); |
| 1410 | 1410 | |
| 1411 | 1411 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1412 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1413 | - $final_atts['href'] = $href; |
|
| 1412 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1413 | + $final_atts[ 'href' ] = $href; |
|
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1416 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1417 | 1417 | |
| 1418 | 1418 | // Sort the attributes alphabetically, to help testing |
| 1419 | 1419 | ksort( $final_atts ); |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | - if( '' !== $output ) { |
|
| 1427 | + if ( '' !== $output ) { |
|
| 1428 | 1428 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
| 1429 | 1429 | } |
| 1430 | 1430 | |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1449 | 1449 | $merged = $array1; |
| 1450 | 1450 | |
| 1451 | - foreach ( $array2 as $key => &$value ) { |
|
| 1451 | + foreach ( $array2 as $key => &$value ) { |
|
| 1452 | 1452 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1453 | 1453 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1454 | 1454 | } else { |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1484 | 1484 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1485 | 1485 | */ |
| 1486 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1486 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1487 | 1487 | |
| 1488 | 1488 | return get_users( $get_users_settings ); |
| 1489 | 1489 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | * @return string |
| 1499 | 1499 | */ |
| 1500 | 1500 | public static function generate_notice( $notice, $class = '' ) { |
| 1501 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1501 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | |
@@ -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 | } |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | self::$notices['wp_version'] = array( |
| 205 | 205 | 'class' => 'error', |
| 206 | 206 | 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
| 207 | - 'cap' => 'update_core', |
|
| 207 | + 'cap' => 'update_core', |
|
| 208 | 208 | 'dismiss' => 'wp_version', |
| 209 | 209 | ); |
| 210 | 210 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @return GravityView_Compatibility |
| 77 | 77 | */ |
| 78 | 78 | public static function getInstance() { |
| 79 | - if( self::$instance ) { |
|
| 79 | + if ( self::$instance ) { |
|
| 80 | 80 | return self::$instance; |
| 81 | 81 | } |
| 82 | 82 | return new self; |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
| 124 | 124 | // show the notice, but not load any post types or process shortcodes. |
| 125 | 125 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
| 126 | - if( ! self::is_valid() ) { |
|
| 126 | + if ( ! self::is_valid() ) { |
|
| 127 | 127 | |
| 128 | 128 | // If the plugin's not loaded, might as well hide the shortcode for people. |
| 129 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
| 129 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
| 154 | 154 | |
| 155 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
| 155 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
| 156 | 156 | return null; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $notices = self::get_notices(); |
| 160 | 160 | |
| 161 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
| 162 | - foreach( (array)$notices as $notice ) { |
|
| 163 | - $message .= wpautop( $notice['message'] ); |
|
| 161 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
| 162 | + foreach ( (array)$notices as $notice ) { |
|
| 163 | + $message .= wpautop( $notice[ 'message' ] ); |
|
| 164 | 164 | } |
| 165 | 165 | $message .= '</div>'; |
| 166 | 166 | |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | * @return boolean |
| 176 | 176 | */ |
| 177 | 177 | public static function check_php() { |
| 178 | - if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) { |
|
| 178 | + if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) { |
|
| 179 | 179 | |
| 180 | - self::$notices['php_version'] = array( |
|
| 180 | + self::$notices[ 'php_version' ] = array( |
|
| 181 | 181 | 'class' => 'error', |
| 182 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
| 182 | + 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
| 183 | 183 | 'cap' => 'manage_options', |
| 184 | 184 | 'dismiss' => 'php_version', |
| 185 | 185 | ); |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | public static function check_wordpress() { |
| 200 | 200 | global $wp_version; |
| 201 | 201 | |
| 202 | - if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) { |
|
| 202 | + if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) { |
|
| 203 | 203 | |
| 204 | - self::$notices['wp_version'] = array( |
|
| 204 | + self::$notices[ 'wp_version' ] = array( |
|
| 205 | 205 | 'class' => 'error', |
| 206 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
| 206 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
| 207 | 207 | 'cap' => 'update_core', |
| 208 | 208 | 'dismiss' => 'wp_version', |
| 209 | 209 | ); |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | public static function check_gravityforms() { |
| 227 | 227 | |
| 228 | 228 | // Bypass other checks: if the class exists |
| 229 | - if( class_exists( 'GFCommon' ) ) { |
|
| 229 | + if ( class_exists( 'GFCommon' ) ) { |
|
| 230 | 230 | |
| 231 | 231 | // and the version's right, we're good. |
| 232 | - if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) { |
|
| 232 | + if ( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) { |
|
| 233 | 233 | return true; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Or the version's wrong |
| 237 | - self::$notices['gf_version'] = array( |
|
| 237 | + self::$notices[ 'gf_version' ] = array( |
|
| 238 | 238 | 'class' => 'error', |
| 239 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 239 | + 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
| 240 | 240 | 'cap' => 'update_plugins', |
| 241 | 241 | 'dismiss' => 'gf_version', |
| 242 | 242 | ); |
@@ -251,42 +251,42 @@ discard block |
||
| 251 | 251 | * OR |
| 252 | 252 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
| 253 | 253 | */ |
| 254 | - if( true === $gf_status || is_network_admin() ) { |
|
| 254 | + if ( true === $gf_status || is_network_admin() ) { |
|
| 255 | 255 | return true; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // If GFCommon doesn't exist, assume GF not active |
| 259 | 259 | $return = false; |
| 260 | 260 | |
| 261 | - switch( $gf_status ) { |
|
| 261 | + switch ( $gf_status ) { |
|
| 262 | 262 | case 'inactive': |
| 263 | 263 | |
| 264 | 264 | // Required for multisite |
| 265 | - if( ! function_exists('wp_create_nonce') ) { |
|
| 265 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
| 266 | 266 | require_once ABSPATH . WPINC . '/pluggable.php'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
| 270 | - if( is_multisite() ) { |
|
| 270 | + if ( is_multisite() ) { |
|
| 271 | 271 | wp_cookie_constants(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $return = false; |
| 275 | 275 | |
| 276 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
| 276 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
| 277 | 277 | |
| 278 | - self::$notices['gf_inactive'] = array( |
|
| 278 | + self::$notices[ 'gf_inactive' ] = array( |
|
| 279 | 279 | 'class' => 'error', |
| 280 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
| 280 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
| 281 | 281 | 'cap' => 'activate_plugins', |
| 282 | 282 | 'dismiss' => 'gf_inactive', |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | 285 | break; |
| 286 | 286 | default: |
| 287 | - self::$notices['gf_installed'] = array( |
|
| 287 | + self::$notices[ 'gf_installed' ] = array( |
|
| 288 | 288 | 'class' => 'error', |
| 289 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 289 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
| 290 | 290 | 'cap' => 'install_plugins', |
| 291 | 291 | 'dismiss' => 'gf_installed', |
| 292 | 292 | ); |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private static function check_gf_directory() { |
| 305 | 305 | |
| 306 | - if( class_exists( 'GFDirectory' ) ) { |
|
| 307 | - self::$notices['gf_directory'] = array( |
|
| 306 | + if ( class_exists( 'GFDirectory' ) ) { |
|
| 307 | + self::$notices[ 'gf_directory' ] = array( |
|
| 308 | 308 | 'class' => 'error is-dismissible', |
| 309 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
| 309 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
| 310 | 310 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
| 311 | 311 | 'dismiss' => 'gf_directory', |
| 312 | 312 | 'cap' => 'activate_plugins', |
@@ -325,21 +325,21 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public static function get_plugin_status( $location = '' ) { |
| 327 | 327 | |
| 328 | - if( ! function_exists('is_plugin_active') ) { |
|
| 328 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 329 | 329 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
| 332 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
| 333 | 333 | return true; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
| 336 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
| 337 | 337 | return true; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if( |
|
| 341 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
| 342 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
| 340 | + if ( |
|
| 341 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
| 342 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
| 343 | 343 | ) { |
| 344 | 344 | return false; |
| 345 | 345 | } |