@@ -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,20 +150,20 @@ discard block |
||
150 | 150 | include_once( $gv_field_filename ); |
151 | 151 | } |
152 | 152 | |
153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
154 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
155 | 155 | |
156 | 156 | // Load Extensions |
157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
160 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
158 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
160 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
161 | 161 | |
162 | 162 | // Load WordPress Widgets |
163 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
163 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
164 | 164 | |
165 | 165 | // Load GravityView Widgets |
166 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
166 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
167 | 167 | |
168 | 168 | // Add oEmbed |
169 | 169 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
178 | 178 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
182 | 182 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @return bool |
192 | 192 | */ |
193 | 193 | public static function is_network_activated() { |
194 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
194 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @since 1.7.5.1 |
257 | 257 | */ |
258 | 258 | public static function include_widget_class() { |
259 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
259 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | if ( ! $loaded ) { |
280 | 280 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
281 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
281 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
282 | 282 | load_textdomain( 'gravityview', $mofile ); |
283 | 283 | } |
284 | 284 | |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function frontend_actions( $force = false ) { |
311 | 311 | |
312 | - if( self::is_admin() && ! $force ) { return; } |
|
312 | + if ( self::is_admin() && ! $force ) { return; } |
|
313 | 313 | |
314 | 314 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
315 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
316 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
317 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
315 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
316 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
317 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
318 | 318 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
319 | 319 | |
320 | 320 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | */ |
340 | 340 | public static function get_default_widget_areas() { |
341 | 341 | $default_areas = array( |
342 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
343 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
342 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
343 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
344 | 344 | ); |
345 | 345 | |
346 | 346 | /** |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @param mixed $data Additional data to display |
359 | 359 | * @return void |
360 | 360 | */ |
361 | - public static function log_debug( $message, $data = null ){ |
|
361 | + public static function log_debug( $message, $data = null ) { |
|
362 | 362 | /** |
363 | 363 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
364 | 364 | * @param string $message Message to display |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @param string $message log message |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public static function log_error( $message, $data = null ){ |
|
375 | + public static function log_error( $message, $data = null ) { |
|
376 | 376 | /** |
377 | 377 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
378 | 378 | * @param string $message Error message to display |
@@ -383,4 +383,4 @@ discard block |
||
383 | 383 | |
384 | 384 | } // end class GravityView_Plugin |
385 | 385 | |
386 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
386 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) ); |
57 | 57 | add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 ); |
58 | 58 | add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 ); |
59 | - add_action( 'admin_init', array( $this, 'add_caps') ); |
|
59 | + add_action( 'admin_init', array( $this, 'add_caps') ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -360,7 +360,6 @@ discard block |
||
360 | 360 | * Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against. |
361 | 361 | * |
362 | 362 | * @since 1.15 |
363 | - |
|
364 | 363 | * @param array $caps_to_check |
365 | 364 | * |
366 | 365 | * @return array |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function get_instance() { |
35 | 35 | |
36 | - if( ! self::$instance ) { |
|
36 | + if ( ! self::$instance ) { |
|
37 | 37 | self::$instance = new self; |
38 | 38 | } |
39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) ); |
57 | 57 | add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 ); |
58 | 58 | add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 ); |
59 | - add_action( 'admin_init', array( $this, 'add_caps') ); |
|
59 | + add_action( 'admin_init', array( $this, 'add_caps' ) ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) { |
78 | 78 | |
79 | 79 | // Empty caps_to_check array |
80 | - if( ! $usercaps || ! $caps ) { |
|
80 | + if ( ! $usercaps || ! $caps ) { |
|
81 | 81 | return $usercaps; |
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled |
86 | 86 | */ |
87 | - if( ! empty( $usercaps['gravityview_full_access'] ) ) { |
|
87 | + if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) { |
|
88 | 88 | |
89 | 89 | $all_gravityview_caps = self::all_caps(); |
90 | 90 | |
91 | - foreach( $all_gravityview_caps as $gv_cap ) { |
|
91 | + foreach ( $all_gravityview_caps as $gv_cap ) { |
|
92 | 92 | $usercaps[ $gv_cap ] = true; |
93 | 93 | } |
94 | 94 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $all = $administrator; |
307 | 307 | |
308 | 308 | // If role is set, return caps_to_check for just that role. |
309 | - if( $single_role ) { |
|
309 | + if ( $single_role ) { |
|
310 | 310 | $caps = isset( ${$single_role} ) ? ${$single_role} : false; |
311 | 311 | return $flat_array ? $caps : array( $single_role => $caps ); |
312 | 312 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public static function has_cap( $caps_to_check = '', $object_id = null, $user_id = null ) { |
336 | 336 | |
337 | - if( ! is_user_logged_in() || empty( $caps_to_check ) ) { |
|
337 | + if ( ! is_user_logged_in() || empty( $caps_to_check ) ) { |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | $caps_to_check = self::maybe_add_full_access_caps( $caps_to_check ); |
345 | 345 | |
346 | 346 | foreach ( $caps_to_check as $cap ) { |
347 | - if( ! is_null( $object_id ) ) { |
|
347 | + if ( ! is_null( $object_id ) ) { |
|
348 | 348 | $has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id ); |
349 | 349 | } else { |
350 | 350 | $has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap ); |
351 | 351 | } |
352 | 352 | // At the first successful response, stop checking |
353 | - if( $has_cap ) { |
|
353 | + if ( $has_cap ) { |
|
354 | 354 | break; |
355 | 355 | } |
356 | 356 | } |
@@ -374,15 +374,15 @@ discard block |
||
374 | 374 | $all_gravityview_caps = self::all_caps(); |
375 | 375 | |
376 | 376 | // Are there any $caps_to_check that are from GravityView? |
377 | - if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
378 | - $caps_to_check[] = 'gravityview_full_access'; |
|
377 | + if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
378 | + $caps_to_check[ ] = 'gravityview_full_access'; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | $all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array(); |
382 | 382 | |
383 | 383 | // Are there any $caps_to_check that are from Gravity Forms? |
384 | - if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
385 | - $caps_to_check[] = 'gform_full_access'; |
|
384 | + if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
385 | + $caps_to_check[ ] = 'gform_full_access'; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | return array_unique( $caps_to_check ); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $capabilities = self::all_caps(); |
405 | 405 | |
406 | 406 | // Loop through each role and remove GV caps_to_check |
407 | - foreach( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
407 | + foreach ( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
408 | 408 | foreach ( $capabilities as $cap ) { |
409 | 409 | $wp_roles->remove_cap( $role_slug, $cap ); |
410 | 410 | } |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | |
147 | 147 | if( !empty( $field['custom_class'] ) ) { |
148 | 148 | |
149 | - $custom_class = $field['custom_class']; |
|
149 | + $custom_class = $field['custom_class']; |
|
150 | 150 | |
151 | - if( !empty( $entry ) ) { |
|
151 | + if( !empty( $entry ) ) { |
|
152 | 152 | |
153 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | - // replaced by a multiple-word value that should be output as a single class. |
|
155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
153 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
154 | + // replaced by a multiple-word value that should be output as a single class. |
|
155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
156 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
157 | 157 | |
158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
159 | 159 | |
160 | - // And then we want life to return to normal |
|
161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | - } |
|
160 | + // And then we want life to return to normal |
|
161 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | // And now we want the spaces to be handled nicely. |
165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | 'format' => $format, |
293 | 293 | 'entry' => $entry, |
294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
295 | - 'field_path' => $field_path, /** {@since 1.16} */ |
|
295 | + 'field_path' => $field_path, /** {@since 1.16} */ |
|
296 | 296 | )); |
297 | 297 | |
298 | 298 | if( ! empty( $field_path ) ) { |
@@ -603,29 +603,29 @@ discard block |
||
603 | 603 | return sanitize_title( $slug ); |
604 | 604 | } |
605 | 605 | |
606 | - /** |
|
607 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | - * |
|
609 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | - * |
|
611 | - * @param $entry array Gravity Forms entry object |
|
612 | - * @param $form array Gravity Forms form object |
|
613 | - */ |
|
614 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | - /** |
|
616 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | - * @param boolean $custom Should we process the custom entry slug? |
|
618 | - */ |
|
619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | - if( $custom ) { |
|
621 | - // create the gravityview_unique_id and save it |
|
606 | + /** |
|
607 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
608 | + * |
|
609 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
610 | + * |
|
611 | + * @param $entry array Gravity Forms entry object |
|
612 | + * @param $form array Gravity Forms form object |
|
613 | + */ |
|
614 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
615 | + /** |
|
616 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
617 | + * @param boolean $custom Should we process the custom entry slug? |
|
618 | + */ |
|
619 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
620 | + if( $custom ) { |
|
621 | + // create the gravityview_unique_id and save it |
|
622 | 622 | |
623 | - // Get the entry hash |
|
624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
623 | + // Get the entry hash |
|
624 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
625 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
626 | 626 | |
627 | - } |
|
628 | - } |
|
627 | + } |
|
628 | + } |
|
629 | 629 | |
630 | 630 | |
631 | 631 | |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | |
890 | 890 | // If there was an error, continue to the next term. |
891 | 891 | if ( is_wp_error( $term_link ) ) { |
892 | - continue; |
|
892 | + continue; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -11,10 +11,10 @@ |
||
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="gv-search-box gv-search-date"> |
14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
16 | 16 | <?php } ?> |
17 | 17 | <p> |
18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
19 | 19 | </p> |
20 | 20 | </div> |
21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <div class="gv-search-box gv-search-field-text"> |
13 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
15 | 15 | <?php } ?> |
16 | 16 | <p> |
17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
18 | 18 | </p> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -40,11 +40,11 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | $field_options['link_phone'] = array( |
43 | - 'type' => 'checkbox', |
|
44 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
46 | - 'value' => true, |
|
47 | - ); |
|
43 | + 'type' => 'checkbox', |
|
44 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
46 | + 'value' => true, |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | return $field_options; |
50 | 50 | } |
@@ -35,14 +35,14 @@ |
||
35 | 35 | */ |
36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
37 | 37 | |
38 | - if( 'edit' === $context ) { |
|
38 | + if ( 'edit' === $context ) { |
|
39 | 39 | return $field_options; |
40 | 40 | } |
41 | 41 | |
42 | - $field_options['link_phone'] = array( |
|
42 | + $field_options[ 'link_phone' ] = array( |
|
43 | 43 | 'type' => 'checkbox', |
44 | 44 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
46 | 46 | 'value' => true, |
47 | 47 | ); |
48 | 48 |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | $base_url = GravityView_Widget_Search::get_search_form_action(); |
14 | 14 | |
15 | 15 | // Make sure that there are choices to display |
16 | -if ( empty( $search_field['choices'] ) ) { |
|
16 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
17 | 17 | do_action( 'gravityview_log_debug', 'search-field-link.php - No choices for field' ); |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | -$links_label = empty( $search_field['label'] ) ? __( 'Show only:', 'gravityview' ) : $search_field['label']; |
|
21 | +$links_label = empty( $search_field[ 'label' ] ) ? __( 'Show only:', 'gravityview' ) : $search_field[ 'label' ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @filter `gravityview/extension/search/links_sep` Change the label for the "Link" search bar input type |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | |
43 | 43 | <?php |
44 | 44 | |
45 | - $search_value = rgget( $search_field['name'] ); |
|
45 | + $search_value = rgget( $search_field[ 'name' ] ); |
|
46 | 46 | |
47 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
47 | + foreach ( $search_field[ 'choices' ] as $k => $choice ) { |
|
48 | 48 | |
49 | 49 | if ( 0 != $k ) { |
50 | 50 | echo esc_html( $links_sep ); |
51 | 51 | } |
52 | 52 | |
53 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
53 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice[ 'text' ], $choice[ 'value' ] ) ) ) ? ' class="active"' : false; |
|
54 | 54 | |
55 | 55 | if ( $active ) { |
56 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
56 | + $link = remove_query_arg( array( 'pagenum', $search_field[ 'name' ] ), $base_url ); |
|
57 | 57 | } else { |
58 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
58 | + $link = add_query_arg( array( $search_field[ 'name' ] => urlencode( $choice[ 'value' ] ) ), remove_query_arg( array( 'pagenum' ), $base_url ) ); |
|
59 | 59 | } |
60 | 60 | ?> |
61 | 61 | |
62 | - <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
|
62 | + <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice[ 'text' ] ); ?></a> |
|
63 | 63 | |
64 | 64 | <?php } ?> |
65 | 65 | </p> |
@@ -673,11 +673,11 @@ discard block |
||
673 | 673 | /** |
674 | 674 | * @since 1.7.2 |
675 | 675 | */ |
676 | - 'other_entries' => array( |
|
677 | - 'label' => __('Other Entries', 'gravityview'), |
|
678 | - 'type' => 'other_entries', |
|
679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
680 | - ), |
|
676 | + 'other_entries' => array( |
|
677 | + 'label' => __('Other Entries', 'gravityview'), |
|
678 | + 'type' => 'other_entries', |
|
679 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
680 | + ), |
|
681 | 681 | |
682 | 682 | /** |
683 | 683 | * @since 1.14 |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | 'type' => 'notes', |
688 | 688 | 'desc' => __('Entry notes (if any).', 'gravityview'), |
689 | 689 | ), |
690 | - ); |
|
690 | + ); |
|
691 | 691 | |
692 | 692 | if( 'single' !== $zone) { |
693 | 693 | |
@@ -1022,15 +1022,15 @@ discard block |
||
1022 | 1022 | GFForms::register_scripts(); |
1023 | 1023 | |
1024 | 1024 | $scripts = array( |
1025 | - 'sack', |
|
1026 | - 'gform_gravityforms', |
|
1027 | - 'gform_forms', |
|
1028 | - 'gform_form_admin', |
|
1029 | - 'jquery-ui-autocomplete' |
|
1025 | + 'sack', |
|
1026 | + 'gform_gravityforms', |
|
1027 | + 'gform_forms', |
|
1028 | + 'gform_form_admin', |
|
1029 | + 'jquery-ui-autocomplete' |
|
1030 | 1030 | ); |
1031 | 1031 | |
1032 | 1032 | if ( wp_is_mobile() ) { |
1033 | - $scripts[] = 'jquery-touch-punch'; |
|
1033 | + $scripts[] = 'jquery-touch-punch'; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | foreach ($scripts as $script) { |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | return $menu_items; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $sub_menu_items = array(); |
142 | 142 | foreach ( (array)$connected_views as $view ) { |
143 | 143 | |
144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
149 | 149 | |
150 | - $sub_menu_items[] = array( |
|
150 | + $sub_menu_items[ ] = array( |
|
151 | 151 | 'label' => esc_attr( $label ), |
152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | // If there were no items added, then let's create the parent menu |
157 | - if( $sub_menu_items ) { |
|
157 | + if ( $sub_menu_items ) { |
|
158 | 158 | |
159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
160 | - $sub_menu_items[] = array( |
|
160 | + $sub_menu_items[ ] = array( |
|
161 | 161 | 'url' => '#', |
162 | 162 | 'label' => '', |
163 | 163 | 'menu_class' => 'hidden', |
164 | 164 | 'capabilities' => '', |
165 | 165 | ); |
166 | 166 | |
167 | - $menu_items['gravityview'] = array( |
|
167 | + $menu_items[ 'gravityview' ] = array( |
|
168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $add = array( 'captcha', 'page' ); |
195 | 195 | |
196 | 196 | // Don't allowing editing the following values: |
197 | - if( $context === 'edit' ) { |
|
198 | - $add[] = 'post_id'; |
|
197 | + if ( $context === 'edit' ) { |
|
198 | + $add[ ] = 'post_id'; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
218 | 218 | foreach ( $default_args as $key => $arg ) { |
219 | 219 | |
220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
222 | 222 | |
223 | 223 | // By default, use `tooltip` if defined. |
224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
225 | 225 | |
226 | 226 | // Otherwise, use the description as a tooltip. |
227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
228 | - $tooltip = $arg['desc']; |
|
227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
228 | + $tooltip = $arg[ 'desc' ]; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // If there's no tooltip set, continue |
232 | - if( empty( $tooltip ) ) { |
|
232 | + if ( empty( $tooltip ) ) { |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add the tooltip |
237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
238 | - 'title' => $arg['label'], |
|
237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
238 | + 'title' => $arg[ 'label' ], |
|
239 | 239 | 'value' => $tooltip, |
240 | 240 | ); |
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
256 | 256 | |
257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
258 | 258 | |
259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
294 | 294 | |
295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
296 | 296 | |
297 | 297 | break; |
298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
334 | 334 | |
335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
336 | - if( empty( $form ) ) { |
|
336 | + if ( empty( $form ) ) { |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // The $form is passed as the form ID |
341 | - if( !is_array( $form ) ) { |
|
341 | + if ( ! is_array( $form ) ) { |
|
342 | 342 | $form = gravityview_get_form( $form ); |
343 | 343 | } |
344 | 344 | |
345 | - $form_id = $form['id']; |
|
345 | + $form_id = $form[ 'id' ]; |
|
346 | 346 | $links = array(); |
347 | 347 | |
348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
352 | 352 | } else { |
353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
354 | 354 | } |
355 | 355 | |
356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = ''; |
372 | 372 | |
373 | - if( !empty( $include_form_link ) ) { |
|
373 | + if ( ! empty( $include_form_link ) ) { |
|
374 | 374 | $output .= $form_link; |
375 | 375 | } |
376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
384 | 384 | |
385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
386 | 386 | |
387 | 387 | return $output; |
388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | // Get the date column and save it for later to add back in. |
397 | 397 | // This adds it after the Data Source column. |
398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
399 | - $date = $columns['date']; |
|
400 | - unset( $columns['date'] ); |
|
399 | + $date = $columns[ 'date' ]; |
|
400 | + unset( $columns[ 'date' ] ); |
|
401 | 401 | |
402 | 402 | $data_source_required_caps = array( |
403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | 'gravityforms_preview_forms', |
409 | 409 | ); |
410 | 410 | |
411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
413 | 413 | } |
414 | 414 | |
415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
416 | 416 | |
417 | 417 | // Add the date back in. |
418 | - $columns['date'] = $date; |
|
418 | + $columns[ 'date' ] = $date; |
|
419 | 419 | |
420 | 420 | return $columns; |
421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function save_postdata( $post_id ) { |
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | // validate post_type |
437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,67 +449,67 @@ discard block |
||
449 | 449 | $statii = array(); |
450 | 450 | |
451 | 451 | // check if this is a start fresh View |
452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
453 | 453 | |
454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
455 | 455 | // save form id |
456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
457 | 457 | |
458 | 458 | } |
459 | 459 | |
460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Was this a start fresh? |
466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
468 | 468 | } else { |
469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Check if we have a template id |
473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
474 | 474 | |
475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
476 | 476 | |
477 | 477 | // now save template id |
478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | // save View Configuration metabox |
483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
484 | 484 | |
485 | 485 | // template settings |
486 | - if( empty( $_POST['template_settings'] ) ) { |
|
487 | - $_POST['template_settings'] = array(); |
|
486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
487 | + $_POST[ 'template_settings' ] = array(); |
|
488 | 488 | } |
489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
490 | 490 | |
491 | 491 | $fields = array(); |
492 | 492 | |
493 | 493 | // Directory&single Visible Fields |
494 | - if( !empty( $preset_fields ) ) { |
|
494 | + if ( ! empty( $preset_fields ) ) { |
|
495 | 495 | |
496 | 496 | $fields = $preset_fields; |
497 | 497 | |
498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
499 | 499 | $fields = _gravityview_process_posted_fields(); |
500 | 500 | } |
501 | 501 | |
502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
503 | 503 | |
504 | 504 | // Directory Visible Widgets |
505 | - if( empty( $_POST['widgets'] ) ) { |
|
506 | - $_POST['widgets'] = array(); |
|
505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
506 | + $_POST[ 'widgets' ] = array(); |
|
507 | 507 | } |
508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
509 | 509 | |
510 | 510 | } // end save view configuration |
511 | 511 | |
512 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
512 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -541,20 +541,20 @@ discard block |
||
541 | 541 | |
542 | 542 | $output = ''; |
543 | 543 | |
544 | - if( !empty( $fields ) ) { |
|
544 | + if ( ! empty( $fields ) ) { |
|
545 | 545 | |
546 | - foreach( $fields as $id => $details ) { |
|
546 | + foreach ( $fields as $id => $details ) { |
|
547 | 547 | |
548 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
548 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
549 | 549 | continue; |
550 | 550 | } |
551 | 551 | |
552 | 552 | // Edit mode only allows editing the parent fields, not single inputs. |
553 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
553 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
554 | 554 | continue; |
555 | 555 | } |
556 | 556 | |
557 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
557 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
558 | 558 | |
559 | 559 | } // End foreach |
560 | 560 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | echo $output; |
563 | 563 | |
564 | 564 | // For the EDIT view we only want to allow the form fields. |
565 | - if( $context === 'edit' ) { |
|
565 | + if ( $context === 'edit' ) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
@@ -586,16 +586,16 @@ discard block |
||
586 | 586 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
587 | 587 | array( |
588 | 588 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
589 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
589 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
590 | 590 | 'field_id' => 'all-fields', |
591 | 591 | 'label_type' => 'field', |
592 | 592 | 'input_type' => NULL, |
593 | 593 | 'field_options' => NULL, |
594 | 594 | 'settings_html' => NULL, |
595 | 595 | ) |
596 | - )); |
|
596 | + ) ); |
|
597 | 597 | |
598 | - if( !empty( $additional_fields )) { |
|
598 | + if ( ! empty( $additional_fields ) ) { |
|
599 | 599 | foreach ( (array)$additional_fields as $item ) { |
600 | 600 | |
601 | 601 | // Prevent items from not having index set |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | 'input_type' => NULL, |
607 | 607 | 'field_options' => NULL, |
608 | 608 | 'settings_html' => NULL, |
609 | - )); |
|
609 | + ) ); |
|
610 | 610 | |
611 | 611 | // Backward compat. |
612 | - if( !empty( $item['field_options'] ) ) { |
|
612 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
613 | 613 | // Use settings_html from now on. |
614 | - $item['settings_html'] = $item['field_options']; |
|
614 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | // Render a label for each of them |
618 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
618 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | } |
@@ -628,72 +628,72 @@ discard block |
||
628 | 628 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
629 | 629 | * @return array |
630 | 630 | */ |
631 | - function get_entry_default_fields($form, $zone) { |
|
631 | + function get_entry_default_fields( $form, $zone ) { |
|
632 | 632 | |
633 | 633 | $entry_default_fields = array(); |
634 | 634 | |
635 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
635 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
636 | 636 | |
637 | 637 | $entry_default_fields = array( |
638 | 638 | 'id' => array( |
639 | - 'label' => __('Entry ID', 'gravityview'), |
|
639 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
640 | 640 | 'type' => 'id', |
641 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
641 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
642 | 642 | ), |
643 | 643 | 'date_created' => array( |
644 | - 'label' => __('Entry Date', 'gravityview'), |
|
645 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
644 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
645 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
646 | 646 | 'type' => 'date_created', |
647 | 647 | ), |
648 | 648 | 'source_url' => array( |
649 | - 'label' => __('Source URL', 'gravityview'), |
|
649 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
650 | 650 | 'type' => 'source_url', |
651 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
651 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
652 | 652 | ), |
653 | 653 | 'ip' => array( |
654 | - 'label' => __('User IP', 'gravityview'), |
|
654 | + 'label' => __( 'User IP', 'gravityview' ), |
|
655 | 655 | 'type' => 'ip', |
656 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
656 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
657 | 657 | ), |
658 | 658 | 'created_by' => array( |
659 | - 'label' => __('User', 'gravityview'), |
|
659 | + 'label' => __( 'User', 'gravityview' ), |
|
660 | 660 | 'type' => 'created_by', |
661 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
661 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
662 | 662 | ), |
663 | 663 | |
664 | 664 | /** |
665 | 665 | * @since 1.2 |
666 | 666 | */ |
667 | 667 | 'custom' => array( |
668 | - 'label' => __('Custom Content', 'gravityview'), |
|
668 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
669 | 669 | 'type' => 'custom', |
670 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
670 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
671 | 671 | ), |
672 | 672 | |
673 | 673 | /** |
674 | 674 | * @since 1.7.2 |
675 | 675 | */ |
676 | 676 | 'other_entries' => array( |
677 | - 'label' => __('Other Entries', 'gravityview'), |
|
677 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
678 | 678 | 'type' => 'other_entries', |
679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
679 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
680 | 680 | ), |
681 | 681 | |
682 | 682 | /** |
683 | 683 | * @since 1.14 |
684 | 684 | */ |
685 | 685 | 'notes' => array( |
686 | - 'label' => __('Entry Notes', 'gravityview'), |
|
686 | + 'label' => __( 'Entry Notes', 'gravityview' ), |
|
687 | 687 | 'type' => 'notes', |
688 | - 'desc' => __('Entry notes (if any).', 'gravityview'), |
|
688 | + 'desc' => __( 'Entry notes (if any).', 'gravityview' ), |
|
689 | 689 | ), |
690 | 690 | ); |
691 | 691 | |
692 | - if( 'single' !== $zone) { |
|
692 | + if ( 'single' !== $zone ) { |
|
693 | 693 | |
694 | - $entry_default_fields['entry_link'] = array( |
|
695 | - 'label' => __('Link to Entry', 'gravityview'), |
|
696 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
694 | + $entry_default_fields[ 'entry_link' ] = array( |
|
695 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
696 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
697 | 697 | 'type' => 'entry_link', |
698 | 698 | ); |
699 | 699 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @param string|array $form form_ID or form object |
708 | 708 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
709 | 709 | */ |
710 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
710 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | function get_available_fields( $form = '', $zone = NULL ) { |
720 | 720 | |
721 | - if( empty( $form ) ) { |
|
721 | + if ( empty( $form ) ) { |
|
722 | 722 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
723 | 723 | return array(); |
724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $fields = gravityview_get_form_fields( $form, true ); |
728 | 728 | |
729 | 729 | // get meta fields ( only if form was already created ) |
730 | - if( !is_array( $form ) ) { |
|
730 | + if ( ! is_array( $form ) ) { |
|
731 | 731 | $meta_fields = gravityview_get_entry_meta( $form ); |
732 | 732 | } else { |
733 | 733 | $meta_fields = array(); |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | |
752 | 752 | $widgets = $this->get_registered_widgets(); |
753 | 753 | |
754 | - if( !empty( $widgets ) ) { |
|
754 | + if ( ! empty( $widgets ) ) { |
|
755 | 755 | |
756 | - foreach( $widgets as $id => $details ) { |
|
756 | + foreach ( $widgets as $id => $details ) { |
|
757 | 757 | |
758 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
758 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
759 | 759 | |
760 | 760 | } |
761 | 761 | } |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
790 | 790 | global $post; |
791 | 791 | |
792 | - if( $type === 'widget' ) { |
|
792 | + if ( $type === 'widget' ) { |
|
793 | 793 | $button_label = __( 'Add Widget', 'gravityview' ); |
794 | 794 | } else { |
795 | 795 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | $available_items = array(); |
799 | 799 | |
800 | 800 | // if saved values, get available fields to label everyone |
801 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
801 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
802 | 802 | |
803 | - if( !empty( $_POST['template_id'] ) ) { |
|
804 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
803 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
804 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
805 | 805 | } else { |
806 | 806 | $form = gravityview_get_form_id( $post->ID ); |
807 | 807 | } |
808 | 808 | |
809 | - if( 'field' === $type ) { |
|
809 | + if ( 'field' === $type ) { |
|
810 | 810 | $available_items = $this->get_available_fields( $form, $zone ); |
811 | 811 | } else { |
812 | 812 | $available_items = $this->get_registered_widgets(); |
@@ -814,39 +814,39 @@ discard block |
||
814 | 814 | |
815 | 815 | } |
816 | 816 | |
817 | - foreach( $rows as $row ) : |
|
818 | - foreach( $row as $col => $areas ) : |
|
819 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
817 | + foreach ( $rows as $row ) : |
|
818 | + foreach ( $row as $col => $areas ) : |
|
819 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
820 | 820 | |
821 | 821 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
822 | 822 | |
823 | - <?php foreach( $areas as $area ) : ?> |
|
823 | + <?php foreach ( $areas as $area ) : ?> |
|
824 | 824 | |
825 | 825 | <div class="gv-droppable-area"> |
826 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
826 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
827 | 827 | |
828 | 828 | <?php // render saved fields |
829 | 829 | |
830 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
830 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
831 | 831 | |
832 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
832 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
833 | 833 | |
834 | 834 | $input_type = NULL; |
835 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
835 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
836 | 836 | |
837 | - if( !$original_item ) { |
|
837 | + if ( ! $original_item ) { |
|
838 | 838 | |
839 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
839 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
840 | 840 | |
841 | 841 | $original_item = $field; |
842 | 842 | } else { |
843 | 843 | |
844 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
844 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
845 | 845 | |
846 | 846 | } |
847 | 847 | |
848 | 848 | // Field options dialog box |
849 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
849 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
850 | 850 | |
851 | 851 | $item = array( |
852 | 852 | 'input_type' => $input_type, |
@@ -855,16 +855,16 @@ discard block |
||
855 | 855 | ); |
856 | 856 | |
857 | 857 | // Merge the values with the current item to pass things like widget descriptions and original field names |
858 | - if( $original_item ) { |
|
858 | + if ( $original_item ) { |
|
859 | 859 | $item = wp_parse_args( $item, $original_item ); |
860 | 860 | } |
861 | 861 | |
862 | - switch( $type ) { |
|
862 | + switch ( $type ) { |
|
863 | 863 | case 'widget': |
864 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
864 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
865 | 865 | break; |
866 | 866 | default: |
867 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
867 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | |
@@ -874,11 +874,11 @@ discard block |
||
874 | 874 | |
875 | 875 | } // End if zone is not empty ?> |
876 | 876 | |
877 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
877 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
878 | 878 | </div> |
879 | 879 | <div class="gv-droppable-area-action"> |
880 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
881 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
880 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
881 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
882 | 882 | </div> |
883 | 883 | </div> |
884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
901 | 901 | |
902 | 902 | $widgets = array(); |
903 | - if( !empty( $post_id ) ) { |
|
903 | + if ( ! empty( $post_id ) ) { |
|
904 | 904 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
905 | 905 | |
906 | 906 | } |
@@ -931,19 +931,19 @@ discard block |
||
931 | 931 | */ |
932 | 932 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
933 | 933 | |
934 | - if( empty( $template_id ) ) { |
|
934 | + if ( empty( $template_id ) ) { |
|
935 | 935 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
936 | 936 | return; |
937 | 937 | } |
938 | 938 | |
939 | 939 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
940 | 940 | |
941 | - if( empty( $template_areas ) ) { |
|
941 | + if ( empty( $template_areas ) ) { |
|
942 | 942 | |
943 | 943 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
944 | 944 | $output = '<div>'; |
945 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
946 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
945 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
946 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
947 | 947 | $output .= '</div>'; |
948 | 948 | } else { |
949 | 949 | |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | } |
960 | 960 | |
961 | - if( $echo ) { |
|
961 | + if ( $echo ) { |
|
962 | 962 | echo $output; |
963 | 963 | } |
964 | 964 | |
@@ -978,25 +978,25 @@ discard block |
||
978 | 978 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
979 | 979 | |
980 | 980 | // Add the GV font (with the Astronaut) |
981 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
981 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
982 | 982 | |
983 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
983 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
984 | 984 | |
985 | 985 | // Don't process any scripts below here if it's not a GravityView page. |
986 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
986 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
987 | 987 | |
988 | 988 | // Only enqueue the following on single pages |
989 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
989 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
990 | 990 | |
991 | 991 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
992 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
992 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
993 | 993 | |
994 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
994 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
995 | 995 | |
996 | 996 | //enqueue scripts |
997 | 997 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
998 | 998 | |
999 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
999 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1000 | 1000 | 'cookiepath' => COOKIEPATH, |
1001 | 1001 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1002 | 1002 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1009,9 +1009,9 @@ discard block |
||
1009 | 1009 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1010 | 1010 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1011 | 1011 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1012 | - )); |
|
1012 | + ) ); |
|
1013 | 1013 | |
1014 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1014 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1015 | 1015 | |
1016 | 1016 | self::enqueue_gravity_forms_scripts(); |
1017 | 1017 | |
@@ -1030,10 +1030,10 @@ discard block |
||
1030 | 1030 | ); |
1031 | 1031 | |
1032 | 1032 | if ( wp_is_mobile() ) { |
1033 | - $scripts[] = 'jquery-touch-punch'; |
|
1033 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | - foreach ($scripts as $script) { |
|
1036 | + foreach ( $scripts as $script ) { |
|
1037 | 1037 | wp_enqueue_script( $script ); |
1038 | 1038 | } |
1039 | 1039 | } |
@@ -1042,11 +1042,11 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | $filter = current_filter(); |
1044 | 1044 | |
1045 | - if( preg_match('/script/ism', $filter ) ) { |
|
1045 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
1046 | 1046 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
1047 | 1047 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
1048 | 1048 | $registered = array_merge( $registered, $allow_scripts ); |
1049 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1049 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
1050 | 1050 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
1051 | 1051 | $registered = array_merge( $registered, $allow_styles ); |
1052 | 1052 | } |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * |
124 | 124 | * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes |
125 | 125 | * |
126 | - * @since 1.17 |
|
126 | + * @since 1.17 |
|
127 | 127 | * |
128 | 128 | * @see process_delete_notes |
129 | 129 | * |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @param array $file_paths List of template paths ordered |
318 | 318 | * |
319 | - * @return array File paths with `./` and `./partials/` paths added |
|
319 | + * @return string[] File paths with `./` and `./partials/` paths added |
|
320 | 320 | */ |
321 | 321 | public function add_template_path( $file_paths ) { |
322 | 322 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param array $entry |
486 | 486 | * @param array $data Note details array |
487 | 487 | * |
488 | - * @return int|WP_Error |
|
488 | + * @return integer |
|
489 | 489 | */ |
490 | 490 | private function add_note( $entry, $data ) { |
491 | 491 | global $current_user, $wpdb; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @since 1.17 |
586 | 586 | * |
587 | - * @param int|string $entry_slug Current entry unique ID |
|
587 | + * @param string $entry_slug Current entry unique ID |
|
588 | 588 | * |
589 | 589 | * @return string HTML output |
590 | 590 | */ |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | |
64 | 64 | add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) ); |
65 | 65 | |
66 | - add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 ); |
|
67 | - add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
68 | - add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
66 | + add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 ); |
|
67 | + add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
68 | + add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
69 | 69 | |
70 | - add_action( 'wp', array( $this, 'maybe_add_note'), 1000 ); |
|
71 | - add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') ); |
|
72 | - add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') ); |
|
70 | + add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 ); |
|
71 | + add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
72 | + add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
73 | 73 | |
74 | 74 | // add template path to check for field |
75 | 75 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
76 | 76 | |
77 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
77 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
78 | 78 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); |
79 | 79 | } |
80 | 80 | |
@@ -100,23 +100,23 @@ discard block |
||
100 | 100 | public function enqueue_scripts() { |
101 | 101 | global $wp_actions; |
102 | 102 | |
103 | - if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
103 | + if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
104 | 104 | wp_enqueue_style( 'gravityview-notes' ); |
105 | 105 | wp_enqueue_script( 'gravityview-notes' ); |
106 | 106 | } |
107 | 107 | |
108 | - if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
108 | + if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
109 | 109 | |
110 | 110 | $strings = self::strings(); |
111 | 111 | |
112 | 112 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( |
113 | 113 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
114 | 114 | 'text' => array( |
115 | - 'processing' => $strings['processing'], |
|
116 | - 'delete_confirm' => $strings['delete-confirm'], |
|
117 | - 'note_added' => $strings['added-note'], |
|
118 | - 'error_invalid' => $strings['error-invalid'], |
|
119 | - 'error_empty_note' => $strings['error-empty-note'], |
|
115 | + 'processing' => $strings[ 'processing' ], |
|
116 | + 'delete_confirm' => $strings[ 'delete-confirm' ], |
|
117 | + 'note_added' => $strings[ 'added-note' ], |
|
118 | + 'error_invalid' => $strings[ 'error-invalid' ], |
|
119 | + 'error_empty_note' => $strings[ 'error-empty-note' ], |
|
120 | 120 | ), |
121 | 121 | ) ); |
122 | 122 | } |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function maybe_add_note() { |
135 | 135 | |
136 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
136 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
137 | 137 | do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if( 'gv_note_add' === rgpost('action') ) { |
|
141 | + if ( 'gv_note_add' === rgpost( 'action' ) ) { |
|
142 | 142 | |
143 | 143 | $post = wp_unslash( $_POST ); |
144 | 144 | |
145 | - if( $this->doing_ajax ) { |
|
146 | - parse_str( $post['data'], $data ); |
|
145 | + if ( $this->doing_ajax ) { |
|
146 | + parse_str( $post[ 'data' ], $data ); |
|
147 | 147 | } else { |
148 | 148 | $data = $post; |
149 | 149 | } |
150 | 150 | |
151 | - $this->process_add_note( (array) $data ); |
|
151 | + $this->process_add_note( (array)$data ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -175,23 +175,23 @@ discard block |
||
175 | 175 | $error = false; |
176 | 176 | $success = false; |
177 | 177 | |
178 | - if( empty( $data['entry-slug'] ) ) { |
|
178 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
179 | 179 | |
180 | - $error = self::strings('error-invalid'); |
|
180 | + $error = self::strings( 'error-invalid' ); |
|
181 | 181 | do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' ); |
182 | 182 | |
183 | 183 | } else { |
184 | 184 | |
185 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
185 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
186 | 186 | |
187 | 187 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
188 | 188 | |
189 | - if( ! $has_cap ) { |
|
189 | + if ( ! $has_cap ) { |
|
190 | 190 | $error = self::strings( 'error-cap-add' ); |
191 | 191 | do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
192 | 192 | } elseif ( $valid ) { |
193 | 193 | |
194 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
194 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
195 | 195 | |
196 | 196 | $added = $this->add_note( $entry, $data ); |
197 | 197 | |
@@ -209,22 +209,22 @@ discard block |
||
209 | 209 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
210 | 210 | |
211 | 211 | if ( $note ) { |
212 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
213 | - do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') ); |
|
212 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
213 | + do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) ); |
|
214 | 214 | } else { |
215 | - $error = self::strings('error-add-note'); |
|
216 | - do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') ); |
|
215 | + $error = self::strings( 'error-add-note' ); |
|
216 | + do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) ); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } else { |
220 | - $error = self::strings('error-invalid'); |
|
220 | + $error = self::strings( 'error-invalid' ); |
|
221 | 221 | do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' ); |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | - if( $this->doing_ajax ) { |
|
227 | - if( $success ) { |
|
226 | + if ( $this->doing_ajax ) { |
|
227 | + if ( $success ) { |
|
228 | 228 | wp_send_json_success( array( 'html' => $success ) ); |
229 | 229 | } else { |
230 | 230 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
253 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
254 | 254 | |
255 | 255 | $post = wp_unslash( $_POST ); |
256 | 256 | if ( $this->doing_ajax ) { |
257 | - parse_str( $post['data'], $data ); |
|
257 | + parse_str( $post[ 'data' ], $data ); |
|
258 | 258 | } else { |
259 | 259 | $data = $post; |
260 | 260 | } |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | */ |
286 | 286 | function process_delete_notes( $data ) { |
287 | 287 | |
288 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
288 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
289 | 289 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
290 | 290 | $success = false; |
291 | 291 | |
292 | 292 | if ( $valid && $has_cap ) { |
293 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
293 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
294 | 294 | $success = true; |
295 | 295 | } |
296 | 296 | |
297 | - if( $this->doing_ajax ) { |
|
297 | + if ( $this->doing_ajax ) { |
|
298 | 298 | |
299 | - if( $success ) { |
|
299 | + if ( $success ) { |
|
300 | 300 | wp_send_json_success(); |
301 | 301 | } else { |
302 | 302 | if ( ! $valid ) { |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | |
330 | 330 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
331 | 331 | |
332 | - unset( $field_options['show_as_link'] ); |
|
332 | + unset( $field_options[ 'show_as_link' ] ); |
|
333 | 333 | |
334 | 334 | $notes_options = array( |
335 | 335 | 'notes' => array( |
336 | 336 | 'type' => 'checkboxes', |
337 | - 'label' => __('Note Settings', 'gravityview'), |
|
338 | - 'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
337 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
338 | + 'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
339 | 339 | 'options' => array( |
340 | 340 | 'view' => array( |
341 | 341 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'processing' => __( 'Processing…', 'gravityview' ), |
388 | 388 | 'other-email' => __( 'Other email address', 'gravityview' ), |
389 | 389 | 'email-label' => __( 'Email address', 'gravityview' ), |
390 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
390 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
391 | 391 | 'subject-label' => __( 'Subject', 'gravityview' ), |
392 | 392 | 'subject' => __( 'Email subject', 'gravityview' ), |
393 | 393 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
408 | 408 | |
409 | - if( $key ) { |
|
409 | + if ( $key ) { |
|
410 | 410 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
411 | 411 | } |
412 | 412 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | static public function display_note( $note, $show_delete = false ) { |
427 | 427 | |
428 | - if( ! is_object( $note ) ) { |
|
428 | + if ( ! is_object( $note ) ) { |
|
429 | 429 | return ''; |
430 | 430 | } |
431 | 431 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $note_row = ob_get_clean(); |
467 | 467 | |
468 | 468 | $replacements = array( |
469 | - '{note_id}' => $note_content['note_id'], |
|
469 | + '{note_id}' => $note_content[ 'note_id' ], |
|
470 | 470 | '{row_class}' => 'gv-note', |
471 | 471 | '{note_detail}' => $note_detail_html |
472 | 472 | ); |
@@ -498,13 +498,13 @@ discard block |
||
498 | 498 | |
499 | 499 | $user_data = get_userdata( $current_user->ID ); |
500 | 500 | |
501 | - $note_content = trim( $data['gv-note-content'] ); |
|
501 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
502 | 502 | |
503 | - if( empty( $note_content ) ) { |
|
503 | + if ( empty( $note_content ) ) { |
|
504 | 504 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
505 | 505 | } |
506 | 506 | |
507 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
507 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
508 | 508 | |
509 | 509 | return $return; |
510 | 510 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public static function get_add_note_part() { |
522 | 522 | |
523 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
523 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
524 | 524 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
525 | 525 | return ''; |
526 | 526 | } |
@@ -533,19 +533,19 @@ discard block |
||
533 | 533 | |
534 | 534 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
535 | 535 | $entry = $gravityview_view->getCurrentEntry(); |
536 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
536 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
537 | 537 | $nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false ); |
538 | 538 | |
539 | 539 | // Only generate the dropdown if the field settings allow it |
540 | 540 | $email_fields = ''; |
541 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
541 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
542 | 542 | $email_fields = self::get_note_email_fields( $entry_slug ); |
543 | 543 | } |
544 | 544 | |
545 | 545 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
546 | 546 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
547 | - $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html ); |
|
548 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
547 | + $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
548 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
549 | 549 | |
550 | 550 | return $add_note_html; |
551 | 551 | } |
@@ -569,8 +569,8 @@ discard block |
||
569 | 569 | $note_emails = array(); |
570 | 570 | |
571 | 571 | foreach ( $email_fields as $email_field ) { |
572 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
573 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
572 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
573 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | */ |
583 | 583 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
584 | 584 | |
585 | - return (array) $note_emails; |
|
585 | + return (array)$note_emails; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | private static function get_note_email_fields( $entry_slug = '' ) { |
600 | 600 | |
601 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
601 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
602 | 602 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
603 | 603 | return ''; |
604 | 604 | } |
@@ -620,27 +620,27 @@ discard block |
||
620 | 620 | |
621 | 621 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
622 | 622 | <div class="gv-note-email-container"> |
623 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
623 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
624 | 624 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
625 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
625 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
626 | 626 | <?php foreach ( $note_emails as $email ) { |
627 | 627 | ?> |
628 | 628 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
629 | 629 | <?php } |
630 | - if( $include_custom ) { ?> |
|
631 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
630 | + if ( $include_custom ) { ?> |
|
631 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
632 | 632 | <?php } ?> |
633 | 633 | </select> |
634 | 634 | <fieldset class="gv-note-to-container"> |
635 | - <?php if( $include_custom ) { ?> |
|
635 | + <?php if ( $include_custom ) { ?> |
|
636 | 636 | <div class='gv-note-to-custom-container'> |
637 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
638 | - <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
637 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
638 | + <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
639 | 639 | </div> |
640 | 640 | <?php } ?> |
641 | 641 | <div class='gv-note-subject-container'> |
642 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
643 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
642 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
643 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
644 | 644 | </div> |
645 | 645 | </fieldset> |
646 | 646 | </div> |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
665 | 665 | |
666 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
666 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
667 | 667 | do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note ); |
668 | 668 | return; |
669 | 669 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data ); |
672 | 672 | |
673 | 673 | //emailing notes if configured |
674 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
674 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
675 | 675 | |
676 | 676 | $default_data = array( |
677 | 677 | 'gv-note-to' => '', |
@@ -680,11 +680,11 @@ discard block |
||
680 | 680 | 'gv-note-content' => '', |
681 | 681 | ); |
682 | 682 | |
683 | - $current_user = wp_get_current_user(); |
|
683 | + $current_user = wp_get_current_user(); |
|
684 | 684 | $email_data = wp_parse_args( $data, $default_data ); |
685 | 685 | |
686 | - $from = $current_user->user_email; |
|
687 | - $to = $email_data['gv-note-to']; |
|
686 | + $from = $current_user->user_email; |
|
687 | + $to = $email_data[ 'gv-note-to' ]; |
|
688 | 688 | |
689 | 689 | /** |
690 | 690 | * Documented in get_note_email_fields |
@@ -692,8 +692,8 @@ discard block |
||
692 | 692 | */ |
693 | 693 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
694 | 694 | |
695 | - if( 'custom' === $to && $include_custom ) { |
|
696 | - $to = $email_data['gv-note-to-custom']; |
|
695 | + if ( 'custom' === $to && $include_custom ) { |
|
696 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
697 | 697 | do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to ); |
698 | 698 | } |
699 | 699 | |
@@ -704,12 +704,12 @@ discard block |
||
704 | 704 | |
705 | 705 | $bcc = false; |
706 | 706 | $reply_to = $from; |
707 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
707 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
708 | 708 | |
709 | 709 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
710 | 710 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
711 | - $message = $email_data['gv-note-content']; |
|
712 | - $from_name = $current_user->display_name; |
|
711 | + $message = $email_data[ 'gv-note-content' ]; |
|
712 | + $from_name = $current_user->display_name; |
|
713 | 713 | $message_format = 'html'; |
714 | 714 | |
715 | 715 | /** |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
726 | 726 | |
727 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
727 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
728 | 728 | |
729 | 729 | /** |
730 | 730 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |