@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | static function getInstance() { |
58 | 58 | |
59 | - if( empty( self::$instance ) ) { |
|
59 | + if ( empty( self::$instance ) ) { |
|
60 | 60 | self::$instance = new GravityView_Edit_Entry; |
61 | 61 | } |
62 | 62 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | private function add_hooks() { |
83 | 83 | |
84 | 84 | // Add front-end access to Gravity Forms delete file action |
85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') ); |
|
85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file' ) ); |
|
86 | 86 | |
87 | 87 | // Make sure this hook is run for non-admins |
88 | - add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') ); |
|
88 | + add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file' ) ); |
|
89 | 89 | |
90 | 90 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 ); |
91 | 91 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function add_reserved_arg( $args ) { |
110 | 110 | |
111 | - $args[] = 'edit'; |
|
111 | + $args[ ] = 'edit'; |
|
112 | 112 | |
113 | 113 | return $args; |
114 | 114 | } |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private function addon_specific_hooks() { |
121 | 121 | |
122 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
123 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
122 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
123 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | } |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
209 | 209 | |
210 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
210 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
211 | 211 | |
212 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
212 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
213 | 213 | |
214 | 214 | $url = add_query_arg( array( |
215 | 215 | 'edit' => wp_create_nonce( $nonce_key ) |
216 | 216 | ), $base ); |
217 | 217 | |
218 | - if( $post_id ) { |
|
218 | + if ( $post_id ) { |
|
219 | 219 | $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
220 | 220 | } |
221 | 221 | |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | * Allow passing params to dynamically populate entry with values |
224 | 224 | * @since 1.9.2 |
225 | 225 | */ |
226 | - if( !empty( $field_values ) ) { |
|
226 | + if ( ! empty( $field_values ) ) { |
|
227 | 227 | |
228 | - if( is_array( $field_values ) ) { |
|
228 | + if ( is_array( $field_values ) ) { |
|
229 | 229 | // If already an array, no parse_str() needed |
230 | 230 | $params = $field_values; |
231 | 231 | } else { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $entry The entry. |
242 | 242 | * @param \GV\View $view The View. |
243 | 243 | */ |
244 | - return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
244 | + return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function modify_field_blocklist( $fields = array(), $context = NULL ) { |
271 | 271 | |
272 | - if( empty( $context ) || $context !== 'edit' ) { |
|
272 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
273 | 273 | return $fields; |
274 | 274 | } |
275 | 275 | |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | // If they can edit any entries (as defined in Gravity Forms) |
367 | 367 | // Or if they can edit other people's entries |
368 | 368 | // Then we're good. |
369 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
369 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
370 | 370 | |
371 | 371 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
372 | 372 | |
373 | 373 | $user_can_edit = true; |
374 | 374 | |
375 | - } else if( !isset( $entry['created_by'] ) ) { |
|
375 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
376 | 376 | |
377 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
377 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
378 | 378 | |
379 | 379 | $user_can_edit = false; |
380 | 380 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $current_user = wp_get_current_user(); |
384 | 384 | |
385 | 385 | // User edit is disabled |
386 | - if( empty( $user_edit ) ) { |
|
386 | + if ( empty( $user_edit ) ) { |
|
387 | 387 | |
388 | 388 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
389 | 389 | |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
394 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
394 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
395 | 395 | |
396 | 396 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
397 | 397 | |
398 | 398 | $user_can_edit = true; |
399 | 399 | |
400 | - } else if( ! is_user_logged_in() ) { |
|
400 | + } else if ( ! is_user_logged_in() ) { |
|
401 | 401 | |
402 | 402 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
403 | 403 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
417 | 417 | |
418 | - return (bool) $user_can_edit; |
|
418 | + return (bool)$user_can_edit; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | * @uses GFForms::delete_file() |
427 | 427 | */ |
428 | 428 | public function delete_file() { |
429 | - add_filter( 'user_has_cap', function ( $caps ) { |
|
430 | - $caps['gravityforms_delete_entries'] = true; |
|
429 | + add_filter( 'user_has_cap', function( $caps ) { |
|
430 | + $caps[ 'gravityforms_delete_entries' ] = true; |
|
431 | 431 | |
432 | 432 | return $caps; |
433 | 433 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - if( ! is_admin() ) { return; } |
|
21 | + if ( ! is_admin() ) { return; } |
|
22 | 22 | |
23 | 23 | $this->add_hooks(); |
24 | 24 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private function add_hooks() { |
34 | 34 | //Hooks for no-conflict functionality |
35 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
36 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
35 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
36 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
37 | 37 | |
38 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
39 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
40 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
41 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
38 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
39 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
40 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
41 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function no_conflict_scripts() { |
52 | 52 | global $wp_scripts; |
53 | 53 | |
54 | - if( ! gravityview()->request->is_admin( '', null ) ) { |
|
54 | + if ( ! gravityview()->request->is_admin( '', null ) ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' ); |
59 | 59 | |
60 | - if( empty( $no_conflict_mode ) ) { |
|
60 | + if ( empty( $no_conflict_mode ) ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | function no_conflict_styles() { |
117 | 117 | global $wp_styles; |
118 | 118 | |
119 | - if( ! gravityview()->request->is_admin( '', null ) ) { |
|
119 | + if ( ! gravityview()->request->is_admin( '', null ) ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | 123 | // Dequeue other jQuery styles even if no-conflict is off. |
124 | 124 | // Terrible-looking tabs help no one. |
125 | - if( !empty( $wp_styles->registered ) ) { |
|
126 | - foreach ($wp_styles->registered as $key => $style) { |
|
127 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
125 | + if ( ! empty( $wp_styles->registered ) ) { |
|
126 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
127 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
128 | 128 | wp_dequeue_style( $key ); |
129 | 129 | } |
130 | 130 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' ); |
134 | 134 | |
135 | 135 | // If no conflict is off, jQuery will suffice. |
136 | - if( empty( $no_conflict_mode ) ) { |
|
136 | + if ( empty( $no_conflict_mode ) ) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | /** |
162 | 162 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
163 | 163 | */ |
164 | - do_action('gravityview_remove_conflicts_after'); |
|
164 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | |
195 | 195 | //reset queue |
196 | 196 | $queue = array(); |
197 | - foreach( $wp_objects->queue as $object ) { |
|
198 | - if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) { |
|
199 | - $queue[] = $object; |
|
197 | + foreach ( $wp_objects->queue as $object ) { |
|
198 | + if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) { |
|
199 | + $queue[ ] = $object; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | $wp_objects->queue = $queue; |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | |
206 | 206 | //unregistering scripts |
207 | 207 | $registered = array(); |
208 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
209 | - if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){ |
|
208 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
209 | + if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) { |
|
210 | 210 | $registered[ $handle ] = $script_registration; |
211 | 211 | } |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @param array $registered [description] |
222 | 222 | * @param array $scripts [description] |
223 | 223 | */ |
224 | - private function add_script_dependencies($registered, $scripts) { |
|
224 | + private function add_script_dependencies( $registered, $scripts ) { |
|
225 | 225 | |
226 | 226 | //gets all dependent scripts linked to the $scripts array passed |
227 | 227 | do { |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
231 | 231 | foreach ( $deps as $dep ) { |
232 | 232 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
233 | - $dependents[] = $dep; |
|
233 | + $dependents[ ] = $dep; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | function load() { |
136 | 136 | |
137 | 137 | /** @define "GRAVITYVIEW_DIR" "../../../" */ |
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
139 | 139 | |
140 | 140 | // Don't display an embedded form when editing an entry |
141 | 141 | add_action( 'wp_head', array( $this, 'prevent_render_form' ) ); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | add_action( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 ); |
146 | 146 | add_action( 'admin_init', array( $this, 'prevent_maybe_process_form' ), 8 ); |
147 | 147 | |
148 | - add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') ); |
|
148 | + add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) ); |
|
149 | 149 | |
150 | 150 | add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 ); |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 ); |
157 | 157 | |
158 | 158 | // Add fields expected by GFFormDisplay::validate() |
159 | - add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') ); |
|
159 | + add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) ); |
|
160 | 160 | |
161 | 161 | // Fix multiselect value for GF 2.2 |
162 | 162 | add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 ); |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function prevent_render_form() { |
176 | - if( $this->is_edit_entry() ) { |
|
177 | - if( 'wp_head' === current_filter() ) { |
|
176 | + if ( $this->is_edit_entry() ) { |
|
177 | + if ( 'wp_head' === current_filter() ) { |
|
178 | 178 | add_filter( 'gform_shortcode_form', '__return_empty_string' ); |
179 | 179 | } else { |
180 | 180 | remove_filter( 'gform_shortcode_form', '__return_empty_string' ); |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function prevent_maybe_process_form() { |
191 | 191 | |
192 | - if( ! $this->is_edit_entry_submission() ) { |
|
192 | + if ( ! $this->is_edit_entry_submission() ) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' ); |
197 | 197 | |
198 | - remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
199 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
198 | + remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
199 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
200 | 200 | |
201 | - remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
202 | - remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
201 | + remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
202 | + remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $is_edit_entry = |
212 | 212 | ( GravityView_frontend::is_single_entry() || gravityview()->request->is_entry() ) |
213 | - && ( ! empty( $_GET['edit'] ) ); |
|
213 | + && ( ! empty( $_GET[ 'edit' ] ) ); |
|
214 | 214 | |
215 | 215 | return ( $is_edit_entry || $this->is_edit_entry_submission() ); |
216 | 216 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return boolean |
222 | 222 | */ |
223 | 223 | public function is_edit_entry_submission() { |
224 | - return !empty( $_POST[ self::$nonce_field ] ); |
|
224 | + return ! empty( $_POST[ self::$nonce_field ] ); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -234,16 +234,16 @@ discard block |
||
234 | 234 | |
235 | 235 | |
236 | 236 | $entries = $gravityview_view->getEntries(); |
237 | - self::$original_entry = $entries[0]; |
|
238 | - $this->entry = $entries[0]; |
|
237 | + self::$original_entry = $entries[ 0 ]; |
|
238 | + $this->entry = $entries[ 0 ]; |
|
239 | 239 | |
240 | - self::$original_form = GFAPI::get_form( $this->entry['form_id'] ); |
|
240 | + self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] ); |
|
241 | 241 | $this->form = self::$original_form; |
242 | - $this->form_id = $this->entry['form_id']; |
|
242 | + $this->form_id = $this->entry[ 'form_id' ]; |
|
243 | 243 | $this->view_id = $gravityview_view->getViewId(); |
244 | 244 | $this->post_id = \GV\Utils::get( $post, 'ID', null ); |
245 | 245 | |
246 | - self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] ); |
|
246 | + self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | private function print_scripts() { |
303 | 303 | $gravityview_view = GravityView_View::getInstance(); |
304 | 304 | |
305 | - wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
305 | + wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
306 | 306 | |
307 | - GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false); |
|
307 | + GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false ); |
|
308 | 308 | |
309 | 309 | wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) ); |
310 | 310 | |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | */ |
324 | 324 | private function process_save( $gv_data ) { |
325 | 325 | |
326 | - if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) { |
|
326 | + if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) { |
|
327 | 327 | return; |
328 | 328 | } |
329 | 329 | |
330 | 330 | // Make sure the entry, view, and form IDs are all correct |
331 | 331 | $valid = $this->verify_nonce(); |
332 | 332 | |
333 | - if ( !$valid ) { |
|
333 | + if ( ! $valid ) { |
|
334 | 334 | gravityview()->log->error( 'Nonce validation failed.' ); |
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | - if ( $this->entry['id'] !== $_POST['lid'] ) { |
|
338 | + if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) { |
|
339 | 339 | gravityview()->log->error( 'Entry ID did not match posted entry ID.' ); |
340 | 340 | return; |
341 | 341 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | $this->validate(); |
348 | 348 | |
349 | - if( $this->is_valid ) { |
|
349 | + if ( $this->is_valid ) { |
|
350 | 350 | |
351 | 351 | gravityview()->log->debug( 'Submission is valid.' ); |
352 | 352 | |
@@ -358,15 +358,15 @@ discard block |
||
358 | 358 | /** |
359 | 359 | * @hack to avoid the capability validation of the method save_lead for GF 1.9+ |
360 | 360 | */ |
361 | - unset( $_GET['page'] ); |
|
361 | + unset( $_GET[ 'page' ] ); |
|
362 | 362 | |
363 | - $date_created = $this->entry['date_created']; |
|
363 | + $date_created = $this->entry[ 'date_created' ]; |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead() |
367 | 367 | * @since 1.17.2 |
368 | 368 | */ |
369 | - unset( $this->entry['date_created'] ); |
|
369 | + unset( $this->entry[ 'date_created' ] ); |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * @action `gravityview/edit_entry/before_update` Perform an action before the entry has been updated using Edit Entry |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | * @param GravityView_Edit_Entry_Render $this This object |
377 | 377 | * @param GravityView_View_Data $gv_data The View data |
378 | 378 | */ |
379 | - do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data ); |
|
379 | + do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data ); |
|
380 | 380 | |
381 | 381 | GFFormsModel::save_lead( $form, $this->entry ); |
382 | 382 | |
383 | 383 | // Delete the values for hidden inputs |
384 | 384 | $this->unset_hidden_field_values(); |
385 | 385 | |
386 | - $this->entry['date_created'] = $date_created; |
|
386 | + $this->entry[ 'date_created' ] = $date_created; |
|
387 | 387 | |
388 | 388 | // Process calculation fields |
389 | 389 | $this->update_calculation_fields(); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param GravityView_Edit_Entry_Render $this This object |
409 | 409 | * @param GravityView_View_Data $gv_data The View data |
410 | 410 | */ |
411 | - do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data ); |
|
411 | + do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data ); |
|
412 | 412 | |
413 | 413 | } else { |
414 | 414 | gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) ); |
@@ -444,10 +444,10 @@ discard block |
||
444 | 444 | |
445 | 445 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
446 | 446 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
447 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
|
447 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) ); |
|
448 | 448 | } else { |
449 | 449 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
450 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
|
450 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) ); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | foreach ( $this->entry as $input_id => $field_value ) { |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | |
466 | 466 | $empty_value = $field->get_value_save_entry( |
467 | 467 | is_array( $field->get_entry_inputs() ) ? array() : '', |
468 | - $this->form, '', $this->entry['id'], $this->entry |
|
468 | + $this->form, '', $this->entry[ 'id' ], $this->entry |
|
469 | 469 | ); |
470 | 470 | |
471 | 471 | if ( $field->has_calculation() ) { |
472 | - $this->unset_hidden_calculations[] = $field->id; // Unset |
|
472 | + $this->unset_hidden_calculations[ ] = $field->id; // Unset |
|
473 | 473 | $empty_value = ''; |
474 | 474 | } |
475 | 475 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | private function preset_approval_fields() { |
499 | 499 | $has_approved_field = false; |
500 | 500 | |
501 | - foreach ( self::$original_form['fields'] as $field ) { |
|
501 | + foreach ( self::$original_form[ 'fields' ] as $field ) { |
|
502 | 502 | if ( $field->gravityview_approved ) { |
503 | 503 | $has_approved_field = true; |
504 | 504 | break; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | $is_field_hidden = true; |
513 | 513 | |
514 | - foreach ( $this->form['fields'] as $field ) { |
|
514 | + foreach ( $this->form[ 'fields' ] as $field ) { |
|
515 | 515 | if ( $field->gravityview_approved ) { |
516 | 516 | $is_field_hidden = false; |
517 | 517 | break; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 ); |
538 | 538 | |
539 | - if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
539 | + if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
540 | 540 | |
541 | 541 | $value = GravityView_Entry_Approval_Status::UNAPPROVED; |
542 | 542 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | } |
602 | 602 | |
603 | 603 | /** No file is being uploaded. */ |
604 | - if ( empty( $_FILES[ $input_name ]['name'] ) ) { |
|
604 | + if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
605 | 605 | /** So return the original upload, with $value as backup (it can be empty during edit form rendering) */ |
606 | 606 | return rgar( $entry, $input_id, $value ); |
607 | 607 | } |
@@ -619,11 +619,11 @@ discard block |
||
619 | 619 | * @return mixed |
620 | 620 | */ |
621 | 621 | public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) { |
622 | - if( ! $this->is_edit_entry() ) { |
|
622 | + if ( ! $this->is_edit_entry() ) { |
|
623 | 623 | return $plupload_init; |
624 | 624 | } |
625 | 625 | |
626 | - $plupload_init['gf_vars']['max_files'] = 0; |
|
626 | + $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0; |
|
627 | 627 | |
628 | 628 | return $plupload_init; |
629 | 629 | } |
@@ -638,26 +638,26 @@ discard block |
||
638 | 638 | $form = $this->filter_conditional_logic( $this->form ); |
639 | 639 | |
640 | 640 | /** @type GF_Field $field */ |
641 | - foreach( $form['fields'] as $k => &$field ) { |
|
641 | + foreach ( $form[ 'fields' ] as $k => &$field ) { |
|
642 | 642 | |
643 | 643 | /** |
644 | 644 | * Remove the fields with calculation formulas before save to avoid conflicts with GF logic |
645 | 645 | * @since 1.16.3 |
646 | 646 | */ |
647 | - if( $field->has_calculation() ) { |
|
648 | - unset( $form['fields'][ $k ] ); |
|
647 | + if ( $field->has_calculation() ) { |
|
648 | + unset( $form[ 'fields' ][ $k ] ); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | $field->adminOnly = false; |
652 | 652 | |
653 | - if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
654 | - foreach( $field->inputs as $key => $input ) { |
|
655 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
653 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
654 | + foreach ( $field->inputs as $key => $input ) { |
|
655 | + $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ]; |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | } |
659 | 659 | |
660 | - $form['fields'] = array_values( $form['fields'] ); |
|
660 | + $form[ 'fields' ] = array_values( $form[ 'fields' ] ); |
|
661 | 661 | |
662 | 662 | return $form; |
663 | 663 | } |
@@ -669,14 +669,14 @@ discard block |
||
669 | 669 | $update = false; |
670 | 670 | |
671 | 671 | // get the most up to date entry values |
672 | - $entry = GFAPI::get_entry( $this->entry['id'] ); |
|
672 | + $entry = GFAPI::get_entry( $this->entry[ 'id' ] ); |
|
673 | 673 | |
674 | 674 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
675 | 675 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
676 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) ); |
|
676 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) ); |
|
677 | 677 | } else { |
678 | 678 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
679 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) ); |
|
679 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) ); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -693,24 +693,24 @@ discard block |
||
693 | 693 | $inputs = $field->get_entry_inputs(); |
694 | 694 | if ( is_array( $inputs ) ) { |
695 | 695 | foreach ( $inputs as $input ) { |
696 | - list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 ); |
|
696 | + list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 ); |
|
697 | 697 | |
698 | 698 | if ( 'product' === $field->type ) { |
699 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
699 | + $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
700 | 700 | |
701 | 701 | // Only allow quantity to be set if it's allowed to be edited |
702 | 702 | if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) { |
703 | 703 | } else { // otherwise set to what it previously was |
704 | - $_POST[ $input_name ] = $entry[ $input['id'] ]; |
|
704 | + $_POST[ $input_name ] = $entry[ $input[ 'id' ] ]; |
|
705 | 705 | } |
706 | 706 | } else { |
707 | 707 | // Set to what it previously was if it's not editable |
708 | 708 | if ( ! in_array( $field_id, $allowed_fields ) ) { |
709 | - $_POST[ $input_name ] = $entry[ $input['id'] ]; |
|
709 | + $_POST[ $input_name ] = $entry[ $input[ 'id' ] ]; |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
713 | - GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] ); |
|
713 | + GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] ); |
|
714 | 714 | } |
715 | 715 | } else { |
716 | 716 | // Set to what it previously was if it's not editable |
@@ -750,19 +750,19 @@ discard block |
||
750 | 750 | |
751 | 751 | $input_name = 'input_' . $field_id; |
752 | 752 | |
753 | - if ( !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
753 | + if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
754 | 754 | |
755 | 755 | // We have a new image |
756 | 756 | |
757 | - $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
|
757 | + $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] ); |
|
758 | 758 | |
759 | 759 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
760 | 760 | $ary = stripslashes_deep( $ary ); |
761 | 761 | $img_url = \GV\Utils::get( $ary, 0 ); |
762 | 762 | |
763 | - $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
|
764 | - $img_caption = count( $ary ) > 2 ? $ary[2] : ''; |
|
765 | - $img_description = count( $ary ) > 3 ? $ary[3] : ''; |
|
763 | + $img_title = count( $ary ) > 1 ? $ary[ 1 ] : ''; |
|
764 | + $img_caption = count( $ary ) > 2 ? $ary[ 2 ] : ''; |
|
765 | + $img_description = count( $ary ) > 3 ? $ary[ 3 ] : ''; |
|
766 | 766 | |
767 | 767 | $image_meta = array( |
768 | 768 | 'post_excerpt' => $img_caption, |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | |
772 | 772 | //adding title only if it is not empty. It will default to the file name if it is not in the array |
773 | 773 | if ( ! empty( $img_title ) ) { |
774 | - $image_meta['post_title'] = $img_title; |
|
774 | + $image_meta[ 'post_title' ] = $img_title; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -829,15 +829,15 @@ discard block |
||
829 | 829 | */ |
830 | 830 | private function maybe_update_post_fields( $form ) { |
831 | 831 | |
832 | - if( empty( $this->entry['post_id'] ) ) { |
|
832 | + if ( empty( $this->entry[ 'post_id' ] ) ) { |
|
833 | 833 | gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
834 | 834 | return; |
835 | 835 | } |
836 | 836 | |
837 | - $post_id = $this->entry['post_id']; |
|
837 | + $post_id = $this->entry[ 'post_id' ]; |
|
838 | 838 | |
839 | 839 | // Security check |
840 | - if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
840 | + if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
841 | 841 | gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) ); |
842 | 842 | return; |
843 | 843 | } |
@@ -850,25 +850,25 @@ discard block |
||
850 | 850 | |
851 | 851 | $field = RGFormsModel::get_field( $form, $field_id ); |
852 | 852 | |
853 | - if( ! $field ) { |
|
853 | + if ( ! $field ) { |
|
854 | 854 | continue; |
855 | 855 | } |
856 | 856 | |
857 | - if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
857 | + if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
858 | 858 | |
859 | 859 | // Get the value of the field, including $_POSTed value |
860 | 860 | $value = RGFormsModel::get_field_value( $field ); |
861 | 861 | |
862 | 862 | // Use temporary entry variable, to make values available to fill_post_template() and update_post_image() |
863 | 863 | $entry_tmp = $this->entry; |
864 | - $entry_tmp["{$field_id}"] = $value; |
|
864 | + $entry_tmp[ "{$field_id}" ] = $value; |
|
865 | 865 | |
866 | - switch( $field->type ) { |
|
866 | + switch ( $field->type ) { |
|
867 | 867 | |
868 | 868 | case 'post_title': |
869 | 869 | $post_title = $value; |
870 | 870 | if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
871 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
871 | + $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp ); |
|
872 | 872 | } |
873 | 873 | $updated_post->post_title = $post_title; |
874 | 874 | $updated_post->post_name = $post_title; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | case 'post_content': |
879 | 879 | $post_content = $value; |
880 | 880 | if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
881 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
881 | + $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true ); |
|
882 | 882 | } |
883 | 883 | $updated_post->post_content = $post_content; |
884 | 884 | unset( $post_content ); |
@@ -896,11 +896,11 @@ discard block |
||
896 | 896 | $value = $value[ $field_id ]; |
897 | 897 | } |
898 | 898 | |
899 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
899 | + if ( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
900 | 900 | $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
901 | 901 | } |
902 | 902 | |
903 | - $value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry ); |
|
903 | + $value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry ); |
|
904 | 904 | |
905 | 905 | update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
906 | 906 | break; |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | } |
913 | 913 | |
914 | 914 | // update entry after |
915 | - $this->entry["{$field_id}"] = $value; |
|
915 | + $this->entry[ "{$field_id}" ] = $value; |
|
916 | 916 | |
917 | 917 | $update_entry = true; |
918 | 918 | |
@@ -921,11 +921,11 @@ discard block |
||
921 | 921 | |
922 | 922 | } |
923 | 923 | |
924 | - if( $update_entry ) { |
|
924 | + if ( $update_entry ) { |
|
925 | 925 | |
926 | 926 | $return_entry = GFAPI::update_entry( $this->entry ); |
927 | 927 | |
928 | - if( is_wp_error( $return_entry ) ) { |
|
928 | + if ( is_wp_error( $return_entry ) ) { |
|
929 | 929 | gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) ); |
930 | 930 | } else { |
931 | 931 | gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) ); |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | |
936 | 936 | $return_post = wp_update_post( $updated_post, true ); |
937 | 937 | |
938 | - if( is_wp_error( $return_post ) ) { |
|
938 | + if ( is_wp_error( $return_post ) ) { |
|
939 | 939 | $return_post->add_data( $updated_post, '$updated_post' ); |
940 | 940 | gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) ); |
941 | 941 | } else { |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false ); |
970 | 970 | |
971 | 971 | // replace conditional shortcodes |
972 | - if( $do_shortcode ) { |
|
972 | + if ( $do_shortcode ) { |
|
973 | 973 | $output = do_shortcode( $output ); |
974 | 974 | } |
975 | 975 | |
@@ -988,19 +988,19 @@ discard block |
||
988 | 988 | */ |
989 | 989 | private function after_update() { |
990 | 990 | |
991 | - do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry ); |
|
992 | - do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry ); |
|
991 | + do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry ); |
|
992 | + do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry ); |
|
993 | 993 | |
994 | 994 | // Re-define the entry now that we've updated it. |
995 | - $entry = RGFormsModel::get_lead( $this->entry['id'] ); |
|
995 | + $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] ); |
|
996 | 996 | |
997 | 997 | $entry = GFFormsModel::set_entry_meta( $entry, self::$original_form ); |
998 | 998 | |
999 | 999 | if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) { |
1000 | 1000 | // We need to clear the cache because Gravity Forms caches the field values, which |
1001 | 1001 | // we have just updated. |
1002 | - foreach ($this->form['fields'] as $key => $field) { |
|
1003 | - GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id ); |
|
1002 | + foreach ( $this->form[ 'fields' ] as $key => $field ) { |
|
1003 | + GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id ); |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | |
@@ -1010,11 +1010,11 @@ discard block |
||
1010 | 1010 | * @since develop |
1011 | 1011 | */ |
1012 | 1012 | if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) { |
1013 | - $feeds = GFAPI::get_feeds( null, $entry['form_id'] ); |
|
1013 | + $feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] ); |
|
1014 | 1014 | if ( ! is_wp_error( $feeds ) ) { |
1015 | 1015 | $registered_feeds = array(); |
1016 | 1016 | foreach ( GFAddOn::get_registered_addons() as $registered_feed ) { |
1017 | - if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) { |
|
1017 | + if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) { |
|
1018 | 1018 | if ( method_exists( $registered_feed, 'get_instance' ) ) { |
1019 | 1019 | $registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) ); |
1020 | 1020 | $registered_feeds[ $registered_feed->get_slug() ] = $registered_feed; |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | foreach ( $feeds as $feed ) { |
1025 | - if ( in_array( $feed['id'], $allowed_feeds ) ) { |
|
1026 | - if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) { |
|
1025 | + if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) { |
|
1026 | + if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) { |
|
1027 | 1027 | $returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form ); |
1028 | 1028 | if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) { |
1029 | 1029 | $entry = $returned_entry; |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $view = \GV\View::by_id( $this->view_id ); |
1053 | 1053 | |
1054 | - if( $view->settings->get( 'edit_locking' ) ) { |
|
1054 | + if ( $view->settings->get( 'edit_locking' ) ) { |
|
1055 | 1055 | $locking = new GravityView_Edit_Entry_Locking(); |
1056 | - $locking->maybe_lock_object( $this->entry['id'] ); |
|
1056 | + $locking->maybe_lock_object( $this->entry[ 'id' ] ); |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | ?> |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | <div class="gv-edit-entry-wrapper"><?php |
1068 | 1068 | |
1069 | - $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this ); |
|
1069 | + $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this ); |
|
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Fixes weird wpautop() issue |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | * @param string $edit_entry_title Modify the "Edit Entry" title |
1083 | 1083 | * @param GravityView_Edit_Entry_Render $this This object |
1084 | 1084 | */ |
1085 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
1085 | + $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this ); |
|
1086 | 1086 | |
1087 | 1087 | echo esc_attr( $edit_entry_title ); |
1088 | 1088 | ?></span> |
@@ -1159,18 +1159,18 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
1161 | 1161 | |
1162 | - $this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit']; |
|
1162 | + $this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ]; |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | $back_link = remove_query_arg( array( 'page', 'view', 'edit' ) ); |
1166 | 1166 | |
1167 | - if( ! $this->is_valid ){ |
|
1167 | + if ( ! $this->is_valid ) { |
|
1168 | 1168 | |
1169 | 1169 | // Keeping this compatible with Gravity Forms. |
1170 | - $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
|
1171 | - $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form); |
|
1170 | + $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>"; |
|
1171 | + $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form ); |
|
1172 | 1172 | |
1173 | - echo GVCommon::generate_notice( $message , 'gv-error' ); |
|
1173 | + echo GVCommon::generate_notice( $message, 'gv-error' ); |
|
1174 | 1174 | |
1175 | 1175 | } elseif ( false === $this->is_paged_submitted ) { |
1176 | 1176 | // Paged form that hasn't been submitted on the last page yet |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | * @param int $view_id View ID |
1184 | 1184 | * @param array $entry Gravity Forms entry array |
1185 | 1185 | */ |
1186 | - $message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry ); |
|
1186 | + $message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry ); |
|
1187 | 1187 | |
1188 | 1188 | echo GVCommon::generate_notice( $message ); |
1189 | 1189 | } else { |
@@ -1195,23 +1195,23 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | case '0': |
1197 | 1197 | $redirect_url = $back_link; |
1198 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' ); |
|
1198 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' ); |
|
1199 | 1199 | break; |
1200 | 1200 | |
1201 | 1201 | case '1': |
1202 | 1202 | $redirect_url = $directory_link = GravityView_API::directory_link(); |
1203 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
1203 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' ); |
|
1204 | 1204 | break; |
1205 | 1205 | |
1206 | 1206 | case '2': |
1207 | 1207 | $redirect_url = $edit_redirect_url; |
1208 | 1208 | $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' ); |
1209 | - $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
1209 | + $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' ); |
|
1210 | 1210 | break; |
1211 | 1211 | |
1212 | 1212 | case '': |
1213 | 1213 | default: |
1214 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' ); |
|
1214 | + $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' ); |
|
1215 | 1215 | break; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | * @param array $entry Gravity Forms entry array |
1228 | 1228 | * @param string $back_link URL to return to the original entry. @since 1.6 |
1229 | 1229 | */ |
1230 | - $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link ); |
|
1230 | + $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link ); |
|
1231 | 1231 | |
1232 | 1232 | echo GVCommon::generate_notice( $message ); |
1233 | 1233 | } |
@@ -1249,8 +1249,8 @@ discard block |
||
1249 | 1249 | */ |
1250 | 1250 | do_action( 'gravityview/edit-entry/render/before', $this ); |
1251 | 1251 | |
1252 | - add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 ); |
|
1253 | - add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') ); |
|
1252 | + add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 ); |
|
1253 | + add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
|
1254 | 1254 | add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) ); |
1255 | 1255 | add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) ); |
1256 | 1256 | add_filter( 'gform_disable_view_counter', '__return_true' ); |
@@ -1259,14 +1259,14 @@ discard block |
||
1259 | 1259 | add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 ); |
1260 | 1260 | |
1261 | 1261 | // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin. |
1262 | - unset( $_GET['page'] ); |
|
1262 | + unset( $_GET[ 'page' ] ); |
|
1263 | 1263 | |
1264 | 1264 | $this->show_next_button = false; |
1265 | 1265 | $this->show_previous_button = false; |
1266 | 1266 | |
1267 | 1267 | // TODO: Verify multiple-page forms |
1268 | 1268 | if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) { |
1269 | - if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) { |
|
1269 | + if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) { |
|
1270 | 1270 | |
1271 | 1271 | $labels = array( |
1272 | 1272 | 'cancel' => __( 'Cancel', 'gravityview' ), |
@@ -1285,20 +1285,20 @@ discard block |
||
1285 | 1285 | */ |
1286 | 1286 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
1287 | 1287 | |
1288 | - GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form; |
|
1289 | - GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true; |
|
1288 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form; |
|
1289 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true; |
|
1290 | 1290 | |
1291 | - if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) { |
|
1291 | + if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) { |
|
1292 | 1292 | $last_page = \GFFormDisplay::get_max_page_number( $this->form ); |
1293 | 1293 | |
1294 | 1294 | while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) { |
1295 | 1295 | } // Advance to next visible page |
1296 | - } elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) { |
|
1296 | + } elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) { |
|
1297 | 1297 | while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) { |
1298 | 1298 | } // Advance to next visible page |
1299 | 1299 | } |
1300 | 1300 | |
1301 | - GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number; |
|
1301 | + GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number; |
|
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | if ( ( $page_number = intval( $page_number ) ) < 2 ) { |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | |
1325 | 1325 | ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic |
1326 | 1326 | |
1327 | - $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry ); |
|
1327 | + $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry ); |
|
1328 | 1328 | |
1329 | 1329 | ob_get_clean(); |
1330 | 1330 | |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | * @return string |
1353 | 1353 | */ |
1354 | 1354 | public function render_form_buttons() { |
1355 | - return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this ); |
|
1355 | + return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this ); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | |
@@ -1371,15 +1371,15 @@ discard block |
||
1371 | 1371 | */ |
1372 | 1372 | public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) { |
1373 | 1373 | |
1374 | - if( $form['id'] != $this->form_id ) { |
|
1374 | + if ( $form[ 'id' ] != $this->form_id ) { |
|
1375 | 1375 | return $form; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | // In case we have validated the form, use it to inject the validation results into the form render |
1379 | - if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) { |
|
1379 | + if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) { |
|
1380 | 1380 | $form = $this->form_after_validation; |
1381 | 1381 | } else { |
1382 | - $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1382 | + $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | $form = $this->filter_conditional_logic( $form ); |
@@ -1387,8 +1387,8 @@ discard block |
||
1387 | 1387 | $form = $this->prefill_conditional_logic( $form ); |
1388 | 1388 | |
1389 | 1389 | // for now we don't support Save and Continue feature. |
1390 | - if( ! self::$supports_save_and_continue ) { |
|
1391 | - unset( $form['save'] ); |
|
1390 | + if ( ! self::$supports_save_and_continue ) { |
|
1391 | + unset( $form[ 'save' ] ); |
|
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | $form = $this->unselect_default_values( $form ); |
@@ -1411,31 +1411,31 @@ discard block |
||
1411 | 1411 | */ |
1412 | 1412 | public function verify_user_can_edit_post( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) { |
1413 | 1413 | |
1414 | - if( ! GFCommon::is_post_field( $field ) ) { |
|
1414 | + if ( ! GFCommon::is_post_field( $field ) ) { |
|
1415 | 1415 | return $field_content; |
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | $message = null; |
1419 | 1419 | |
1420 | 1420 | // First, make sure they have the capability to edit the post. |
1421 | - if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
1421 | + if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) { |
|
1422 | 1422 | |
1423 | 1423 | /** |
1424 | 1424 | * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
1425 | 1425 | * @param string $message The existing "You don't have permission..." text |
1426 | 1426 | */ |
1427 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
1427 | + $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don’t have permission to edit this post.', 'gravityview' ) ); |
|
1428 | 1428 | |
1429 | - } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
1429 | + } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) { |
|
1430 | 1430 | /** |
1431 | 1431 | * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
1432 | 1432 | * @param string $message The existing "This field is not editable; the post no longer exists." text |
1433 | 1433 | */ |
1434 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
1434 | + $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
1435 | 1435 | } |
1436 | 1436 | |
1437 | - if( $message ) { |
|
1438 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1437 | + if ( $message ) { |
|
1438 | + $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | return $field_content; |
@@ -1459,8 +1459,8 @@ discard block |
||
1459 | 1459 | |
1460 | 1460 | // If the form has been submitted, then we don't need to pre-fill the values, |
1461 | 1461 | // Except for fileupload type and when a field input is overridden- run always!! |
1462 | - if( |
|
1463 | - ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1462 | + if ( |
|
1463 | + ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
1464 | 1464 | && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) |
1465 | 1465 | && ! GFCommon::is_product_field( $field->type ) |
1466 | 1466 | || ! empty( $field_content ) |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | $return = null; |
1481 | 1481 | |
1482 | 1482 | /** @var GravityView_Field $gv_field */ |
1483 | - if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1483 | + if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
1484 | 1484 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
1485 | 1485 | } else { |
1486 | 1486 | $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | // If there was output, it's an error |
1490 | 1490 | $warnings = ob_get_clean(); |
1491 | 1491 | |
1492 | - if( !empty( $warnings ) ) { |
|
1492 | + if ( ! empty( $warnings ) ) { |
|
1493 | 1493 | gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field ); |
1515 | 1515 | |
1516 | 1516 | // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs) |
1517 | - if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1517 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
1518 | 1518 | |
1519 | 1519 | $field_value = array(); |
1520 | 1520 | |
@@ -1523,10 +1523,10 @@ discard block |
||
1523 | 1523 | |
1524 | 1524 | foreach ( (array)$field->inputs as $input ) { |
1525 | 1525 | |
1526 | - $input_id = strval( $input['id'] ); |
|
1526 | + $input_id = strval( $input[ 'id' ] ); |
|
1527 | 1527 | |
1528 | 1528 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
1529 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1529 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1530 | 1530 | $allow_pre_populated = false; |
1531 | 1531 | } |
1532 | 1532 | |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | |
1535 | 1535 | $pre_value = $field->get_value_submission( array(), false ); |
1536 | 1536 | |
1537 | - $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1537 | + $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
1538 | 1538 | |
1539 | 1539 | } else { |
1540 | 1540 | |
@@ -1545,13 +1545,13 @@ discard block |
||
1545 | 1545 | |
1546 | 1546 | // saved field entry value (if empty, fallback to the pre-populated value, if exists) |
1547 | 1547 | // or pre-populated value if not empty and set to override saved value |
1548 | - $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1548 | + $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
1549 | 1549 | |
1550 | 1550 | // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs. |
1551 | - if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
|
1551 | + if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) { |
|
1552 | 1552 | $categories = array(); |
1553 | 1553 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
1554 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
1554 | + $categories[ ] = GFCommon::format_post_category( $cat_string, true ); |
|
1555 | 1555 | } |
1556 | 1556 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
1557 | 1557 | } |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | * @param GF_Field $field Gravity Forms field object |
1580 | 1580 | * @param GravityView_Edit_Entry_Render $this Current object |
1581 | 1581 | */ |
1582 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
1582 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this ); |
|
1583 | 1583 | |
1584 | 1584 | return $field_value; |
1585 | 1585 | } |
@@ -1596,12 +1596,12 @@ discard block |
||
1596 | 1596 | */ |
1597 | 1597 | public function gform_pre_validation( $form ) { |
1598 | 1598 | |
1599 | - if( ! $this->verify_nonce() ) { |
|
1599 | + if ( ! $this->verify_nonce() ) { |
|
1600 | 1600 | return $form; |
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | // Fix PHP warning regarding undefined index. |
1604 | - foreach ( $form['fields'] as &$field) { |
|
1604 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
1605 | 1605 | |
1606 | 1606 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
1607 | 1607 | // expects certain field array items to be set. |
@@ -1609,7 +1609,7 @@ discard block |
||
1609 | 1609 | $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
1610 | 1610 | } |
1611 | 1611 | |
1612 | - switch( RGFormsModel::get_input_type( $field ) ) { |
|
1612 | + switch ( RGFormsModel::get_input_type( $field ) ) { |
|
1613 | 1613 | |
1614 | 1614 | /** |
1615 | 1615 | * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend. |
@@ -1623,26 +1623,26 @@ discard block |
||
1623 | 1623 | // Set the previous value |
1624 | 1624 | $entry = $this->get_entry(); |
1625 | 1625 | |
1626 | - $input_name = 'input_'.$field->id; |
|
1627 | - $form_id = $form['id']; |
|
1626 | + $input_name = 'input_' . $field->id; |
|
1627 | + $form_id = $form[ 'id' ]; |
|
1628 | 1628 | |
1629 | 1629 | $value = NULL; |
1630 | 1630 | |
1631 | 1631 | // Use the previous entry value as the default. |
1632 | - if( isset( $entry[ $field->id ] ) ) { |
|
1632 | + if ( isset( $entry[ $field->id ] ) ) { |
|
1633 | 1633 | $value = $entry[ $field->id ]; |
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | // If this is a single upload file |
1637 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
1638 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
1639 | - $value = $file_path['url']; |
|
1637 | + if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
1638 | + $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] ); |
|
1639 | + $value = $file_path[ 'url' ]; |
|
1640 | 1640 | |
1641 | 1641 | } else { |
1642 | 1642 | |
1643 | 1643 | // Fix PHP warning on line 1498 of form_display.php for post_image fields |
1644 | 1644 | // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
1645 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
1645 | + $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' ); |
|
1646 | 1646 | |
1647 | 1647 | } |
1648 | 1648 | |
@@ -1652,7 +1652,7 @@ discard block |
||
1652 | 1652 | if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
1653 | 1653 | $value = empty( $value ) ? '[]' : $value; |
1654 | 1654 | $value = stripslashes_deep( $value ); |
1655 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() ); |
|
1655 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() ); |
|
1656 | 1656 | } else if ( GFCommon::is_json( $value ) ) { |
1657 | 1657 | // Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`) |
1658 | 1658 | global $_gf_uploaded_files; |
@@ -1672,8 +1672,8 @@ discard block |
||
1672 | 1672 | |
1673 | 1673 | case 'number': |
1674 | 1674 | // Fix "undefined index" issue at line 1286 in form_display.php |
1675 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
1676 | - $_POST['input_'.$field->id ] = NULL; |
|
1675 | + if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) { |
|
1676 | + $_POST[ 'input_' . $field->id ] = NULL; |
|
1677 | 1677 | } |
1678 | 1678 | break; |
1679 | 1679 | } |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | * You can enter whatever you want! |
1711 | 1711 | * We try validating, and customize the results using `self::custom_validation()` |
1712 | 1712 | */ |
1713 | - add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4); |
|
1713 | + add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 ); |
|
1714 | 1714 | |
1715 | 1715 | // Needed by the validate funtion |
1716 | 1716 | $failed_validation_page = NULL; |
@@ -1718,14 +1718,14 @@ discard block |
||
1718 | 1718 | |
1719 | 1719 | // Prevent entry limit from running when editing an entry, also |
1720 | 1720 | // prevent form scheduling from preventing editing |
1721 | - unset( $this->form['limitEntries'], $this->form['scheduleForm'] ); |
|
1721 | + unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] ); |
|
1722 | 1722 | |
1723 | 1723 | // Hide fields depending on Edit Entry settings |
1724 | - $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1724 | + $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
1725 | 1725 | |
1726 | 1726 | $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page ); |
1727 | 1727 | |
1728 | - remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1728 | + remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | |
1754 | 1754 | $gv_valid = true; |
1755 | 1755 | |
1756 | - foreach ( $validation_results['form']['fields'] as $key => &$field ) { |
|
1756 | + foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) { |
|
1757 | 1757 | $value = RGFormsModel::get_field_value( $field ); |
1758 | 1758 | $field_type = RGFormsModel::get_input_type( $field ); |
1759 | 1759 | $is_required = ! empty( $field->isRequired ); |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | |
1762 | 1762 | // Manually validate required fields as they can be skipped be skipped by GF's validation |
1763 | 1763 | // This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic |
1764 | - if ( $is_required && !$failed_validation && rgblank( $value ) ) { |
|
1764 | + if ( $is_required && ! $failed_validation && rgblank( $value ) ) { |
|
1765 | 1765 | $field->failed_validation = true; |
1766 | 1766 | $field->validation_message = esc_html__( 'This field is required.', 'gravityview' ); |
1767 | 1767 | |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) { |
1786 | 1786 | $input_name = 'input_' . $field->id; |
1787 | 1787 | //uploaded |
1788 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
1788 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array(); |
|
1789 | 1789 | |
1790 | 1790 | //existent |
1791 | 1791 | $entry = $this->get_entry(); |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | $gv_valid = false; |
1805 | 1805 | |
1806 | 1806 | // in case of error make sure the newest upload files are removed from the upload input |
1807 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
1807 | + GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null; |
|
1808 | 1808 | } |
1809 | 1809 | } |
1810 | 1810 | |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | // This field has failed validation. |
1815 | - if( !empty( $field->failed_validation ) ) { |
|
1815 | + if ( ! empty( $field->failed_validation ) ) { |
|
1816 | 1816 | |
1817 | 1817 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) ); |
1818 | 1818 | |
@@ -1830,19 +1830,19 @@ discard block |
||
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | // You can't continue inside a switch, so we do it after. |
1833 | - if( empty( $field->failed_validation ) ) { |
|
1833 | + if ( empty( $field->failed_validation ) ) { |
|
1834 | 1834 | continue; |
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | // checks if the No Duplicates option is not validating entry against itself, since |
1838 | 1838 | // we're editing a stored entry, it would also assume it's a duplicate. |
1839 | - if( !empty( $field->noDuplicates ) ) { |
|
1839 | + if ( ! empty( $field->noDuplicates ) ) { |
|
1840 | 1840 | |
1841 | 1841 | $entry = $this->get_entry(); |
1842 | 1842 | |
1843 | 1843 | // If the value of the entry is the same as the stored value |
1844 | 1844 | // Then we can assume it's not a duplicate, it's the same. |
1845 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1845 | + if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1846 | 1846 | //if value submitted was not changed, then don't validate |
1847 | 1847 | $field->failed_validation = false; |
1848 | 1848 | |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | } |
1856 | 1856 | |
1857 | 1857 | // if here then probably we are facing the validation 'At least one field must be filled out' |
1858 | - if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1858 | + if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
1859 | 1859 | unset( $field->validation_message ); |
1860 | 1860 | $field->failed_validation = false; |
1861 | 1861 | continue; |
@@ -1867,12 +1867,12 @@ discard block |
||
1867 | 1867 | |
1868 | 1868 | } |
1869 | 1869 | |
1870 | - $validation_results['is_valid'] = $gv_valid; |
|
1870 | + $validation_results[ 'is_valid' ] = $gv_valid; |
|
1871 | 1871 | |
1872 | 1872 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) ); |
1873 | 1873 | |
1874 | 1874 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
1875 | - $this->form_after_validation = $validation_results['form']; |
|
1875 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
1876 | 1876 | |
1877 | 1877 | return $validation_results; |
1878 | 1878 | } |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | */ |
1886 | 1886 | public function get_entry() { |
1887 | 1887 | |
1888 | - if( empty( $this->entry ) ) { |
|
1888 | + if ( empty( $this->entry ) ) { |
|
1889 | 1889 | // Get the database value of the entry that's being edited |
1890 | 1890 | $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() ); |
1891 | 1891 | } |
@@ -1917,10 +1917,10 @@ discard block |
||
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | // If edit tab not yet configured, show all fields |
1920 | - $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL; |
|
1920 | + $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL; |
|
1921 | 1921 | |
1922 | 1922 | // Hide fields depending on admin settings |
1923 | - $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
|
1923 | + $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields ); |
|
1924 | 1924 | |
1925 | 1925 | // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
1926 | 1926 | $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | */ |
1954 | 1954 | private function filter_fields( $fields, $configured_fields ) { |
1955 | 1955 | |
1956 | - if( empty( $fields ) || !is_array( $fields ) ) { |
|
1956 | + if ( empty( $fields ) || ! is_array( $fields ) ) { |
|
1957 | 1957 | return $fields; |
1958 | 1958 | } |
1959 | 1959 | |
@@ -1970,12 +1970,12 @@ discard block |
||
1970 | 1970 | |
1971 | 1971 | // Remove the fields that have calculation properties and keep them to be used later |
1972 | 1972 | // @since 1.16.2 |
1973 | - if( $field->has_calculation() ) { |
|
1974 | - $this->fields_with_calculation[] = $field; |
|
1973 | + if ( $field->has_calculation() ) { |
|
1974 | + $this->fields_with_calculation[ ] = $field; |
|
1975 | 1975 | // don't remove the calculation fields on form render. |
1976 | 1976 | } |
1977 | 1977 | |
1978 | - if( in_array( $field->type, $field_type_blocklist ) ) { |
|
1978 | + if ( in_array( $field->type, $field_type_blocklist ) ) { |
|
1979 | 1979 | unset( $fields[ $key ] ); |
1980 | 1980 | } |
1981 | 1981 | } |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | continue; // Never include when no fields are configured |
2006 | 2006 | } |
2007 | 2007 | |
2008 | - $out_fields[] = $field; |
|
2008 | + $out_fields[ ] = $field; |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | return array_values( $out_fields ); |
@@ -2016,8 +2016,8 @@ discard block |
||
2016 | 2016 | |
2017 | 2017 | /** @var GF_Field $field */ |
2018 | 2018 | foreach ( $fields as $field ) { |
2019 | - if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
2020 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
2019 | + if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
2020 | + $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field ); |
|
2021 | 2021 | break; |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2040,14 +2040,14 @@ discard block |
||
2040 | 2040 | |
2041 | 2041 | $return_field = $field; |
2042 | 2042 | |
2043 | - if( empty( $field_setting['show_label'] ) ) { |
|
2043 | + if ( empty( $field_setting[ 'show_label' ] ) ) { |
|
2044 | 2044 | $return_field->label = ''; |
2045 | - } elseif ( !empty( $field_setting['custom_label'] ) ) { |
|
2046 | - $return_field->label = $field_setting['custom_label']; |
|
2045 | + } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) { |
|
2046 | + $return_field->label = $field_setting[ 'custom_label' ]; |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | - if( !empty( $field_setting['custom_class'] ) ) { |
|
2050 | - $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] ); |
|
2049 | + if ( ! empty( $field_setting[ 'custom_class' ] ) ) { |
|
2050 | + $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] ); |
|
2051 | 2051 | } |
2052 | 2052 | |
2053 | 2053 | /** |
@@ -2085,16 +2085,16 @@ discard block |
||
2085 | 2085 | */ |
2086 | 2086 | $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
2087 | 2087 | |
2088 | - if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
2089 | - foreach( $fields as $k => $field ) { |
|
2090 | - if( $field->adminOnly ) { |
|
2088 | + if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) { |
|
2089 | + foreach ( $fields as $k => $field ) { |
|
2090 | + if ( $field->adminOnly ) { |
|
2091 | 2091 | unset( $fields[ $k ] ); |
2092 | 2092 | } |
2093 | 2093 | } |
2094 | 2094 | return array_values( $fields ); |
2095 | 2095 | } |
2096 | 2096 | |
2097 | - foreach( $fields as &$field ) { |
|
2097 | + foreach ( $fields as &$field ) { |
|
2098 | 2098 | $field->adminOnly = false; |
2099 | 2099 | } |
2100 | 2100 | |
@@ -2115,7 +2115,7 @@ discard block |
||
2115 | 2115 | */ |
2116 | 2116 | private function unselect_default_values( $form ) { |
2117 | 2117 | |
2118 | - foreach ( $form['fields'] as &$field ) { |
|
2118 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2119 | 2119 | |
2120 | 2120 | if ( empty( $field->choices ) ) { |
2121 | 2121 | continue; |
@@ -2123,7 +2123,7 @@ discard block |
||
2123 | 2123 | |
2124 | 2124 | foreach ( $field->choices as &$choice ) { |
2125 | 2125 | if ( \GV\Utils::get( $choice, 'isSelected' ) ) { |
2126 | - $choice['isSelected'] = false; |
|
2126 | + $choice[ 'isSelected' ] = false; |
|
2127 | 2127 | } |
2128 | 2128 | } |
2129 | 2129 | } |
@@ -2148,22 +2148,22 @@ discard block |
||
2148 | 2148 | */ |
2149 | 2149 | function prefill_conditional_logic( $form ) { |
2150 | 2150 | |
2151 | - if( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
2151 | + if ( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
2152 | 2152 | return $form; |
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | // Have Conditional Logic pre-fill fields as if the data were default values |
2156 | 2156 | /** @var GF_Field $field */ |
2157 | - foreach ( $form['fields'] as &$field ) { |
|
2157 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2158 | 2158 | |
2159 | - if( 'checkbox' === $field->type ) { |
|
2159 | + if ( 'checkbox' === $field->type ) { |
|
2160 | 2160 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
2161 | - $input_id = $input['id']; |
|
2161 | + $input_id = $input[ 'id' ]; |
|
2162 | 2162 | $choice = $field->choices[ $key ]; |
2163 | 2163 | $value = \GV\Utils::get( $this->entry, $input_id ); |
2164 | 2164 | $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
2165 | - if( $match ) { |
|
2166 | - $field->choices[ $key ]['isSelected'] = true; |
|
2165 | + if ( $match ) { |
|
2166 | + $field->choices[ $key ][ 'isSelected' ] = true; |
|
2167 | 2167 | } |
2168 | 2168 | } |
2169 | 2169 | } else { |
@@ -2171,15 +2171,15 @@ discard block |
||
2171 | 2171 | // We need to run through each field to set the default values |
2172 | 2172 | foreach ( $this->entry as $field_id => $field_value ) { |
2173 | 2173 | |
2174 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
2174 | + if ( floatval( $field_id ) === floatval( $field->id ) ) { |
|
2175 | 2175 | |
2176 | - if( 'list' === $field->type ) { |
|
2176 | + if ( 'list' === $field->type ) { |
|
2177 | 2177 | $list_rows = maybe_unserialize( $field_value ); |
2178 | 2178 | |
2179 | 2179 | $list_field_value = array(); |
2180 | - foreach ( (array) $list_rows as $row ) { |
|
2181 | - foreach ( (array) $row as $column ) { |
|
2182 | - $list_field_value[] = $column; |
|
2180 | + foreach ( (array)$list_rows as $row ) { |
|
2181 | + foreach ( (array)$row as $column ) { |
|
2182 | + $list_field_value[ ] = $column; |
|
2183 | 2183 | } |
2184 | 2184 | } |
2185 | 2185 | |
@@ -2212,32 +2212,32 @@ discard block |
||
2212 | 2212 | * @see https://github.com/gravityview/GravityView/issues/840 |
2213 | 2213 | * @since develop |
2214 | 2214 | */ |
2215 | - $the_form = GFAPI::get_form( $form['id'] ); |
|
2215 | + $the_form = GFAPI::get_form( $form[ 'id' ] ); |
|
2216 | 2216 | $editable_ids = array(); |
2217 | - foreach ( $form['fields'] as $field ) { |
|
2218 | - $editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context |
|
2217 | + foreach ( $form[ 'fields' ] as $field ) { |
|
2218 | + $editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context |
|
2219 | 2219 | } |
2220 | 2220 | $remove_conditions_rule = array(); |
2221 | - foreach ( $the_form['fields'] as $field ) { |
|
2222 | - if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) { |
|
2223 | - foreach ( $field->conditionalLogic['rules'] as $i => $rule ) { |
|
2224 | - if ( ! in_array( $rule['fieldId'], $editable_ids ) ) { |
|
2221 | + foreach ( $the_form[ 'fields' ] as $field ) { |
|
2222 | + if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) { |
|
2223 | + foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) { |
|
2224 | + if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) { |
|
2225 | 2225 | /** |
2226 | 2226 | * This conditional field is not editable in this View. |
2227 | 2227 | * We need to remove the rule, but only if it matches. |
2228 | 2228 | */ |
2229 | - if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) { |
|
2229 | + if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) { |
|
2230 | 2230 | $value = $_field->get_value_export( $this->entry ); |
2231 | - } elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) { |
|
2232 | - $value = $this->entry[ $rule['fieldId'] ]; |
|
2231 | + } elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) { |
|
2232 | + $value = $this->entry[ $rule[ 'fieldId' ] ]; |
|
2233 | 2233 | } else { |
2234 | - $value = gform_get_meta( $this->entry['id'], $rule['fieldId'] ); |
|
2234 | + $value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] ); |
|
2235 | 2235 | } |
2236 | 2236 | |
2237 | - $match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] ); |
|
2237 | + $match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] ); |
|
2238 | 2238 | |
2239 | 2239 | if ( $match ) { |
2240 | - $remove_conditions_rule[] = array( $field['id'], $i ); |
|
2240 | + $remove_conditions_rule[ ] = array( $field[ 'id' ], $i ); |
|
2241 | 2241 | } |
2242 | 2242 | } |
2243 | 2243 | } |
@@ -2245,21 +2245,21 @@ discard block |
||
2245 | 2245 | } |
2246 | 2246 | |
2247 | 2247 | if ( $remove_conditions_rule ) { |
2248 | - foreach ( $form['fields'] as &$field ) { |
|
2248 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2249 | 2249 | foreach ( $remove_conditions_rule as $_remove_conditions_r ) { |
2250 | 2250 | |
2251 | 2251 | list( $rule_field_id, $rule_i ) = $_remove_conditions_r; |
2252 | 2252 | |
2253 | - if ( $field['id'] == $rule_field_id ) { |
|
2254 | - unset( $field->conditionalLogic['rules'][ $rule_i ] ); |
|
2255 | - gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) ); |
|
2253 | + if ( $field[ 'id' ] == $rule_field_id ) { |
|
2254 | + unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] ); |
|
2255 | + gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) ); |
|
2256 | 2256 | } |
2257 | 2257 | } |
2258 | 2258 | } |
2259 | 2259 | } |
2260 | 2260 | |
2261 | 2261 | /** Normalize the indices... */ |
2262 | - $form['fields'] = array_values( $form['fields'] ); |
|
2262 | + $form[ 'fields' ] = array_values( $form[ 'fields' ] ); |
|
2263 | 2263 | |
2264 | 2264 | /** |
2265 | 2265 | * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields? |
@@ -2269,16 +2269,16 @@ discard block |
||
2269 | 2269 | */ |
2270 | 2270 | $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form ); |
2271 | 2271 | |
2272 | - if( $use_conditional_logic ) { |
|
2272 | + if ( $use_conditional_logic ) { |
|
2273 | 2273 | return $form; |
2274 | 2274 | } |
2275 | 2275 | |
2276 | - foreach( $form['fields'] as &$field ) { |
|
2276 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
2277 | 2277 | /* @var GF_Field $field */ |
2278 | 2278 | $field->conditionalLogic = null; |
2279 | 2279 | } |
2280 | 2280 | |
2281 | - unset( $form['button']['conditionalLogic'] ); |
|
2281 | + unset( $form[ 'button' ][ 'conditionalLogic' ] ); |
|
2282 | 2282 | |
2283 | 2283 | return $form; |
2284 | 2284 | |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | */ |
2296 | 2296 | public function manage_conditional_logic( $has_conditional_logic, $form ) { |
2297 | 2297 | |
2298 | - if( ! $this->is_edit_entry() ) { |
|
2298 | + if ( ! $this->is_edit_entry() ) { |
|
2299 | 2299 | return $has_conditional_logic; |
2300 | 2300 | } |
2301 | 2301 | |
@@ -2327,44 +2327,44 @@ discard block |
||
2327 | 2327 | * 2. There are two entries embedded using oEmbed |
2328 | 2328 | * 3. One of the entries has just been saved |
2329 | 2329 | */ |
2330 | - if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) { |
|
2330 | + if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) { |
|
2331 | 2331 | |
2332 | 2332 | $error = true; |
2333 | 2333 | |
2334 | 2334 | } |
2335 | 2335 | |
2336 | - if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) { |
|
2336 | + if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) { |
|
2337 | 2337 | |
2338 | 2338 | $error = true; |
2339 | 2339 | |
2340 | - } elseif( ! $this->verify_nonce() ) { |
|
2340 | + } elseif ( ! $this->verify_nonce() ) { |
|
2341 | 2341 | |
2342 | 2342 | /** |
2343 | 2343 | * If the Entry is embedded, there may be two entries on the same page. |
2344 | 2344 | * If that's the case, and one is being edited, the other should fail gracefully and not display an error. |
2345 | 2345 | */ |
2346 | - if( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
2346 | + if ( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
2347 | 2347 | $error = true; |
2348 | 2348 | } else { |
2349 | - $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview'); |
|
2349 | + $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' ); |
|
2350 | 2350 | } |
2351 | 2351 | |
2352 | 2352 | } |
2353 | 2353 | |
2354 | - if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
2355 | - $error = __( 'You do not have permission to edit this entry.', 'gravityview'); |
|
2354 | + if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
2355 | + $error = __( 'You do not have permission to edit this entry.', 'gravityview' ); |
|
2356 | 2356 | } |
2357 | 2357 | |
2358 | - if( $this->entry['status'] === 'trash' ) { |
|
2359 | - $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
2358 | + if ( $this->entry[ 'status' ] === 'trash' ) { |
|
2359 | + $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
2360 | 2360 | } |
2361 | 2361 | |
2362 | 2362 | // No errors; everything's fine here! |
2363 | - if( empty( $error ) ) { |
|
2363 | + if ( empty( $error ) ) { |
|
2364 | 2364 | return true; |
2365 | 2365 | } |
2366 | 2366 | |
2367 | - if( $echo && $error !== true ) { |
|
2367 | + if ( $echo && $error !== true ) { |
|
2368 | 2368 | |
2369 | 2369 | $error = esc_html( $error ); |
2370 | 2370 | |
@@ -2372,10 +2372,10 @@ discard block |
||
2372 | 2372 | * @since 1.9 |
2373 | 2373 | */ |
2374 | 2374 | if ( ! empty( $this->entry ) ) { |
2375 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2375 | + $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
2376 | 2376 | } |
2377 | 2377 | |
2378 | - echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
|
2378 | + echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' ); |
|
2379 | 2379 | } |
2380 | 2380 | |
2381 | 2381 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -2395,17 +2395,17 @@ discard block |
||
2395 | 2395 | |
2396 | 2396 | $error = NULL; |
2397 | 2397 | |
2398 | - if( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2399 | - $error = __( 'You do not have permission to edit this field.', 'gravityview'); |
|
2398 | + if ( ! $this->check_user_cap_edit_field( $field ) ) { |
|
2399 | + $error = __( 'You do not have permission to edit this field.', 'gravityview' ); |
|
2400 | 2400 | } |
2401 | 2401 | |
2402 | 2402 | // No errors; everything's fine here! |
2403 | - if( empty( $error ) ) { |
|
2403 | + if ( empty( $error ) ) { |
|
2404 | 2404 | return true; |
2405 | 2405 | } |
2406 | 2406 | |
2407 | - if( $echo ) { |
|
2408 | - echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error'); |
|
2407 | + if ( $echo ) { |
|
2408 | + echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' ); |
|
2409 | 2409 | } |
2410 | 2410 | |
2411 | 2411 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -2426,14 +2426,14 @@ discard block |
||
2426 | 2426 | private function check_user_cap_edit_field( $field ) { |
2427 | 2427 | |
2428 | 2428 | // If they can edit any entries (as defined in Gravity Forms), we're good. |
2429 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2429 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
2430 | 2430 | return true; |
2431 | 2431 | } |
2432 | 2432 | |
2433 | - $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false; |
|
2433 | + $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false; |
|
2434 | 2434 | |
2435 | - if( $field_cap ) { |
|
2436 | - return GVCommon::has_cap( $field['allow_edit_cap'] ); |
|
2435 | + if ( $field_cap ) { |
|
2436 | + return GVCommon::has_cap( $field[ 'allow_edit_cap' ] ); |
|
2437 | 2437 | } |
2438 | 2438 | |
2439 | 2439 | return false; |
@@ -2447,17 +2447,17 @@ discard block |
||
2447 | 2447 | public function verify_nonce() { |
2448 | 2448 | |
2449 | 2449 | // Verify form submitted for editing single |
2450 | - if( $this->is_edit_entry_submission() ) { |
|
2450 | + if ( $this->is_edit_entry_submission() ) { |
|
2451 | 2451 | $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field ); |
2452 | 2452 | } |
2453 | 2453 | |
2454 | 2454 | // Verify |
2455 | - else if( ! $this->is_edit_entry() ) { |
|
2455 | + else if ( ! $this->is_edit_entry() ) { |
|
2456 | 2456 | $valid = false; |
2457 | 2457 | } |
2458 | 2458 | |
2459 | 2459 | else { |
2460 | - $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
|
2460 | + $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ); |
|
2461 | 2461 | } |
2462 | 2462 | |
2463 | 2463 | /** |
@@ -2517,7 +2517,7 @@ discard block |
||
2517 | 2517 | */ |
2518 | 2518 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id ); |
2519 | 2519 | |
2520 | - return (array) $labels; |
|
2520 | + return (array)$labels; |
|
2521 | 2521 | } |
2522 | 2522 | |
2523 | 2523 | } //end class |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ); |
107 | 107 | |
108 | 108 | if ( ! empty( $action ) ) { |
109 | - $settings['edd_action'] = esc_attr( $action ); |
|
109 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return array_map( 'urlencode', $settings ); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | // If doing ajax, get outta here. |
129 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
129 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | 'format' => 'json', |
174 | 174 | ) ); |
175 | 175 | |
176 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
176 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
177 | 177 | die( -1 ); |
178 | 178 | } |
179 | 179 | |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | |
202 | 202 | $json = json_encode( $license_data ); |
203 | 203 | |
204 | - $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action'); |
|
204 | + $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' ); |
|
205 | 205 | |
206 | 206 | $is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
207 | 207 | |
208 | - do_action('gravityview/admin_installer/delete_downloads_data', true ); |
|
208 | + do_action( 'gravityview/admin_installer/delete_downloads_data', true ); |
|
209 | 209 | |
210 | 210 | if ( $is_check_action_button ) { |
211 | 211 | delete_transient( self::status_transient_key ); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | // most likely a mistake. |
217 | 217 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
218 | 218 | |
219 | - if ( ! empty( $data['field_id'] ) ) { |
|
219 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
220 | 220 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
221 | 221 | } |
222 | 222 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $class = 'hide'; |
245 | 245 | $message = ''; |
246 | 246 | } else { |
247 | - if( ! empty( $license_data->error ) ) { |
|
247 | + if ( ! empty( $license_data->error ) ) { |
|
248 | 248 | $class = 'error'; |
249 | 249 | $string_key = $license_data->error; |
250 | 250 | } else { $class = $license_data->license; |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function license_details( $response = array() ) { |
270 | 270 | |
271 | - $response = (array) $response; |
|
271 | + $response = (array)$response; |
|
272 | 272 | |
273 | 273 | $return = ''; |
274 | 274 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
275 | 275 | |
276 | - if ( ! empty( $response['license_key'] ) ) { |
|
276 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
277 | 277 | $return .= '<h3>' . rtrim( esc_html__( 'License Details:', 'gravityview' ), ':' ) . '</h3>'; |
278 | 278 | |
279 | 279 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | |
285 | - $return .= $this->strings( $response['license'], $response ); |
|
286 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
285 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
286 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
287 | 287 | $response_keys = array( |
288 | 288 | 'license_name' => '', |
289 | 289 | 'license_limit' => '', |
@@ -298,22 +298,22 @@ discard block |
||
298 | 298 | $response = wp_parse_args( $response, $response_keys ); |
299 | 299 | |
300 | 300 | $login_link_class = gravityview()->plugin->is_GF_25() ? 'button button-outline outline' : 'text-link'; |
301 | - $renews_on = ( 'lifetime' === $response['expires'] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ); |
|
302 | - $login_link = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
303 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
304 | - $license_limit = empty( $response['license_limit'] ) ? __( 'Unlimited', 'gravityview' ) : (int) $response['license_limit']; |
|
301 | + $renews_on = ( 'lifetime' === $response[ 'expires' ] ) ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ); |
|
302 | + $login_link = sprintf( '<a href="%s" class="gv-access-account ' . $login_link_class . '" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
303 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
304 | + $license_limit = empty( $response[ 'license_limit' ] ) ? __( 'Unlimited', 'gravityview' ) : (int)$response[ 'license_limit' ]; |
|
305 | 305 | |
306 | 306 | |
307 | 307 | $details = array( |
308 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response['license_name'] ) . '</span>' ), |
|
309 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . '</span>' . $renews_on . $login_link, |
|
310 | - 'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response['site_count'] ), esc_html( $license_limit ) ) . '</span>' . $local_text, |
|
311 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
308 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), '<span class="gv-license-detail">' . esc_html( $response[ 'license_name' ] ) . '</span>' ), |
|
309 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), '<span class="gv-license-detail">' . esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . '</span>' . $renews_on . $login_link, |
|
310 | + 'activations' => sprintf( str_replace( '%d', '%s', esc_html__( 'Activations: %d of %s sites', 'gravityview' ) ), '<span class="gv-license-detail">' . intval( $response[ 'site_count' ] ), esc_html( $license_limit ) ) . '</span>' . $local_text, |
|
311 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
312 | 312 | ); |
313 | 313 | |
314 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
315 | - unset( $details['upgrade'] ); |
|
316 | - $details['licensed_to'] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
314 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
315 | + unset( $details[ 'upgrade' ] ); |
|
316 | + $details[ 'licensed_to' ] .= '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | $return .= '<ul>'; |
@@ -345,20 +345,20 @@ discard block |
||
345 | 345 | if ( ! empty( $upgrades ) ) { |
346 | 346 | |
347 | 347 | $locale_parts = explode( '_', get_locale() ); |
348 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
348 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
349 | 349 | |
350 | 350 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
351 | 351 | $output .= '<ul>'; |
352 | 352 | |
353 | 353 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
354 | - $upgrade = (object) $upgrade; |
|
354 | + $upgrade = (object)$upgrade; |
|
355 | 355 | |
356 | 356 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
357 | 357 | |
358 | 358 | if ( $is_english && isset( $upgrade->description ) ) { |
359 | 359 | $message = esc_html( $upgrade->description ); |
360 | 360 | } else { |
361 | - switch( $upgrade->price_id ) { |
|
361 | + switch ( $upgrade->price_id ) { |
|
362 | 362 | // Interstellar |
363 | 363 | case 1: |
364 | 364 | default: |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'invalid_item_id' => esc_html__( 'This license key does not have access to this plugin.', 'gravityview' ), |
438 | 438 | 'missing' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), // Missing is "the license couldn't be found", not "you submitted an empty license" |
439 | 439 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
440 | - 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
440 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
441 | 441 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
442 | 442 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
443 | 443 | 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | |
466 | 466 | if ( ! empty( $license_data->renewal_url ) ) { |
467 | 467 | $renew_license_url = $license_data->renewal_url; |
468 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
468 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
469 | 469 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
470 | 470 | } else { |
471 | 471 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @return array|\WP_Error |
483 | 483 | */ |
484 | 484 | private function _license_get_remote_response( $data, $license = '' ) { |
485 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
485 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
486 | 486 | |
487 | 487 | $url = add_query_arg( $api_params, self::url ); |
488 | 488 | |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | private function license_call_update_settings( $license_data, $data ) { |
523 | 523 | $settings = array(); |
524 | 524 | |
525 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
526 | - $settings['license_key_status'] = $license_data->license; |
|
527 | - $settings['license_key_response'] = (array)$license_data; |
|
525 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
526 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
527 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
528 | 528 | |
529 | 529 | $this->settings->set( $settings ); |
530 | 530 | } |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | $status = trim( $this->settings->get( 'license_key_status' ) ); |
545 | 545 | $key = trim( $this->settings->get( 'license_key' ) ); |
546 | 546 | |
547 | - if ( !empty( $key ) ) { |
|
547 | + if ( ! empty( $key ) ) { |
|
548 | 548 | $response = $this->settings->get( 'license_key_response' ); |
549 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
549 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
550 | 550 | } else { |
551 | 551 | $response = array(); |
552 | 552 | } |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | |
590 | 590 | $submit = '<div class="gv-edd-button-wrapper">'; |
591 | 591 | foreach ( $fields as $field ) { |
592 | - $field['type'] = 'button'; |
|
593 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
594 | - $field['style'] = 'margin-left: 10px;'; |
|
595 | - if( $disabled_attribute ) { |
|
596 | - $field['disabled'] = $disabled_attribute; |
|
592 | + $field[ 'type' ] = 'button'; |
|
593 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
594 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
595 | + if ( $disabled_attribute ) { |
|
596 | + $field[ 'disabled' ] = $disabled_attribute; |
|
597 | 597 | } |
598 | 598 | $submit .= $this->settings->as_html( $field, $echo ); |
599 | 599 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | 'url' => home_url(), |
672 | 672 | 'site_data' => $this->get_site_data(), |
673 | 673 | ), |
674 | - )); |
|
674 | + ) ); |
|
675 | 675 | |
676 | 676 | // make sure the response came back okay |
677 | 677 | if ( is_wp_error( $response ) ) { |
@@ -701,45 +701,45 @@ discard block |
||
701 | 701 | $theme_data = wp_get_theme(); |
702 | 702 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
703 | 703 | |
704 | - $data['gv_version'] = Plugin::$version; |
|
705 | - $data['php_version'] = phpversion(); |
|
706 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
707 | - $data['gf_version'] = \GFForms::$version; |
|
708 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
709 | - $data['multisite'] = is_multisite(); |
|
710 | - $data['theme'] = $theme; |
|
711 | - $data['url'] = home_url(); |
|
712 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
713 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
704 | + $data[ 'gv_version' ] = Plugin::$version; |
|
705 | + $data[ 'php_version' ] = phpversion(); |
|
706 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
707 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
708 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
709 | + $data[ 'multisite' ] = is_multisite(); |
|
710 | + $data[ 'theme' ] = $theme; |
|
711 | + $data[ 'url' ] = home_url(); |
|
712 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
713 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
714 | 714 | |
715 | 715 | // View Data |
716 | 716 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
717 | 717 | |
718 | - $data['view_count'] = null; |
|
719 | - $data['view_first'] = null; |
|
720 | - $data['view_latest'] = null; |
|
718 | + $data[ 'view_count' ] = null; |
|
719 | + $data[ 'view_first' ] = null; |
|
720 | + $data[ 'view_latest' ] = null; |
|
721 | 721 | |
722 | 722 | if ( $gravityview_posts->publish ) { |
723 | - $data['view_count'] = $gravityview_posts->publish; |
|
723 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
724 | 724 | |
725 | 725 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
726 | 726 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
727 | 727 | |
728 | 728 | if ( $first = array_shift( $first ) ) { |
729 | - $data['view_first'] = $first->post_date; |
|
729 | + $data[ 'view_first' ] = $first->post_date; |
|
730 | 730 | } |
731 | 731 | if ( $latest = array_pop( $latest ) ) { |
732 | - $data['view_latest'] = $latest->post_date; |
|
732 | + $data[ 'view_latest' ] = $latest->post_date; |
|
733 | 733 | } |
734 | 734 | } |
735 | 735 | |
736 | 736 | // Form counts |
737 | 737 | if ( class_exists( 'GFFormsModel' ) ) { |
738 | 738 | $form_data = \GFFormsModel::get_form_count(); |
739 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
740 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
741 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
742 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
739 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
740 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
741 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
742 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | // Retrieve current plugin information |
@@ -747,13 +747,13 @@ discard block |
||
747 | 747 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
748 | 748 | } |
749 | 749 | |
750 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
751 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
752 | - $data['inactive_plugins'] = array(); |
|
753 | - $data['locale'] = get_locale(); |
|
750 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
751 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
752 | + $data[ 'inactive_plugins' ] = array(); |
|
753 | + $data[ 'locale' ] = get_locale(); |
|
754 | 754 | |
755 | 755 | // Validate request on the GV server |
756 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
756 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
757 | 757 | |
758 | 758 | return $data; |
759 | 759 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | |
784 | 784 | $plugin_data = get_plugin_data( $active_plugin ); |
785 | 785 | |
786 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
786 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | if ( ! empty( $extensions ) ) { |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
181 | 181 | |
182 | 182 | // Force the screen to be GravityView |
183 | - $tab['screen'] = 'gravityview'; |
|
183 | + $tab[ 'screen' ] = 'gravityview'; |
|
184 | 184 | |
185 | 185 | if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
186 | - $metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
186 | + $metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
187 | 187 | \GravityView_Metabox_Tabs::add( $metabox ); |
188 | 188 | } else { |
189 | - add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
189 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | */ |
212 | 212 | protected function is_extension_supported() { |
213 | 213 | |
214 | - self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible ); |
|
214 | + self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible ); |
|
215 | 215 | |
216 | 216 | if ( ! function_exists( 'gravityview' ) ) { |
217 | 217 | $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) ); |
218 | - } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) { |
|
219 | - $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
220 | - } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) { |
|
221 | - $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' ); |
|
218 | + } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) { |
|
219 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
220 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
221 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' ); |
|
222 | 222 | } else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) { |
223 | 223 | $message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) ); |
224 | 224 | } else { |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | |
259 | 259 | $locale = get_locale(); |
260 | 260 | |
261 | - if ( function_exists('get_user_locale') && is_admin() ) { |
|
261 | + if ( function_exists( 'get_user_locale' ) && is_admin() ) { |
|
262 | 262 | $locale = get_user_locale(); |
263 | 263 | } |
264 | 264 | |
265 | 265 | // Traditional WordPress plugin locale filter |
266 | - $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
266 | + $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
267 | 267 | |
268 | 268 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
269 | 269 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | public function settings() { |
292 | 292 | |
293 | 293 | // If doing ajax, get outta here. |
294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | 'version' => $this->_version, // current version number |
315 | 315 | 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
316 | 316 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
317 | - 'item_name' => $this->_title, // name of this plugin |
|
318 | - 'author' => strip_tags( $this->_author ), // author of this plugin |
|
317 | + 'item_name' => $this->_title, // name of this plugin |
|
318 | + 'author' => strip_tags( $this->_author ), // author of this plugin |
|
319 | 319 | 'php_version' => phpversion(), |
320 | 320 | 'wp_version' => get_bloginfo( 'version' ), |
321 | 321 | 'gv_version' => \GV\Plugin::$version, |
@@ -347,16 +347,16 @@ discard block |
||
347 | 347 | */ |
348 | 348 | public static function add_notice( $notice = array() ) { |
349 | 349 | |
350 | - if ( is_array( $notice ) && empty( $notice['message'] ) ) { |
|
350 | + if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) { |
|
351 | 351 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
352 | 352 | return; |
353 | 353 | } else if ( is_string( $notice ) ) { |
354 | 354 | $notice = array( 'message' => $notice ); |
355 | 355 | } |
356 | 356 | |
357 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
357 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
358 | 358 | |
359 | - self::$admin_notices []= $notice; |
|
359 | + self::$admin_notices [ ] = $notice; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | } |
371 | 371 | |
372 | 372 | foreach ( self::$admin_notices as $key => $notice ) { |
373 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
374 | - echo wpautop( $notice['message'] ); |
|
373 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
374 | + echo wpautop( $notice[ 'message' ] ); |
|
375 | 375 | echo '<div class="clear"></div>'; |
376 | 376 | echo '</div>'; |
377 | 377 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $this->plugin_file = $_plugin_file; |
50 | 50 | $this->name = plugin_basename( $_plugin_file ); |
51 | 51 | $this->slug = basename( $_plugin_file, '.php' ); |
52 | - $this->version = $_api_data['version']; |
|
53 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
54 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
52 | + $this->version = $_api_data[ 'version' ]; |
|
53 | + $this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false; |
|
54 | + $this->beta = ! empty( $this->api_data[ 'beta' ] ) ? true : false; |
|
55 | 55 | $this->failed_request_cache_key = 'edd_sl_failed_http_' . md5( $this->api_url ); |
56 | 56 | |
57 | 57 | $edd_plugin_data[ $this->slug ] = $this->api_data; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | printf( |
230 | 230 | /* translators: the plugin name. */ |
231 | 231 | esc_html__( 'There is a new version of %1$s available.', 'easy-digital-downloads' ), |
232 | - esc_html( $plugin['Name'] ) |
|
232 | + esc_html( $plugin[ 'Name' ] ) |
|
233 | 233 | ); |
234 | 234 | |
235 | 235 | if ( ! current_user_can( 'update_plugins' ) ) { |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | * @return array |
275 | 275 | */ |
276 | 276 | private function get_active_plugins() { |
277 | - $active_plugins = (array) get_option( 'active_plugins' ); |
|
278 | - $active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' ); |
|
277 | + $active_plugins = (array)get_option( 'active_plugins' ); |
|
278 | + $active_network_plugins = (array)get_site_option( 'active_sitewide_plugins' ); |
|
279 | 279 | |
280 | 280 | return array_merge( $active_plugins, array_keys( $active_network_plugins ) ); |
281 | 281 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | public function http_request_args( $args, $url ) { |
394 | 394 | |
395 | 395 | if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
396 | - $args['sslverify'] = $this->verify_ssl(); |
|
396 | + $args[ 'sslverify' ] = $this->verify_ssl(); |
|
397 | 397 | } |
398 | 398 | return $args; |
399 | 399 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | private function api_request( $_action, $_data ) { |
414 | 414 | $data = array_merge( $this->api_data, $_data ); |
415 | 415 | |
416 | - if ( $data['slug'] !== $this->slug ) { |
|
416 | + if ( $data[ 'slug' ] !== $this->slug ) { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
@@ -477,15 +477,15 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function show_changelog() { |
479 | 479 | |
480 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) { |
|
480 | + if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' !== $_REQUEST[ 'edd_sl_action' ] ) { |
|
481 | 481 | return; |
482 | 482 | } |
483 | 483 | |
484 | - if ( empty( $_REQUEST['plugin'] ) ) { |
|
484 | + if ( empty( $_REQUEST[ 'plugin' ] ) ) { |
|
485 | 485 | return; |
486 | 486 | } |
487 | 487 | |
488 | - if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) { |
|
488 | + if ( empty( $_REQUEST[ 'slug' ] ) || $this->slug !== $_REQUEST[ 'slug' ] ) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | $version_info = $this->get_repo_api_data(); |
497 | 497 | if ( isset( $version_info->sections ) ) { |
498 | 498 | $sections = $this->convert_object_to_array( $version_info->sections ); |
499 | - if ( ! empty( $sections['changelog'] ) ) { |
|
500 | - echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>'; |
|
499 | + if ( ! empty( $sections[ 'changelog' ] ) ) { |
|
500 | + echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>'; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | private function get_version_from_remote() { |
513 | 513 | $api_params = array( |
514 | 514 | 'edd_action' => 'get_version', |
515 | - 'license' => ! empty( $this->api_data['license'] ) ? $this->api_data['license'] : '', |
|
516 | - 'item_name' => isset( $this->api_data['item_name'] ) ? $this->api_data['item_name'] : false, |
|
517 | - 'item_id' => isset( $this->api_data['item_id'] ) ? $this->api_data['item_id'] : false, |
|
518 | - 'version' => isset( $this->api_data['version'] ) ? $this->api_data['version'] : false, |
|
515 | + 'license' => ! empty( $this->api_data[ 'license' ] ) ? $this->api_data[ 'license' ] : '', |
|
516 | + 'item_name' => isset( $this->api_data[ 'item_name' ] ) ? $this->api_data[ 'item_name' ] : false, |
|
517 | + 'item_id' => isset( $this->api_data[ 'item_id' ] ) ? $this->api_data[ 'item_id' ] : false, |
|
518 | + 'version' => isset( $this->api_data[ 'version' ] ) ? $this->api_data[ 'version' ] : false, |
|
519 | 519 | 'slug' => $this->slug, |
520 | - 'author' => $this->api_data['author'], |
|
520 | + 'author' => $this->api_data[ 'author' ], |
|
521 | 521 | 'url' => home_url(), |
522 | 522 | 'beta' => $this->beta, |
523 | 523 | 'php_version' => phpversion(), |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | if ( ! empty( $request->sections ) ) { |
568 | 568 | foreach ( $request->sections as $key => $section ) { |
569 | - $request->$key = (array) $section; |
|
569 | + $request->$key = (array)$section; |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -588,17 +588,17 @@ discard block |
||
588 | 588 | $cache = get_option( $cache_key ); |
589 | 589 | |
590 | 590 | // Cache is expired |
591 | - if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
591 | + if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) { |
|
592 | 592 | return false; |
593 | 593 | } |
594 | 594 | |
595 | 595 | // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point. |
596 | - $cache['value'] = json_decode( $cache['value'] ); |
|
597 | - if ( ! empty( $cache['value']->icons ) ) { |
|
598 | - $cache['value']->icons = (array) $cache['value']->icons; |
|
596 | + $cache[ 'value' ] = json_decode( $cache[ 'value' ] ); |
|
597 | + if ( ! empty( $cache[ 'value' ]->icons ) ) { |
|
598 | + $cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons; |
|
599 | 599 | } |
600 | 600 | |
601 | - return $cache['value']; |
|
601 | + return $cache[ 'value' ]; |
|
602 | 602 | |
603 | 603 | } |
604 | 604 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | update_option( $cache_key, $data, 'no' ); |
623 | 623 | |
624 | 624 | // Delete the duplicate option |
625 | - delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) ); |
|
625 | + delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) ); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return bool |
633 | 633 | */ |
634 | 634 | private function verify_ssl() { |
635 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
635 | + return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @return string |
643 | 643 | */ |
644 | 644 | private function get_cache_key() { |
645 | - $string = $this->slug . $this->api_data['license'] . $this->beta; |
|
645 | + $string = $this->slug . $this->api_data[ 'license' ] . $this->beta; |
|
646 | 646 | |
647 | 647 | return 'edd_sl_' . md5( serialize( $string ) ); |
648 | 648 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
55 | 55 | |
56 | - if( 'field' === $field_type ) { |
|
56 | + if ( 'field' === $field_type ) { |
|
57 | 57 | |
58 | 58 | // Default options - fields |
59 | 59 | $field_options = array( |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | ); |
106 | 106 | |
107 | 107 | // Match Table as well as DataTables |
108 | - if( $is_table_layout && 'directory' === $context ) { |
|
109 | - $field_options['width'] = array( |
|
108 | + if ( $is_table_layout && 'directory' === $context ) { |
|
109 | + $field_options[ 'width' ] = array( |
|
110 | 110 | 'type' => 'number', |
111 | - 'label' => __('Percent Width', 'gravityview'), |
|
112 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
111 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
112 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
113 | 113 | 'class' => 'code widefat', |
114 | 114 | 'value' => '', |
115 | 115 | 'priority' => 200, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. |
123 | 123 | foreach ( $field_options as $key => $field_option ) { |
124 | - $field_options[ $key ]['label'] = trim( $field_option['label'], ':' ); |
|
124 | + $field_options[ $key ][ 'label' ] = trim( $field_option[ 'label' ], ':' ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
148 | 148 | |
149 | - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) && ! isset( $field_options['new_window'] ) ) { |
|
150 | - $field_options['new_window'] = array( |
|
149 | + if ( 'directory' === $context && isset( $field_options[ 'show_as_link' ] ) && ! isset( $field_options[ 'new_window' ] ) ) { |
|
150 | + $field_options[ 'new_window' ] = array( |
|
151 | 151 | 'type' => 'checkbox', |
152 | 152 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
153 | 153 | 'value' => false, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | switch ( $key ) { |
169 | 169 | case 'show_as_link': |
170 | 170 | $_group = 'display'; |
171 | - $field_option['priority'] = 100; |
|
171 | + $field_option[ 'priority' ] = 100; |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | $_group = \GV\Utils::get( $field_option, 'group', 'display' ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $field_options = array(); |
186 | - foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
186 | + foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
187 | 187 | $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); |
188 | 188 | } |
189 | 189 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return 0; |
215 | 215 | } |
216 | 216 | |
217 | - return ( $a_priority < $b_priority ) ? - 1 : 1; |
|
217 | + return ( $a_priority < $b_priority ) ? -1 : 1; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
240 | 240 | ); |
241 | 241 | |
242 | - if( is_multisite() ) { |
|
243 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
242 | + if ( is_multisite() ) { |
|
243 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
254 | 254 | * @param string $input_type Optional. (textarea, list, select, etc.) |
255 | 255 | */ |
256 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
256 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
257 | 257 | |
258 | 258 | return $select_cap_choices; |
259 | 259 | } |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
282 | 282 | |
283 | - if( empty( $uniqid ) ) { |
|
283 | + if ( empty( $uniqid ) ) { |
|
284 | 284 | //generate a unique field id |
285 | - $uniqid = uniqid('', false); |
|
285 | + $uniqid = uniqid( '', false ); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | $grouped = ( 'field' === $field_type ); |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | // get field/widget options |
291 | 291 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
292 | 292 | |
293 | - if( ! $grouped ) { |
|
293 | + if ( ! $grouped ) { |
|
294 | 294 | $option_groups = array( $option_groups ); |
295 | 295 | } |
296 | 296 | |
297 | 297 | $option_groups = array_filter( $option_groups ); |
298 | 298 | |
299 | 299 | // two different post arrays, depending of the field type |
300 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
300 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
301 | 301 | |
302 | 302 | // build output |
303 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
304 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
303 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
304 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
305 | 305 | |
306 | 306 | $form_title = ''; |
307 | 307 | if ( $form_id ) { |
308 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
308 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
309 | 309 | $form = GVCommon::get_form( $form_id ); |
310 | - $form_title = $form['title']; |
|
310 | + $form_title = $form[ 'title' ]; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | // If there are no options, return what we got. |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
316 | 316 | } |
317 | 317 | |
318 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
318 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
319 | 319 | |
320 | 320 | $field_details = ''; |
321 | 321 | |
322 | 322 | // Get the pretty name for the input type |
323 | 323 | $gv_field = GravityView_Fields::get( $input_type ); |
324 | 324 | |
325 | - if( $gv_field ) { |
|
325 | + if ( $gv_field ) { |
|
326 | 326 | $input_type_label = $gv_field->label; |
327 | 327 | } else { |
328 | 328 | $input_type_label = $input_type; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | if ( $grouped ) { |
339 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
339 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
340 | 340 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
341 | 341 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
342 | 342 | } |
@@ -353,15 +353,15 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | $show_if = ''; |
356 | - if ( ! empty( $option['requires'] ) ) { |
|
357 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
356 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
357 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( ! empty( $option['requires_not'] ) ) { |
|
361 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
360 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
361 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
362 | 362 | } |
363 | 363 | |
364 | - switch ( $option['type'] ) { |
|
364 | + switch ( $option[ 'type' ] ) { |
|
365 | 365 | // Hide hidden fields |
366 | 366 | case 'hidden': |
367 | 367 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -379,30 +379,30 @@ discard block |
||
379 | 379 | $item_details = ''; |
380 | 380 | $subtitle = ''; |
381 | 381 | |
382 | - if( 'field' === $field_type ) { |
|
383 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
382 | + if ( 'field' === $field_type ) { |
|
383 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
384 | 384 | |
385 | 385 | $item_details .= ' |
386 | 386 | <div class="gv-field-details--container"> |
387 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label> |
|
387 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label> |
|
388 | 388 | <section class="gv-field-details gv-field-details--closed">'; |
389 | 389 | |
390 | 390 | if ( $field_id && is_numeric( $field_id ) ) { |
391 | 391 | $item_details .= ' |
392 | 392 | <div class="gv-field-detail gv-field-detail--field"> |
393 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
393 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
394 | 394 | </div>'; |
395 | 395 | } |
396 | 396 | |
397 | 397 | $item_details .= ' |
398 | 398 | <div class="gv-field-detail gv-field-detail--type"> |
399 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
399 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
400 | 400 | </div>'; |
401 | 401 | |
402 | - if( $form_id ) { |
|
402 | + if ( $form_id ) { |
|
403 | 403 | $item_details .= ' |
404 | 404 | <div class="gv-field-detail gv-field-detail--form"> |
405 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
405 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
406 | 406 | </div>'; |
407 | 407 | } |
408 | 408 | $item_details .= ' |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | </div>'; |
411 | 411 | } else { |
412 | 412 | $widget_details_content = rgar( $item, 'description', '' ); |
413 | - if ( ! empty( $item['subtitle'] ) ) { |
|
414 | - $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item['subtitle'] : $item['subtitle']; |
|
413 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
414 | + $widget_details_content .= ( '' !== $widget_details_content ) ? "\n\n" . $item[ 'subtitle' ] : $item[ 'subtitle' ]; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | // Intentionally not escaping to allow HTML. |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | * @deprecated setting index 'default' was replaced by 'value' |
468 | 468 | * @see GravityView_FieldType::get_field_defaults |
469 | 469 | */ |
470 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
471 | - $option['value'] = $option['default']; |
|
472 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
470 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
471 | + $option[ 'value' ] = $option[ 'default' ]; |
|
472 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | // prepare to render option field type |
476 | - if( isset( $option['type'] ) ) { |
|
476 | + if ( isset( $option[ 'type' ] ) ) { |
|
477 | 477 | |
478 | 478 | $type_class = self::load_type_class( $option ); |
479 | 479 | |
480 | - if( class_exists( $type_class ) ) { |
|
480 | + if ( class_exists( $type_class ) ) { |
|
481 | 481 | |
482 | 482 | /** @type GravityView_FieldType $render_type */ |
483 | 483 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @param[in,out] string $output field class name |
495 | 495 | * @param[in] array $option option field data |
496 | 496 | */ |
497 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
497 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | } // isset option[type] |
@@ -529,27 +529,27 @@ discard block |
||
529 | 529 | * @deprecated setting index 'name' was replaced by 'label' |
530 | 530 | * @see GravityView_FieldType::get_field_defaults |
531 | 531 | */ |
532 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
533 | - $setting['label'] = $setting['name']; |
|
534 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
532 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
533 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
534 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | $name = esc_attr( sprintf( $name, $key ) ); |
538 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
539 | - $setting['tooltip'] = 'gv_' . $key; |
|
538 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
539 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
540 | 540 | |
541 | 541 | // Use default if current setting isn't set. |
542 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
542 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
543 | 543 | |
544 | 544 | // default setting type = text |
545 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
545 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
546 | 546 | |
547 | 547 | // merge tags |
548 | - if( !isset( $setting['merge_tags'] ) ) { |
|
549 | - if( $setting['type'] === 'text' ) { |
|
550 | - $setting['merge_tags'] = true; |
|
548 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
549 | + if ( $setting[ 'type' ] === 'text' ) { |
|
550 | + $setting[ 'merge_tags' ] = true; |
|
551 | 551 | } else { |
552 | - $setting['merge_tags'] = false; |
|
552 | + $setting[ 'merge_tags' ] = false; |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // render the setting |
559 | 559 | $type_class = self::load_type_class( $setting ); |
560 | - if( class_exists( $type_class ) ) { |
|
560 | + if ( class_exists( $type_class ) ) { |
|
561 | 561 | /** @type GravityView_FieldType $render_type */ |
562 | 562 | $render_type = new $type_class( $name, $setting, $curr_value ); |
563 | 563 | ob_start(); |
@@ -566,25 +566,25 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | // Check if setting is specific for a template |
569 | - if( !empty( $setting['show_in_template'] ) ) { |
|
570 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
571 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
569 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
570 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
571 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
572 | 572 | } |
573 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
573 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
574 | 574 | } else { |
575 | 575 | $show_if = ''; |
576 | 576 | } |
577 | 577 | |
578 | - if( ! empty( $setting['requires'] ) ) { |
|
579 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
578 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
579 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
580 | 580 | } |
581 | 581 | |
582 | - if( ! empty( $setting['requires_not'] ) ) { |
|
583 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
582 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
583 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | // output |
587 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
587 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
588 | 588 | |
589 | 589 | } |
590 | 590 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public static function load_type_class( $field = NULL ) { |
598 | 598 | |
599 | - if( empty( $field['type'] ) ) { |
|
599 | + if ( empty( $field[ 'type' ] ) ) { |
|
600 | 600 | return NULL; |
601 | 601 | } |
602 | 602 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
606 | 606 | * @param array $field field data |
607 | 607 | */ |
608 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
608 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
609 | 609 | |
610 | - if( class_exists( $type_class ) ) { |
|
610 | + if ( class_exists( $type_class ) ) { |
|
611 | 611 | return $type_class; |
612 | 612 | } |
613 | 613 | |
@@ -616,9 +616,9 @@ discard block |
||
616 | 616 | * @param string $field_type_include_path field class file path |
617 | 617 | * @param array $field field data |
618 | 618 | */ |
619 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
619 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
620 | 620 | |
621 | - if( $class_file && file_exists( $class_file ) ) { |
|
621 | + if ( $class_file && file_exists( $class_file ) ) { |
|
622 | 622 | require_once( $class_file ); |
623 | 623 | } |
624 | 624 | |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | |
641 | 641 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
642 | 642 | |
643 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
644 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
643 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
644 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
645 | 645 | |
646 | 646 | return $output; |
647 | 647 | } |
@@ -661,22 +661,22 @@ discard block |
||
661 | 661 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
662 | 662 | |
663 | 663 | // Show the merge tags if the field is a list view |
664 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
664 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
665 | 665 | |
666 | 666 | // Or is a single entry view |
667 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
667 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
668 | 668 | $show = ( $is_single || $is_list ); |
669 | 669 | |
670 | 670 | $class = ''; |
671 | 671 | // and $add_merge_tags is not false |
672 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
672 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
673 | 673 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
674 | 674 | } |
675 | 675 | |
676 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
677 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
676 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
677 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
678 | 678 | |
679 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
679 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -693,21 +693,21 @@ discard block |
||
693 | 693 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
694 | 694 | |
695 | 695 | // Show the merge tags if the field is a list view |
696 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
696 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
697 | 697 | |
698 | 698 | // Or is a single entry view |
699 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
699 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
700 | 700 | $show = ( $is_single || $is_list ); |
701 | 701 | |
702 | 702 | $class = ''; |
703 | 703 | // and $add_merge_tags is not false |
704 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
704 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
705 | 705 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
706 | 706 | } |
707 | 707 | |
708 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
708 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
709 | 709 | |
710 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
710 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | |
724 | 724 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
725 | 725 | |
726 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
727 | - foreach( $choices as $value => $label ) { |
|
728 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
726 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
727 | + foreach ( $choices as $value => $label ) { |
|
728 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
729 | 729 | } |
730 | 730 | $output .= '</select>'; |
731 | 731 |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 ); |
28 | 28 | |
29 | 29 | // Tooltips |
30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
31 | 31 | |
32 | 32 | add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) ); |
33 | 33 | |
34 | 34 | // adding styles and scripts |
35 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
36 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
39 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
40 | - |
|
41 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
42 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
43 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
35 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
36 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
39 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
40 | + |
|
41 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
42 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
43 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
47 | 47 | |
48 | 48 | // @todo check if this hook is needed.. |
49 | 49 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
50 | 50 | |
51 | 51 | // Add Connected Form column |
52 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
52 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
53 | 53 | |
54 | 54 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
55 | 55 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
56 | 56 | |
57 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
57 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
58 | 58 | |
59 | 59 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
60 | 60 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $major_version = explode( '.', GFForms::$version ); |
87 | 87 | |
88 | 88 | if ( 2 <= sizeof( $major_version ) ) { |
89 | - $class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] ); |
|
89 | + $class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $class; |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | */ |
102 | 102 | function suggest_support_articles( $localization_data = array() ) { |
103 | 103 | |
104 | - if( ! gravityview()->request->is_view() ) { |
|
104 | + if ( ! gravityview()->request->is_view() ) { |
|
105 | 105 | return $localization_data; |
106 | 106 | } |
107 | 107 | |
108 | - $localization_data['suggest'] = array( |
|
108 | + $localization_data[ 'suggest' ] = array( |
|
109 | 109 | '57ef23539033602e61d4a560', |
110 | 110 | '54c67bb9e4b0512429885513', |
111 | 111 | '54c67bb9e4b0512429885512', |
@@ -134,20 +134,20 @@ discard block |
||
134 | 134 | return; |
135 | 135 | } |
136 | 136 | |
137 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
137 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
141 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
145 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
146 | 146 | |
147 | 147 | $meta_query = array(); |
148 | 148 | |
149 | 149 | if ( $form_id ) { |
150 | - $meta_query[] = array( |
|
150 | + $meta_query[ ] = array( |
|
151 | 151 | 'key' => '_gravityview_form_id', |
152 | 152 | 'value' => $form_id, |
153 | 153 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
157 | 157 | |
158 | 158 | if ( $layout_id ) { |
159 | - $meta_query[] = array( |
|
159 | + $meta_query[ ] = array( |
|
160 | 160 | 'key' => '_gravityview_directory_template', |
161 | 161 | 'value' => esc_attr( $layout_id ), |
162 | 162 | ); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function add_view_dropdown() { |
174 | 174 | $current_screen = get_current_screen(); |
175 | 175 | |
176 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
176 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
182 | 182 | |
183 | 183 | // If there are no forms to select, show no forms. |
184 | - if( ! empty( $forms ) ) { ?> |
|
184 | + if ( ! empty( $forms ) ) { ?> |
|
185 | 185 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label> |
186 | 186 | <select name="gravityview_form_id" id="gravityview_form_id"> |
187 | 187 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
188 | - <?php foreach( $forms as $form ) { ?> |
|
189 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
188 | + <?php foreach ( $forms as $form ) { ?> |
|
189 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
190 | 190 | <?php } ?> |
191 | 191 | </select> |
192 | 192 | <?php } |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
196 | 196 | |
197 | 197 | // If there are no forms to select, show no forms. |
198 | - if( ! empty( $layouts ) ) { ?> |
|
198 | + if ( ! empty( $layouts ) ) { ?> |
|
199 | 199 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label> |
200 | 200 | <select name="gravityview_layout" id="gravityview_layout_name"> |
201 | 201 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option> |
202 | 202 | <optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>"> |
203 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
204 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
203 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
204 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | ?> |
208 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
208 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
209 | 209 | <?php } ?> |
210 | 210 | </optgroup> |
211 | 211 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>"> |
212 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
213 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
212 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
213 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
214 | 214 | continue; |
215 | 215 | } |
216 | 216 | ?> |
217 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
217 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
218 | 218 | <?php } ?> |
219 | 219 | </optgroup> |
220 | 220 | </select> |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
230 | 230 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
231 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
231 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | |
259 | 259 | $priority = 0; |
260 | 260 | |
261 | - if( 'form_list' === GFForms::get_page() ) { |
|
261 | + if ( 'form_list' === GFForms::get_page() ) { |
|
262 | 262 | $priority = 790; |
263 | 263 | } |
264 | 264 | |
265 | - if( empty( $connected_views ) ) { |
|
265 | + if ( empty( $connected_views ) ) { |
|
266 | 266 | |
267 | - $menu_items['gravityview'] = array( |
|
267 | + $menu_items[ 'gravityview' ] = array( |
|
268 | 268 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
269 | 269 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
270 | 270 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -280,23 +280,23 @@ discard block |
||
280 | 280 | $sub_menu_items = array(); |
281 | 281 | foreach ( (array)$connected_views as $view ) { |
282 | 282 | |
283 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
283 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 | |
287 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
287 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
288 | 288 | |
289 | - $sub_menu_items[] = array( |
|
289 | + $sub_menu_items[ ] = array( |
|
290 | 290 | 'label' => esc_attr( $label ), |
291 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
291 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
292 | 292 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
293 | 293 | ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | // If there were no items added, then let's create the parent menu |
297 | - if( $sub_menu_items ) { |
|
297 | + if ( $sub_menu_items ) { |
|
298 | 298 | |
299 | - $sub_menu_items[] = array( |
|
299 | + $sub_menu_items[ ] = array( |
|
300 | 300 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
301 | 301 | 'icon' => '<span class="dashicons dashicons-plus"></span>', |
302 | 302 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | ); |
306 | 306 | |
307 | 307 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
308 | - $sub_menu_items[] = array( |
|
308 | + $sub_menu_items[ ] = array( |
|
309 | 309 | 'url' => '#', |
310 | 310 | 'label' => '', |
311 | 311 | 'menu_class' => 'hidden', |
312 | 312 | 'capabilities' => '', |
313 | 313 | ); |
314 | 314 | |
315 | - $menu_items['gravityview'] = array( |
|
315 | + $menu_items[ 'gravityview' ] = array( |
|
316 | 316 | 'label' => __( 'Connected Views', 'gravityview' ), |
317 | 317 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
318 | 318 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | $add = array( 'captcha', 'page' ); |
344 | 344 | |
345 | 345 | // Don't allowing editing the following values: |
346 | - if( $context === 'edit' ) { |
|
347 | - $add[] = 'post_id'; |
|
346 | + if ( $context === 'edit' ) { |
|
347 | + $add[ ] = 'post_id'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $return = array_merge( $array, $add ); |
@@ -375,27 +375,27 @@ discard block |
||
375 | 375 | foreach ( $default_args as $key => $arg ) { |
376 | 376 | |
377 | 377 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
378 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
378 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
379 | 379 | |
380 | 380 | // By default, use `tooltip` if defined. |
381 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
381 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
382 | 382 | |
383 | 383 | // If there's no tooltip set, continue |
384 | - if( empty( $tooltip ) ) { |
|
384 | + if ( empty( $tooltip ) ) { |
|
385 | 385 | continue; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Add the tooltip |
389 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
390 | - 'title' => $arg['label'], |
|
389 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
390 | + 'title' => $arg[ 'label' ], |
|
391 | 391 | 'value' => $tooltip, |
392 | 392 | ); |
393 | 393 | |
394 | 394 | } |
395 | 395 | |
396 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
397 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
398 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
396 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
397 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
398 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
399 | 399 | ); |
400 | 400 | |
401 | 401 | /** |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | |
414 | 414 | foreach ( $gv_tooltips as $key => $tooltip ) { |
415 | 415 | |
416 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
416 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
417 | 417 | |
418 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
418 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | return $tooltips; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * |
430 | 430 | * @return void |
431 | 431 | */ |
432 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
432 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
433 | 433 | |
434 | 434 | $output = ''; |
435 | 435 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
452 | 452 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
453 | 453 | |
454 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
454 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
455 | 455 | |
456 | 456 | break; |
457 | 457 | |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
493 | 493 | |
494 | 494 | // Either the form is empty or the form ID is 0, not yet set. |
495 | - if( empty( $form ) ) { |
|
495 | + if ( empty( $form ) ) { |
|
496 | 496 | return ''; |
497 | 497 | } |
498 | 498 | |
499 | 499 | // The $form is passed as the form ID |
500 | - if( !is_array( $form ) ) { |
|
500 | + if ( ! is_array( $form ) ) { |
|
501 | 501 | $form = gravityview_get_form( $form ); |
502 | 502 | } |
503 | 503 | |
@@ -505,35 +505,35 @@ discard block |
||
505 | 505 | return ''; |
506 | 506 | } |
507 | 507 | |
508 | - $form_id = $form['id']; |
|
508 | + $form_id = $form[ 'id' ]; |
|
509 | 509 | $links = array(); |
510 | 510 | |
511 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
511 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
512 | 512 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
513 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
514 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
513 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
514 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
515 | 515 | } else { |
516 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
516 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
517 | 517 | } |
518 | 518 | |
519 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
519 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
520 | 520 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
521 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
521 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
522 | 522 | } |
523 | 523 | |
524 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
524 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
525 | 525 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
526 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
526 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
527 | 527 | } |
528 | 528 | |
529 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
529 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
530 | 530 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
531 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
531 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | $output = ''; |
535 | 535 | |
536 | - if( !empty( $include_form_link ) ) { |
|
536 | + if ( ! empty( $include_form_link ) ) { |
|
537 | 537 | $output .= $form_link; |
538 | 538 | } |
539 | 539 | |
@@ -548,11 +548,11 @@ discard block |
||
548 | 548 | $css_class = 'row-actions'; |
549 | 549 | |
550 | 550 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
551 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
551 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
552 | 552 | $css_class = 'row-actions visible'; |
553 | 553 | } |
554 | 554 | |
555 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
555 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
556 | 556 | |
557 | 557 | return $output; |
558 | 558 | } |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | // Get the date column and save it for later to add back in. |
567 | 567 | // This adds it after the Data Source column. |
568 | 568 | // This way, we don't need to do array_slice, array_merge, etc. |
569 | - $date = $columns['date']; |
|
570 | - unset( $columns['date'] ); |
|
569 | + $date = $columns[ 'date' ]; |
|
570 | + unset( $columns[ 'date' ] ); |
|
571 | 571 | |
572 | 572 | $data_source_required_caps = array( |
573 | 573 | 'gravityforms_edit_forms', |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | 'gravityforms_preview_forms', |
579 | 579 | ); |
580 | 580 | |
581 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
582 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
581 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
582 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
583 | 583 | } |
584 | 584 | |
585 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
585 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
586 | 586 | |
587 | 587 | // Add the date back in. |
588 | - $columns['date'] = $date; |
|
588 | + $columns[ 'date' ] = $date; |
|
589 | 589 | |
590 | 590 | return $columns; |
591 | 591 | } |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | */ |
599 | 599 | function save_postdata( $post_id ) { |
600 | 600 | |
601 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
601 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | |
605 | 605 | // validate post_type |
606 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
606 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
607 | 607 | return; |
608 | 608 | } |
609 | 609 | |
@@ -618,63 +618,63 @@ discard block |
||
618 | 618 | $statii = array(); |
619 | 619 | |
620 | 620 | // check if this is a start fresh View |
621 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
621 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
622 | 622 | |
623 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
623 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
624 | 624 | // save form id |
625 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
625 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
629 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
629 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
630 | 630 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
631 | 631 | return; |
632 | 632 | } |
633 | 633 | |
634 | 634 | // Was this a start fresh? |
635 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
636 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
635 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
636 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
637 | 637 | } else { |
638 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
638 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | // Check if we have a template id |
642 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
642 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
643 | 643 | |
644 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
644 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
645 | 645 | |
646 | 646 | // now save template id |
647 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
647 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
651 | 651 | // save View Configuration metabox |
652 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
652 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
653 | 653 | |
654 | 654 | // template settings |
655 | - if( empty( $_POST['template_settings'] ) ) { |
|
656 | - $_POST['template_settings'] = array(); |
|
655 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
656 | + $_POST[ 'template_settings' ] = array(); |
|
657 | 657 | } |
658 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
658 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
659 | 659 | |
660 | 660 | // guard against unloaded View configuration page |
661 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
661 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
662 | 662 | $fields = array(); |
663 | 663 | |
664 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
664 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
665 | 665 | $fields = _gravityview_process_posted_fields(); |
666 | 666 | } |
667 | 667 | |
668 | 668 | $fields = wp_slash( $fields ); |
669 | 669 | |
670 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
670 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | // Directory Visible Widgets |
674 | - if( empty( $_POST['widgets'] ) ) { |
|
675 | - $_POST['widgets'] = array(); |
|
674 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
675 | + $_POST[ 'widgets' ] = array(); |
|
676 | 676 | } |
677 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
677 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
678 | 678 | |
679 | 679 | } // end save view configuration |
680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
685 | 685 | * @since 1.17.2 |
686 | 686 | */ |
687 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
687 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
688 | 688 | |
689 | 689 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
690 | 690 | } |
@@ -735,20 +735,20 @@ discard block |
||
735 | 735 | |
736 | 736 | $output = ''; |
737 | 737 | |
738 | - if( !empty( $fields ) ) { |
|
738 | + if ( ! empty( $fields ) ) { |
|
739 | 739 | |
740 | - foreach( $fields as $id => $details ) { |
|
740 | + foreach ( $fields as $id => $details ) { |
|
741 | 741 | |
742 | - if( in_array( $details['type'], (array) $blocklist_field_types ) ) { |
|
742 | + if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) { |
|
743 | 743 | continue; |
744 | 744 | } |
745 | 745 | |
746 | 746 | // Edit mode only allows editing the parent fields, not single inputs. |
747 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
747 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
748 | 748 | continue; |
749 | 749 | } |
750 | 750 | |
751 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
751 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
752 | 752 | |
753 | 753 | } // End foreach |
754 | 754 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | echo $output; |
757 | 757 | |
758 | 758 | // For the EDIT view we only want to allow the form fields. |
759 | - if( $context === 'edit' ) { |
|
759 | + if ( $context === 'edit' ) { |
|
760 | 760 | return; |
761 | 761 | } |
762 | 762 | |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $additional_fields = array( |
776 | 776 | array( |
777 | 777 | 'label_text' => __( 'Add All Form Fields', 'gravityview' ), |
778 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
778 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
779 | 779 | 'field_id' => 'all-fields', |
780 | 780 | 'label_type' => 'field', |
781 | 781 | 'input_type' => null, |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
793 | 793 | |
794 | - foreach ( (array) $additional_fields as $item ) { |
|
794 | + foreach ( (array)$additional_fields as $item ) { |
|
795 | 795 | |
796 | 796 | // Prevent items from not having index set |
797 | 797 | $item = wp_parse_args( $item, array( |
@@ -802,16 +802,16 @@ discard block |
||
802 | 802 | 'field_options' => null, |
803 | 803 | 'settings_html' => null, |
804 | 804 | 'icon' => null, |
805 | - )); |
|
805 | + ) ); |
|
806 | 806 | |
807 | 807 | // Backward compat. |
808 | - if( !empty( $item['field_options'] ) ) { |
|
808 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
809 | 809 | // Use settings_html from now on. |
810 | - $item['settings_html'] = $item['field_options']; |
|
810 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | // Render a label for each of them |
814 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
814 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
815 | 815 | |
816 | 816 | } |
817 | 817 | |
@@ -823,12 +823,12 @@ discard block |
||
823 | 823 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
824 | 824 | * @return array |
825 | 825 | */ |
826 | - function get_entry_default_fields($form, $zone) { |
|
826 | + function get_entry_default_fields( $form, $zone ) { |
|
827 | 827 | |
828 | 828 | $entry_default_fields = array(); |
829 | 829 | |
830 | 830 | // if in zone directory or single |
831 | - if( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
831 | + if ( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
832 | 832 | |
833 | 833 | $meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) ); |
834 | 834 | |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | * @param string|array $form form_ID or form object |
846 | 846 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
847 | 847 | */ |
848 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
848 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | /** |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | */ |
857 | 857 | function get_available_fields( $form = '', $zone = NULL ) { |
858 | 858 | |
859 | - if( empty( $form ) ) { |
|
859 | + if ( empty( $form ) ) { |
|
860 | 860 | gravityview()->log->error( '$form is empty' ); |
861 | 861 | return array(); |
862 | 862 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | $fields = gravityview_get_form_fields( $form, true ); |
866 | 866 | |
867 | 867 | // get meta fields ( only if form was already created ) |
868 | - if( !is_array( $form ) ) { |
|
868 | + if ( ! is_array( $form ) ) { |
|
869 | 869 | $meta_fields = gravityview_get_entry_meta( $form ); |
870 | 870 | } else { |
871 | 871 | $meta_fields = array(); |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | $fields = $fields + $meta_fields + $default_fields; |
879 | 879 | |
880 | 880 | // Move Custom Content to top |
881 | - if ( isset( $fields['custom'] ) ) { |
|
882 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
881 | + if ( isset( $fields[ 'custom' ] ) ) { |
|
882 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | $gv_fields = GravityView_Fields::get_all(); |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | foreach ( $fields as &$field ) { |
888 | 888 | foreach ( $gv_fields as $gv_field ) { |
889 | 889 | if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) { |
890 | - $field['icon'] = \GV\Utils::get( $gv_field, 'icon' ); |
|
890 | + $field[ 'icon' ] = \GV\Utils::get( $gv_field, 'icon' ); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | } |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | } |
916 | 916 | |
917 | 917 | foreach ( $widgets as $id => $details ) { |
918 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
918 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
946 | 946 | global $post; |
947 | 947 | |
948 | - if( $type === 'widget' ) { |
|
948 | + if ( $type === 'widget' ) { |
|
949 | 949 | $button_label = __( 'Add Widget', 'gravityview' ); |
950 | 950 | } else { |
951 | 951 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | $form_id = null; |
972 | 972 | |
973 | 973 | // if saved values, get available fields to label everyone |
974 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
974 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
975 | 975 | |
976 | - if( !empty( $_POST['template_id'] ) ) { |
|
977 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
976 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
977 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
978 | 978 | } else { |
979 | 979 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
980 | 980 | } |
@@ -992,53 +992,53 @@ discard block |
||
992 | 992 | } |
993 | 993 | } |
994 | 994 | |
995 | - foreach( $rows as $row ) : |
|
996 | - foreach( $row as $col => $areas ) : |
|
997 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
995 | + foreach ( $rows as $row ) : |
|
996 | + foreach ( $row as $col => $areas ) : |
|
997 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
998 | 998 | |
999 | 999 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
1000 | 1000 | |
1001 | - <?php foreach( $areas as $area ) : ?> |
|
1001 | + <?php foreach ( $areas as $area ) : ?> |
|
1002 | 1002 | |
1003 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1004 | - <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1005 | - <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong> |
|
1003 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1004 | + <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1005 | + <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong> |
|
1006 | 1006 | |
1007 | 1007 | <?php if ( 'widget' !== $type ) { ?> |
1008 | - <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a> |
|
1008 | + <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a> |
|
1009 | 1009 | <?php } ?> |
1010 | 1010 | |
1011 | - <?php if ( ! empty( $area['subtitle'] ) ) { ?> |
|
1012 | - <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span> |
|
1011 | + <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?> |
|
1012 | + <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span> |
|
1013 | 1013 | <?php } ?> |
1014 | 1014 | </p> |
1015 | 1015 | <div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>"> |
1016 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields |
|
1017 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
1016 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields |
|
1017 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
1018 | 1018 | |
1019 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
1019 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
1020 | 1020 | |
1021 | 1021 | // Maybe has a form ID |
1022 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
1022 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
1023 | 1023 | |
1024 | 1024 | $input_type = NULL; |
1025 | 1025 | |
1026 | 1026 | if ( $form_id ) { |
1027 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
1027 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
1028 | 1028 | } else { |
1029 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
1029 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - if ( !$original_item ) { |
|
1033 | - 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(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
1032 | + if ( ! $original_item ) { |
|
1033 | + 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( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
1034 | 1034 | |
1035 | 1035 | $original_item = $field; |
1036 | 1036 | } else { |
1037 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
1037 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | // Field options dialog box |
1041 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1041 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1042 | 1042 | |
1043 | 1043 | $item = array( |
1044 | 1044 | 'input_type' => $input_type, |
@@ -1051,12 +1051,12 @@ discard block |
||
1051 | 1051 | $item = wp_parse_args( $item, $original_item ); |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - switch( $type ) { |
|
1054 | + switch ( $type ) { |
|
1055 | 1055 | case 'widget': |
1056 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
1056 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
1057 | 1057 | break; |
1058 | 1058 | default: |
1059 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
1059 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
1060 | 1060 | } |
1061 | 1061 | } |
1062 | 1062 | |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | <div class="gv-droppable-area-action"> |
1065 | 1065 | <a href="#" class="gv-add-field button button-link button-hero" title="" |
1066 | 1066 | data-objecttype="<?php echo esc_attr( $type ); ?>" |
1067 | - data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" |
|
1067 | + data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" |
|
1068 | 1068 | data-context="<?php echo esc_attr( $zone ); ?>" |
1069 | 1069 | data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a> |
1070 | 1070 | </div> |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | // This is a new View, prefill the widgets |
1098 | 1098 | $widgets = array( |
1099 | 1099 | 'header_top' => array( |
1100 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
1100 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
1101 | 1101 | 'id' => 'search_bar', |
1102 | 1102 | 'label' => __( 'Search Bar', 'gravityview' ), |
1103 | 1103 | 'search_layout' => 'horizontal', |
@@ -1172,12 +1172,12 @@ discard block |
||
1172 | 1172 | if ( $post ) { |
1173 | 1173 | $source_form_id = gravityview_get_form_id( $post->ID ); |
1174 | 1174 | if ( $source_form_id ) { |
1175 | - $form_ids[] = $source_form_id; |
|
1175 | + $form_ids[ ] = $source_form_id; |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
1179 | 1179 | foreach ( $joined_forms as $joined_form ) { |
1180 | - $form_ids[] = $joined_form->ID; |
|
1180 | + $form_ids[ ] = $joined_form->ID; |
|
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | * @return string HTML of the active areas |
1216 | 1216 | */ |
1217 | 1217 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
1218 | - if( empty( $template_id ) ) { |
|
1218 | + if ( empty( $template_id ) ) { |
|
1219 | 1219 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1220 | 1220 | return ''; |
1221 | 1221 | } |
@@ -1229,12 +1229,12 @@ discard block |
||
1229 | 1229 | */ |
1230 | 1230 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1231 | 1231 | |
1232 | - if( empty( $template_areas ) ) { |
|
1232 | + if ( empty( $template_areas ) ) { |
|
1233 | 1233 | |
1234 | 1234 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1235 | 1235 | $output = '<div>'; |
1236 | - $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>'; |
|
1237 | - $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>'; |
|
1236 | + $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>'; |
|
1237 | + $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>'; |
|
1238 | 1238 | $output .= '</div>'; |
1239 | 1239 | } else { |
1240 | 1240 | |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | |
1250 | 1250 | } |
1251 | 1251 | |
1252 | - if( $echo ) { |
|
1252 | + if ( $echo ) { |
|
1253 | 1253 | echo $output; |
1254 | 1254 | } |
1255 | 1255 | |
@@ -1277,18 +1277,18 @@ discard block |
||
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | // Add the GV font (with the Astronaut) |
1280 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1280 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
1281 | 1281 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1282 | 1282 | |
1283 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1283 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1284 | 1284 | |
1285 | - if( GFForms::get_page() === 'form_list' ) { |
|
1285 | + if ( GFForms::get_page() === 'form_list' ) { |
|
1286 | 1286 | wp_enqueue_style( 'gravityview_views_styles' ); |
1287 | 1287 | return; |
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | // Don't process any scripts below here if it's not a GravityView page. |
1291 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1291 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1292 | 1292 | return; |
1293 | 1293 | } |
1294 | 1294 | |
@@ -1296,15 +1296,15 @@ discard block |
||
1296 | 1296 | |
1297 | 1297 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1298 | 1298 | |
1299 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1299 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
1300 | 1300 | |
1301 | 1301 | // Enqueue scripts |
1302 | 1302 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
1303 | 1303 | |
1304 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1304 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1305 | 1305 | 'cookiepath' => COOKIEPATH, |
1306 | 1306 | 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
1307 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1307 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1308 | 1308 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1309 | 1309 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1310 | 1310 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1320 | 1320 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1321 | 1321 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ), |
1322 | - )); |
|
1322 | + ) ); |
|
1323 | 1323 | |
1324 | 1324 | wp_enqueue_style( 'gravityview_views_styles' ); |
1325 | 1325 | |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | self::enqueue_gravity_forms_scripts(); |
1328 | 1328 | |
1329 | 1329 | // 2.5 changed how Merge Tags are enqueued |
1330 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
1330 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
1331 | 1331 | GFCommon::output_hooks_javascript(); |
1332 | 1332 | } |
1333 | 1333 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | ); |
1352 | 1352 | |
1353 | 1353 | if ( wp_is_mobile() ) { |
1354 | - $scripts[] = 'jquery-touch-punch'; |
|
1354 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | wp_enqueue_script( $scripts ); |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | |
66 | 66 | add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) ); |
67 | 67 | |
68 | - add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 ); |
|
69 | - add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
70 | - add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
68 | + add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 ); |
|
69 | + add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
70 | + add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
71 | 71 | |
72 | - add_action( 'wp', array( $this, 'maybe_add_note'), 1000 ); |
|
73 | - add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') ); |
|
74 | - add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') ); |
|
72 | + add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 ); |
|
73 | + add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
74 | + add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
75 | 75 | |
76 | 76 | // add template path to check for field |
77 | 77 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
78 | 78 | add_filter( 'gravityview/template/fields_template_paths', array( $this, 'add_template_path' ) ); |
79 | 79 | |
80 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
80 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
81 | 81 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); |
82 | 82 | |
83 | 83 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 ); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function add_entry_default_field( $entry_default_fields, $form, $zone ) { |
101 | 101 | |
102 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
103 | - $entry_default_fields['notes'] = array( |
|
102 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
103 | + $entry_default_fields[ 'notes' ] = array( |
|
104 | 104 | 'label' => __( 'Entry Notes', 'gravityview' ), |
105 | 105 | 'type' => 'notes', |
106 | 106 | 'desc' => __( 'Display, add, and delete notes for an entry.', 'gravityview' ), |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | public function enqueue_scripts() { |
135 | 135 | global $wp_actions; |
136 | 136 | |
137 | - if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
137 | + if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
138 | 138 | wp_enqueue_style( 'gravityview-notes' ); |
139 | 139 | wp_enqueue_script( 'gravityview-notes' ); |
140 | 140 | } |
141 | 141 | |
142 | - if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
142 | + if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
143 | 143 | |
144 | 144 | $strings = self::strings(); |
145 | 145 | |
146 | 146 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( |
147 | 147 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
148 | 148 | 'text' => array( |
149 | - 'processing' => $strings['processing'], |
|
150 | - 'delete_confirm' => $strings['delete-confirm'], |
|
151 | - 'note_added' => $strings['added-note'], |
|
152 | - 'error_invalid' => $strings['error-invalid'], |
|
153 | - 'error_empty_note' => $strings['error-empty-note'], |
|
149 | + 'processing' => $strings[ 'processing' ], |
|
150 | + 'delete_confirm' => $strings[ 'delete-confirm' ], |
|
151 | + 'note_added' => $strings[ 'added-note' ], |
|
152 | + 'error_invalid' => $strings[ 'error-invalid' ], |
|
153 | + 'error_empty_note' => $strings[ 'error-empty-note' ], |
|
154 | 154 | ), |
155 | 155 | ) ); |
156 | 156 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return void |
167 | 167 | */ |
168 | 168 | function maybe_add_note() { |
169 | - if ( ! isset( $_POST['action'] ) || 'gv_note_add' !== $_POST['action'] ) { |
|
169 | + if ( ! isset( $_POST[ 'action' ] ) || 'gv_note_add' !== $_POST[ 'action' ] ) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | $post = wp_unslash( $_POST ); |
180 | 180 | |
181 | 181 | if ( $this->doing_ajax ) { |
182 | - parse_str( $post['data'], $data ); |
|
182 | + parse_str( $post[ 'data' ], $data ); |
|
183 | 183 | } else { |
184 | 184 | $data = $post; |
185 | 185 | } |
186 | 186 | |
187 | - $this->process_add_note( (array) $data ); |
|
187 | + $this->process_add_note( (array)$data ); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -210,23 +210,23 @@ discard block |
||
210 | 210 | $error = false; |
211 | 211 | $success = false; |
212 | 212 | |
213 | - if( empty( $data['entry-slug'] ) ) { |
|
213 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
214 | 214 | |
215 | - $error = self::strings('error-invalid'); |
|
215 | + $error = self::strings( 'error-invalid' ); |
|
216 | 216 | gravityview()->log->error( 'The note is missing an Entry ID.' ); |
217 | 217 | |
218 | 218 | } else { |
219 | 219 | |
220 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
220 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
221 | 221 | |
222 | 222 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
223 | 223 | |
224 | - if( ! $has_cap ) { |
|
224 | + if ( ! $has_cap ) { |
|
225 | 225 | $error = self::strings( 'error-cap-add' ); |
226 | 226 | gravityview()->log->error( 'Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
227 | 227 | } elseif ( $valid ) { |
228 | 228 | |
229 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
229 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
230 | 230 | |
231 | 231 | $added = $this->add_note( $entry, $data ); |
232 | 232 | |
@@ -244,22 +244,22 @@ discard block |
||
244 | 244 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
245 | 245 | |
246 | 246 | if ( $note ) { |
247 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
247 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
248 | 248 | gravityview()->log->debug( 'The note was successfully created', array( 'data' => compact( 'note', 'data' ) ) ); |
249 | 249 | } else { |
250 | - $error = self::strings('error-add-note'); |
|
250 | + $error = self::strings( 'error-add-note' ); |
|
251 | 251 | gravityview()->log->error( 'The note was not successfully created', array( 'data' => compact( 'note', 'data' ) ) ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | } else { |
255 | - $error = self::strings('error-invalid'); |
|
255 | + $error = self::strings( 'error-invalid' ); |
|
256 | 256 | gravityview()->log->error( 'Nonce validation failed; the note was not created' ); |
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | - if( $this->doing_ajax ) { |
|
262 | - if( $success ) { |
|
261 | + if ( $this->doing_ajax ) { |
|
262 | + if ( $success ) { |
|
263 | 263 | wp_send_json_success( array( 'html' => $success ) ); |
264 | 264 | } else { |
265 | 265 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | return; |
286 | 286 | } |
287 | 287 | |
288 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
288 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
289 | 289 | |
290 | 290 | $post = wp_unslash( $_POST ); |
291 | 291 | if ( $this->doing_ajax ) { |
292 | - parse_str( $post['data'], $data ); |
|
292 | + parse_str( $post[ 'data' ], $data ); |
|
293 | 293 | } else { |
294 | 294 | $data = $post; |
295 | 295 | } |
@@ -320,18 +320,18 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function process_delete_notes( $data ) { |
322 | 322 | |
323 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
323 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
324 | 324 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
325 | 325 | $success = false; |
326 | 326 | |
327 | 327 | if ( $valid && $has_cap ) { |
328 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
328 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
329 | 329 | $success = true; |
330 | 330 | } |
331 | 331 | |
332 | - if( $this->doing_ajax ) { |
|
332 | + if ( $this->doing_ajax ) { |
|
333 | 333 | |
334 | - if( $success ) { |
|
334 | + if ( $success ) { |
|
335 | 335 | wp_send_json_success(); |
336 | 336 | } else { |
337 | 337 | if ( ! $valid ) { |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | |
365 | 365 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
366 | 366 | |
367 | - unset( $field_options['show_as_link'] ); |
|
367 | + unset( $field_options[ 'show_as_link' ] ); |
|
368 | 368 | |
369 | 369 | $notes_options = array( |
370 | 370 | 'notes' => array( |
371 | 371 | 'type' => 'checkboxes', |
372 | - 'label' => __('Note Settings', 'gravityview'), |
|
373 | - '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>' ), |
|
372 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
373 | + '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>' ), |
|
374 | 374 | 'options' => array( |
375 | 375 | 'view' => array( |
376 | 376 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | 'processing' => __( 'Processing…', 'gravityview' ), |
423 | 423 | 'other-email' => __( 'Other email address', 'gravityview' ), |
424 | 424 | 'email-label' => __( 'Email address', 'gravityview' ), |
425 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
425 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
426 | 426 | 'subject-label' => __( 'Subject', 'gravityview' ), |
427 | 427 | 'subject' => __( 'Email subject', 'gravityview' ), |
428 | 428 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
444 | 444 | |
445 | - if( $key ) { |
|
445 | + if ( $key ) { |
|
446 | 446 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
447 | 447 | } |
448 | 448 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | static public function display_note( $note, $show_delete = false, $context = null ) { |
466 | 466 | |
467 | - if( ! is_object( $note ) ) { |
|
467 | + if ( ! is_object( $note ) ) { |
|
468 | 468 | return ''; |
469 | 469 | } |
470 | 470 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } |
520 | 520 | |
521 | 521 | $replacements = array( |
522 | - '{note_id}' => $note_content['note_id'], |
|
522 | + '{note_id}' => $note_content[ 'note_id' ], |
|
523 | 523 | '{row_class}' => 'gv-note', |
524 | 524 | '{note_detail}' => $note_detail_html |
525 | 525 | ); |
@@ -551,13 +551,13 @@ discard block |
||
551 | 551 | |
552 | 552 | $user_data = get_userdata( $current_user->ID ); |
553 | 553 | |
554 | - $note_content = trim( $data['gv-note-content'] ); |
|
554 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
555 | 555 | |
556 | - if( empty( $note_content ) ) { |
|
556 | + if ( empty( $note_content ) ) { |
|
557 | 557 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
558 | 558 | } |
559 | 559 | |
560 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
560 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
561 | 561 | |
562 | 562 | return $return; |
563 | 563 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | $atts = shortcode_atts( array( 'entry' => null ), $atts ); |
579 | 579 | |
580 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
580 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
581 | 581 | gravityview()->log->error( 'User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
582 | 582 | return ''; |
583 | 583 | } |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | |
600 | 600 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
601 | 601 | |
602 | - if ( $atts['entry'] ) { |
|
603 | - $entry = GFAPI::get_entry( $atts['entry'] ); |
|
602 | + if ( $atts[ 'entry' ] ) { |
|
603 | + $entry = GFAPI::get_entry( $atts[ 'entry' ] ); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | if ( ! isset( $entry ) || ! $entry ) { |
@@ -618,14 +618,14 @@ discard block |
||
618 | 618 | |
619 | 619 | // Only generate the dropdown if the field settings allow it |
620 | 620 | $email_fields = ''; |
621 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
621 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
622 | 622 | $email_fields = self::get_note_email_fields( $entry_slug ); |
623 | 623 | } |
624 | 624 | |
625 | 625 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
626 | 626 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
627 | - $add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings['delete'] ) ? 0 : $visibility_settings['delete'] ), $add_note_html ); |
|
628 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
627 | + $add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings[ 'delete' ] ) ? 0 : $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
628 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
629 | 629 | $add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html ); |
630 | 630 | |
631 | 631 | return $add_note_html; |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | $note_emails = array(); |
651 | 651 | |
652 | 652 | foreach ( $email_fields as $email_field ) { |
653 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
654 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
653 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
654 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
665 | 665 | |
666 | - return (array) $note_emails; |
|
666 | + return (array)$note_emails; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | */ |
680 | 680 | private static function get_note_email_fields( $entry_slug = '' ) { |
681 | 681 | |
682 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
682 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
683 | 683 | gravityview()->log->error( 'User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
684 | 684 | return ''; |
685 | 685 | } |
@@ -701,27 +701,27 @@ discard block |
||
701 | 701 | |
702 | 702 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
703 | 703 | <div class="gv-note-email-container"> |
704 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
704 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
705 | 705 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
706 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
706 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
707 | 707 | <?php foreach ( $note_emails as $email ) { |
708 | 708 | ?> |
709 | 709 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
710 | 710 | <?php } |
711 | - if( $include_custom ) { ?> |
|
712 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
711 | + if ( $include_custom ) { ?> |
|
712 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
713 | 713 | <?php } ?> |
714 | 714 | </select> |
715 | 715 | <fieldset class="gv-note-to-container"> |
716 | - <?php if( $include_custom ) { ?> |
|
716 | + <?php if ( $include_custom ) { ?> |
|
717 | 717 | <div class='gv-note-to-custom-container'> |
718 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
719 | - <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="" /> |
|
718 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
719 | + <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="" /> |
|
720 | 720 | </div> |
721 | 721 | <?php } ?> |
722 | 722 | <div class='gv-note-subject-container'> |
723 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
724 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
723 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
724 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
725 | 725 | </div> |
726 | 726 | </fieldset> |
727 | 727 | </div> |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | */ |
745 | 745 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
746 | 746 | |
747 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
747 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
748 | 748 | gravityview()->log->debug( 'User doesn\'t have "gravityview_email_entry_notes" cap, or $note is empty', array( 'data' => $note ) ); |
749 | 749 | return; |
750 | 750 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | gravityview()->log->debug( '$data', array( 'data' => $data ) ); |
753 | 753 | |
754 | 754 | //emailing notes if configured |
755 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
755 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
756 | 756 | |
757 | 757 | $default_data = array( |
758 | 758 | 'gv-note-to' => '', |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | 'current-url' => '', |
763 | 763 | ); |
764 | 764 | |
765 | - $current_user = wp_get_current_user(); |
|
765 | + $current_user = wp_get_current_user(); |
|
766 | 766 | $email_data = wp_parse_args( $data, $default_data ); |
767 | 767 | |
768 | - $from = $current_user->user_email; |
|
769 | - $to = $email_data['gv-note-to']; |
|
768 | + $from = $current_user->user_email; |
|
769 | + $to = $email_data[ 'gv-note-to' ]; |
|
770 | 770 | |
771 | 771 | /** |
772 | 772 | * Documented in get_note_email_fields |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | */ |
775 | 775 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
776 | 776 | |
777 | - if( 'custom' === $to && $include_custom ) { |
|
778 | - $to = $email_data['gv-note-to-custom']; |
|
777 | + if ( 'custom' === $to && $include_custom ) { |
|
778 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
779 | 779 | gravityview()->log->debug( 'Sending note to a custom email address: {to}', array( 'to' => $to ) ); |
780 | 780 | } |
781 | 781 | |
@@ -786,13 +786,13 @@ discard block |
||
786 | 786 | |
787 | 787 | $bcc = false; |
788 | 788 | $reply_to = $from; |
789 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
789 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
790 | 790 | |
791 | 791 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
792 | 792 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
793 | - $message = $email_data['gv-note-content']; |
|
793 | + $message = $email_data[ 'gv-note-content' ]; |
|
794 | 794 | $email_footer = self::strings( 'email-footer' ); |
795 | - $from_name = $current_user->display_name; |
|
795 | + $from_name = $current_user->display_name; |
|
796 | 796 | $message_format = 'html'; |
797 | 797 | |
798 | 798 | /** |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
825 | 825 | |
826 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
826 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
827 | 827 | |
828 | 828 | /** |
829 | 829 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | $output = ''; |
851 | 851 | |
852 | - if( ! empty( $email_footer ) ) { |
|
852 | + if ( ! empty( $email_footer ) ) { |
|
853 | 853 | $url = \GV\Utils::get( $email_data, 'current-url' ); |
854 | 854 | $url = html_entity_decode( $url ); |
855 | 855 | $url = site_url( $url ); |