@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | - * @global WP_Post $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | + * @global WP_Post $post |
|
6 | + */ |
|
7 | 7 | global $post; |
8 | 8 | |
9 | 9 | $curr_form = gravityview_get_form_id( $post->ID ); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | GravityView_Render_Settings::render_setting_row( 'sort_columns', $current_settings ); |
28 | 28 | |
29 | - $sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ).'</select>'; |
|
29 | + $sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">' . gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ) . '</select>'; |
|
30 | 30 | |
31 | 31 | GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, $sort_fields_input ); |
32 | 32 |
@@ -432,23 +432,17 @@ |
||
432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
433 | 433 | |
434 | 434 | $result = false; |
435 | - } |
|
436 | - |
|
437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
438 | 436 | |
439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
440 | 438 | |
441 | 439 | $result = false; |
442 | - } |
|
443 | - |
|
444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
445 | 441 | |
446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
447 | 443 | |
448 | 444 | $result = false; |
449 | - } |
|
450 | - |
|
451 | - else { |
|
445 | + } else { |
|
452 | 446 | |
453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
454 | 448 |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
172 | 172 | * @access public |
173 | - * @return void|boolean |
|
173 | + * @return null|false |
|
174 | 174 | */ |
175 | 175 | public function process_bulk_action() { |
176 | 176 | if ( ! class_exists( 'RGForms' ) ) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
253 | 253 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
254 | 254 | * @param int $form_id The Gravity Forms Form ID |
255 | - * @return boolean|void |
|
255 | + * @return false|null |
|
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @access public |
471 | 471 | * @static |
472 | 472 | * @param mixed $form GF Form or Form ID |
473 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
473 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
474 | 474 | */ |
475 | 475 | static public function get_approved_column( $form ) { |
476 | 476 |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | /** gf_entries page - entries table screen */ |
35 | 35 | |
36 | 36 | // capture bulk actions |
37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
38 | 38 | // add hidden field with approve status |
39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
40 | 40 | // process ajax approve entry requests |
41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
42 | 42 | |
43 | 43 | // in case entry is edited (on admin or frontend) |
44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
44 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
45 | 45 | |
46 | 46 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
47 | 47 | |
48 | 48 | // adding styles and scripts |
49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
49 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
50 | 50 | // bypass Gravity Forms no-conflict mode |
51 | 51 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
52 | 52 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function tooltips( $tooltips ) { |
63 | 63 | |
64 | - $tooltips['form_gravityview_fields'] = array( |
|
65 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
64 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
65 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
66 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
67 | 67 | ); |
68 | 68 | |
69 | 69 | return $tooltips; |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
181 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
181 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
182 | 182 | |
183 | 183 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
184 | 184 | |
185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
186 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | // All entries are set to be updated, not just the visible ones |
202 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
202 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
203 | 203 | |
204 | 204 | // Convert the current entry search into GF-formatted search criteria |
205 | 205 | $search = array( |
206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
206 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
207 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
208 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
209 | 209 | ); |
210 | 210 | |
211 | 211 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | } else { |
217 | 217 | |
218 | - $entries = $_POST['lead']; |
|
218 | + $entries = $_POST[ 'lead' ]; |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
259 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
259 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
264 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
264 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
266 | 266 | return false; |
267 | 267 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // calculate approved field id |
272 | 272 | $approved_column_id = self::get_approved_column( $form_id ); |
273 | 273 | |
274 | - foreach( $entries as $entry_id ) { |
|
274 | + foreach ( $entries as $entry_id ) { |
|
275 | 275 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
276 | 276 | } |
277 | 277 | } |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | * @param int $approvedcolumn (default: 0) |
291 | 291 | * @return boolean True: It worked; False: it failed |
292 | 292 | */ |
293 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
293 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
294 | 294 | |
295 | - if( !class_exists( 'GFAPI' ) ) { |
|
295 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
296 | 296 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
297 | 297 | return false; |
298 | 298 | } |
299 | 299 | |
300 | - if( empty( $approvedcolumn ) ) { |
|
300 | + if ( empty( $approvedcolumn ) ) { |
|
301 | 301 | $approvedcolumn = self::get_approved_column( $form_id ); |
302 | 302 | } |
303 | 303 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | self::update_approved_meta( $entry_id, $approved ); |
317 | 317 | |
318 | 318 | // add note to entry |
319 | - if( $result === true ) { |
|
319 | + if ( $result === true ) { |
|
320 | 320 | |
321 | 321 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
322 | 322 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
329 | 329 | |
330 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
330 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
331 | 331 | $current_user = wp_get_current_user(); |
332 | 332 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
333 | 333 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | do_action( 'gravityview_clear_form_cache', $form_id ); |
341 | 341 | |
342 | - } else if( is_wp_error( $result ) ) { |
|
342 | + } else if ( is_wp_error( $result ) ) { |
|
343 | 343 | |
344 | 344 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
345 | 345 | |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
363 | 363 | |
364 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
364 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
365 | 365 | |
366 | 366 | /** |
367 | 367 | * If the form doesn't contain the approve field, don't assume anything. |
368 | 368 | */ |
369 | - if( empty( $approvedcolumn ) ) { |
|
369 | + if ( empty( $approvedcolumn ) ) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | private static function update_approved_meta( $entry_id, $is_approved ) { |
389 | 389 | |
390 | 390 | // update entry meta |
391 | - if( function_exists('gform_update_meta') ) { |
|
391 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
392 | 392 | |
393 | 393 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
402 | 402 | |
403 | - if( empty( $is_approved ) ) { |
|
403 | + if ( empty( $is_approved ) ) { |
|
404 | 404 | |
405 | 405 | /** |
406 | 406 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | } else { |
424 | 424 | |
425 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
425 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
426 | 426 | |
427 | 427 | } |
428 | 428 | } |
@@ -434,21 +434,21 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function ajax_update_approved() { |
436 | 436 | |
437 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
437 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
438 | 438 | |
439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
440 | 440 | |
441 | 441 | $result = false; |
442 | 442 | } |
443 | 443 | |
444 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
444 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
445 | 445 | |
446 | 446 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
447 | 447 | |
448 | 448 | $result = false; |
449 | 449 | } |
450 | 450 | |
451 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
451 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
452 | 452 | |
453 | 453 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
454 | 454 | |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | |
458 | 458 | else { |
459 | 459 | |
460 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
460 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
461 | 461 | |
462 | - if( is_wp_error( $result ) ) { |
|
462 | + if ( is_wp_error( $result ) ) { |
|
463 | 463 | /** @var WP_Error $result */ |
464 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
464 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
465 | 465 | $result = false; |
466 | 466 | } |
467 | 467 | |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | */ |
482 | 482 | static public function get_approved_column( $form ) { |
483 | 483 | |
484 | - if( empty( $form ) ) { |
|
484 | + if ( empty( $form ) ) { |
|
485 | 485 | return null; |
486 | 486 | } |
487 | 487 | |
488 | - if( !is_array( $form ) ) { |
|
488 | + if ( ! is_array( $form ) ) { |
|
489 | 489 | $form = GVCommon::get_form( $form ); |
490 | 490 | } |
491 | 491 | |
492 | - foreach( $form['fields'] as $key => $field ) { |
|
492 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
493 | 493 | |
494 | - $field = (array) $field; |
|
494 | + $field = (array)$field; |
|
495 | 495 | |
496 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
497 | - if( !empty($field['inputs'][0]['id']) ) { |
|
498 | - return $field['inputs'][0]['id']; |
|
496 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
497 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
498 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | 502 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | - return $input['id']; |
|
503 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
504 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
505 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
506 | + return $input[ 'id' ]; |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,18 +514,18 @@ discard block |
||
514 | 514 | |
515 | 515 | |
516 | 516 | |
517 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
517 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
518 | 518 | |
519 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
519 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
520 | 520 | return; |
521 | 521 | } |
522 | 522 | |
523 | - if( empty( $entry['id'] ) ) { |
|
523 | + if ( empty( $entry[ 'id' ] ) ) { |
|
524 | 524 | return; |
525 | 525 | } |
526 | 526 | |
527 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
528 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
527 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
528 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | function add_scripts_and_styles( $hook ) { |
536 | 536 | |
537 | - if( !class_exists( 'RGForms' ) ) { |
|
537 | + if ( ! class_exists( 'RGForms' ) ) { |
|
538 | 538 | |
539 | 539 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
540 | 540 | |
@@ -543,39 +543,39 @@ discard block |
||
543 | 543 | |
544 | 544 | // enqueue styles & scripts gf_entries |
545 | 545 | // But only if we're on the main Entries page, not on reports pages |
546 | - if( RGForms::get_page() === 'entry_list' ) { |
|
546 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
547 | 547 | |
548 | - $form_id = RGForms::get('id'); |
|
548 | + $form_id = RGForms::get( 'id' ); |
|
549 | 549 | |
550 | 550 | // If there are no forms identified, use the first form. That's how GF does it. |
551 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
551 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
552 | 552 | $forms = gravityview_get_forms(); |
553 | - if( !empty( $forms ) ) { |
|
554 | - $form_id = $forms[0]['id']; |
|
553 | + if ( ! empty( $forms ) ) { |
|
554 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | 558 | $approvedcolumn = self::get_approved_column( $form_id ); |
559 | 559 | |
560 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
560 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
561 | 561 | wp_enqueue_style( 'gravityview_entries_list' ); |
562 | 562 | |
563 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
563 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
564 | 564 | |
565 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
565 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
566 | 566 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
567 | 567 | |
568 | 568 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
569 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
569 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
570 | 570 | 'form_id' => $form_id, |
571 | 571 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
572 | 572 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
573 | 573 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
574 | 574 | 'bulk_message' => $this->bulk_update_message, |
575 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
576 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
577 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
578 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
575 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
576 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
577 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
578 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
579 | 579 | ) ); |
580 | 580 | |
581 | 581 | } |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | // Sanitize the values, just to be sure. |
619 | 619 | foreach ( $bulk_actions as $key => $group ) { |
620 | 620 | foreach ( $group as $i => $action ) { |
621 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
622 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
621 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
622 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
@@ -644,13 +644,13 @@ discard block |
||
644 | 644 | * @since 1.7.2 |
645 | 645 | * @param boolean $hide_if_no_connections |
646 | 646 | */ |
647 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
647 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
648 | 648 | |
649 | - if( $hide_if_no_connections ) { |
|
649 | + if ( $hide_if_no_connections ) { |
|
650 | 650 | |
651 | 651 | $connected_views = gravityview_get_connected_views( $form_id ); |
652 | 652 | |
653 | - if( empty( $connected_views ) ) { |
|
653 | + if ( empty( $connected_views ) ) { |
|
654 | 654 | $show_approve_column = false; |
655 | 655 | } |
656 | 656 | } |
@@ -660,18 +660,18 @@ discard block |
||
660 | 660 | * @param boolean $show_approve_column Whether the column will be shown |
661 | 661 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
662 | 662 | */ |
663 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
663 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
664 | 664 | |
665 | 665 | return $show_approve_column; |
666 | 666 | } |
667 | 667 | |
668 | 668 | function register_gform_noconflict_script( $scripts ) { |
669 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
669 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
670 | 670 | return $scripts; |
671 | 671 | } |
672 | 672 | |
673 | 673 | function register_gform_noconflict_style( $styles ) { |
674 | - $styles[] = 'gravityview_entries_list'; |
|
674 | + $styles[ ] = 'gravityview_entries_list'; |
|
675 | 675 | return $styles; |
676 | 676 | } |
677 | 677 |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | |
364 | 364 | $approvedcolumn = self::get_approved_column( $form['id'] ); |
365 | 365 | |
366 | - /** |
|
367 | - * If the form doesn't contain the approve field, don't assume anything. |
|
368 | - */ |
|
369 | - if( empty( $approvedcolumn ) ) { |
|
370 | - return; |
|
371 | - } |
|
366 | + /** |
|
367 | + * If the form doesn't contain the approve field, don't assume anything. |
|
368 | + */ |
|
369 | + if( empty( $approvedcolumn ) ) { |
|
370 | + return; |
|
371 | + } |
|
372 | 372 | |
373 | 373 | $entry = GFAPI::get_entry( $entry_id ); |
374 | 374 | |
@@ -481,17 +481,17 @@ discard block |
||
481 | 481 | */ |
482 | 482 | static public function get_approved_column( $form ) { |
483 | 483 | |
484 | - if( empty( $form ) ) { |
|
485 | - return null; |
|
486 | - } |
|
484 | + if( empty( $form ) ) { |
|
485 | + return null; |
|
486 | + } |
|
487 | 487 | |
488 | - if( !is_array( $form ) ) { |
|
489 | - $form = GVCommon::get_form( $form ); |
|
490 | - } |
|
488 | + if( !is_array( $form ) ) { |
|
489 | + $form = GVCommon::get_form( $form ); |
|
490 | + } |
|
491 | 491 | |
492 | 492 | foreach( $form['fields'] as $key => $field ) { |
493 | 493 | |
494 | - $field = (array) $field; |
|
494 | + $field = (array) $field; |
|
495 | 495 | |
496 | 496 | if( !empty( $field['gravityview_approved'] ) ) { |
497 | 497 | if( !empty($field['inputs'][0]['id']) ) { |
@@ -499,14 +499,14 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | - // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | - return $input['id']; |
|
507 | - } |
|
508 | - } |
|
509 | - } |
|
502 | + // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
503 | + if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | + foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | + if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | + return $input['id']; |
|
507 | + } |
|
508 | + } |
|
509 | + } |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | return null; |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | |
214 | 214 | if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
215 | 215 | foreach ( $field['inputs'] as $input ) { |
216 | - /** |
|
217 | - * @hack |
|
218 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
219 | - */ |
|
220 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
221 | - continue; |
|
222 | - } |
|
216 | + /** |
|
217 | + * @hack |
|
218 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
219 | + */ |
|
220 | + if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
221 | + continue; |
|
222 | + } |
|
223 | 223 | $fields[ (string)$input['id'] ] = array( |
224 | 224 | 'label' => rgar( $input, 'label' ), |
225 | 225 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
467 | 467 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
468 | 468 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
469 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
469 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
470 | 470 | $criteria['context_view_id'] = null; |
471 | 471 | } |
472 | 472 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | ), |
1083 | 1083 | ); |
1084 | 1084 | |
1085 | - $fields = $date_created + $fields; |
|
1085 | + $fields = $date_created + $fields; |
|
1086 | 1086 | |
1087 | 1087 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1088 | 1088 | |
@@ -1094,13 +1094,13 @@ discard block |
||
1094 | 1094 | } |
1095 | 1095 | } |
1096 | 1096 | |
1097 | - /** |
|
1098 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1099 | - * @since 1.12 |
|
1100 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1101 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1102 | - */ |
|
1103 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1097 | + /** |
|
1098 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1099 | + * @since 1.12 |
|
1100 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1101 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1102 | + */ |
|
1103 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1104 | 1104 | |
1105 | 1105 | return $fields; |
1106 | 1106 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | |
1368 | - /** |
|
1369 | - * Display updated/error notice |
|
1370 | - * |
|
1371 | - * @param string $notice text/HTML of notice |
|
1372 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1373 | - * |
|
1374 | - * @return string |
|
1375 | - */ |
|
1376 | - public static function generate_notice( $notice, $class = '' ) { |
|
1377 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1378 | - } |
|
1368 | + /** |
|
1369 | + * Display updated/error notice |
|
1370 | + * |
|
1371 | + * @param string $notice text/HTML of notice |
|
1372 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1373 | + * |
|
1374 | + * @return string |
|
1375 | + */ |
|
1376 | + public static function generate_notice( $notice, $class = '' ) { |
|
1377 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1378 | + } |
|
1379 | 1379 | |
1380 | 1380 | |
1381 | 1381 |
@@ -167,7 +167,6 @@ discard block |
||
167 | 167 | * Returns the list of available forms |
168 | 168 | * |
169 | 169 | * @access public |
170 | - * @param mixed $form_id |
|
171 | 170 | * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys |
172 | 171 | */ |
173 | 172 | public static function get_forms() { |
@@ -188,7 +187,7 @@ discard block |
||
188 | 187 | * Return array of fields' id and label, for a given Form ID |
189 | 188 | * |
190 | 189 | * @access public |
191 | - * @param string|array $form_id (default: '') or $form object |
|
190 | + * @param string|array $form (default: '') or $form object |
|
192 | 191 | * @return array |
193 | 192 | */ |
194 | 193 | public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $has_poll_fields = true; |
291 | 291 | } |
292 | 292 | |
293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
293 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
294 | 294 | $has_product_fields = true; |
295 | 295 | } |
296 | 296 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | $fields = array(); |
375 | 375 | |
376 | - foreach ( $extra_fields as $key => $field ){ |
|
376 | + foreach ( $extra_fields as $key => $field ) { |
|
377 | 377 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
378 | 378 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
379 | 379 | } |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
914 | 914 | */ |
915 | 915 | public static function get_field( $form, $field_id ) { |
916 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
916 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
917 | 917 | return GFFormsModel::get_field( $form, $field_id ); |
918 | 918 | } else { |
919 | 919 | return null; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | $shortcodes = array(); |
961 | 961 | |
962 | 962 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
963 | - if ( empty( $matches ) ){ |
|
963 | + if ( empty( $matches ) ) { |
|
964 | 964 | return false; |
965 | 965 | } |
966 | 966 | |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1424 | 1424 | $merged = $array1; |
1425 | 1425 | |
1426 | - foreach ( $array2 as $key => &$value ) { |
|
1426 | + foreach ( $array2 as $key => &$value ) { |
|
1427 | 1427 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1428 | 1428 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1429 | 1429 | } else { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
177 | 177 | |
178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
194 | 194 | $gf_forms = GFAPI::get_forms(); |
195 | 195 | foreach ( $gf_forms as $form ) { |
196 | - $forms[] = array( |
|
197 | - 'id' => $form['id'], |
|
198 | - 'title' => $form['title'], |
|
196 | + $forms[ ] = array( |
|
197 | + 'id' => $form[ 'id' ], |
|
198 | + 'title' => $form[ 'title' ], |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | } |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | if ( $form ) { |
230 | - foreach ( $form['fields'] as $field ) { |
|
231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
232 | - $fields[ $field['id'] ] = array( |
|
230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
231 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
232 | + $fields[ $field[ 'id' ] ] = array( |
|
233 | 233 | 'label' => rgar( $field, 'label' ), |
234 | 234 | 'parent' => null, |
235 | 235 | 'type' => rgar( $field, 'type' ), |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | ); |
239 | 239 | } |
240 | 240 | |
241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
242 | - foreach ( $field['inputs'] as $input ) { |
|
241 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
242 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
243 | 243 | /** |
244 | 244 | * @hack |
245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
246 | 246 | */ |
247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
247 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
248 | 248 | continue; |
249 | 249 | } |
250 | - $fields[ (string)$input['id'] ] = array( |
|
250 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
251 | 251 | 'label' => rgar( $input, 'label' ), |
252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), |
253 | 253 | 'parent' => $field, |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | /** @since 1.14 */ |
262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
262 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
263 | 263 | |
264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
264 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
265 | 265 | |
266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
266 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
267 | 267 | |
268 | 268 | $fields[ $input_id ] = array( |
269 | 269 | 'label' => rgar( $input, 'text' ), |
@@ -279,25 +279,25 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @since 1.8 |
281 | 281 | */ |
282 | - if( 'quiz' === $field['type'] ) { |
|
282 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
283 | 283 | $has_quiz_fields = true; |
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
287 | 287 | * @since 1.8 |
288 | 288 | */ |
289 | - if( 'poll' === $field['type'] ) { |
|
289 | + if ( 'poll' === $field[ 'type' ] ) { |
|
290 | 290 | $has_poll_fields = true; |
291 | 291 | } |
292 | 292 | |
293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
293 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
294 | 294 | $has_product_fields = true; |
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | 298 | * @hack Version 1.9 |
299 | 299 | */ |
300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
301 | 301 | |
302 | 302 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
303 | 303 | $has_post_fields = true; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @since 1.7 |
310 | 310 | */ |
311 | 311 | if ( $has_post_fields ) { |
312 | - $fields['post_id'] = array( |
|
312 | + $fields[ 'post_id' ] = array( |
|
313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), |
314 | 314 | 'type' => 'post_id', |
315 | 315 | ); |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
321 | 321 | |
322 | 322 | foreach ( $payment_fields as $payment_field ) { |
323 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
323 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
324 | 324 | continue; |
325 | 325 | } |
326 | - $fields["{$payment_field->name}"] = array( |
|
326 | + $fields[ "{$payment_field->name}" ] = array( |
|
327 | 327 | 'label' => $payment_field->label, |
328 | 328 | 'desc' => $payment_field->description, |
329 | 329 | 'type' => $payment_field->name, |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | /** |
335 | 335 | * @since 1.8 |
336 | 336 | */ |
337 | - if( $has_quiz_fields ) { |
|
337 | + if ( $has_quiz_fields ) { |
|
338 | 338 | |
339 | - $fields['gquiz_score'] = array( |
|
339 | + $fields[ 'gquiz_score' ] = array( |
|
340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
341 | 341 | 'type' => 'quiz_score', |
342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
343 | 343 | ); |
344 | - $fields['gquiz_percent'] = array( |
|
344 | + $fields[ 'gquiz_percent' ] = array( |
|
345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
346 | 346 | 'type' => 'quiz_percent', |
347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
348 | 348 | ); |
349 | - $fields['gquiz_grade'] = array( |
|
349 | + $fields[ 'gquiz_grade' ] = array( |
|
350 | 350 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
351 | 351 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
352 | 352 | 'type' => 'quiz_grade', |
353 | 353 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
354 | 354 | ); |
355 | - $fields['gquiz_is_pass'] = array( |
|
355 | + $fields[ 'gquiz_is_pass' ] = array( |
|
356 | 356 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
357 | 357 | 'type' => 'quiz_is_pass', |
358 | 358 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | |
375 | 375 | $fields = array(); |
376 | 376 | |
377 | - foreach ( $extra_fields as $key => $field ){ |
|
378 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
379 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
377 | + foreach ( $extra_fields as $key => $field ) { |
|
378 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
379 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
@@ -416,32 +416,32 @@ discard block |
||
416 | 416 | 'search_criteria' => null, |
417 | 417 | 'sorting' => null, |
418 | 418 | 'paging' => null, |
419 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
419 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
420 | 420 | ); |
421 | 421 | |
422 | 422 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
423 | 423 | |
424 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
425 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
424 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
425 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
426 | 426 | |
427 | 427 | if ( ! is_array( $filter ) ) { |
428 | 428 | continue; |
429 | 429 | } |
430 | 430 | |
431 | 431 | // By default, we want searches to be wildcard for each field. |
432 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
432 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
433 | 433 | |
434 | 434 | /** |
435 | 435 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
436 | 436 | * @param string $operator Existing search operator |
437 | 437 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
438 | 438 | */ |
439 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
439 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // don't send just the [mode] without any field filter. |
443 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
444 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
443 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
444 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | } |
@@ -452,21 +452,21 @@ discard block |
||
452 | 452 | * Prepare date formats to be in Gravity Forms DB format; |
453 | 453 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
454 | 454 | */ |
455 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
455 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
456 | 456 | |
457 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
457 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
458 | 458 | |
459 | 459 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
460 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
460 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
461 | 461 | |
462 | 462 | if ( $date ) { |
463 | 463 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
464 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
464 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
465 | 465 | } else { |
466 | 466 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
467 | - unset( $criteria['search_criteria'][ $key ] ); |
|
467 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
468 | 468 | |
469 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
469 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | |
475 | 475 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
476 | 476 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
477 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
477 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
478 | 478 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
479 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
480 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
479 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; |
|
480 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
481 | 481 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
482 | - $criteria['context_view_id'] = null; |
|
482 | + $criteria[ 'context_view_id' ] = null; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param array $form_ids Forms to search |
489 | 489 | * @param int $view_id ID of the view being used to search |
490 | 490 | */ |
491 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
491 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
492 | 492 | |
493 | 493 | return (array)$criteria; |
494 | 494 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** Reduce # of database calls */ |
520 | 520 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
521 | 521 | |
522 | - if ( ! empty( $criteria['cache'] ) ) { |
|
522 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
523 | 523 | |
524 | 524 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | // Still update the total count when using cached results |
529 | 529 | if ( ! is_null( $total ) ) { |
530 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
530 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | $return = $entries; |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
548 | 548 | |
549 | 549 | // No entries returned from gravityview_before_get_entries |
550 | - if( is_null( $entries ) ) { |
|
550 | + if ( is_null( $entries ) ) { |
|
551 | 551 | |
552 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
552 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
553 | 553 | |
554 | 554 | if ( is_wp_error( $entries ) ) { |
555 | 555 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
561 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
562 | 562 | |
563 | 563 | // Cache results |
564 | 564 | $Cache->set( $entries, 'entries' ); |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | */ |
646 | 646 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
647 | 647 | |
648 | - if( $check_entry_display ) { |
|
648 | + if ( $check_entry_display ) { |
|
649 | 649 | // Is the entry allowed |
650 | 650 | $entry = self::check_entry_display( $entry ); |
651 | 651 | } |
@@ -678,12 +678,12 @@ discard block |
||
678 | 678 | |
679 | 679 | $value = false; |
680 | 680 | |
681 | - if( 'context' === $val1 ) { |
|
681 | + if ( 'context' === $val1 ) { |
|
682 | 682 | |
683 | 683 | $matching_contexts = array( $val2 ); |
684 | 684 | |
685 | 685 | // We allow for non-standard contexts. |
686 | - switch( $val2 ) { |
|
686 | + switch ( $val2 ) { |
|
687 | 687 | // Check for either single or edit |
688 | 688 | case 'singular': |
689 | 689 | $matching_contexts = array( 'single', 'edit' ); |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | return false; |
744 | 744 | } |
745 | 745 | |
746 | - if ( empty( $entry['form_id'] ) ) { |
|
746 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
747 | 747 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
748 | 748 | return false; |
749 | 749 | } |
@@ -751,26 +751,26 @@ discard block |
||
751 | 751 | $criteria = self::calculate_get_entries_criteria(); |
752 | 752 | |
753 | 753 | // Make sure the current View is connected to the same form as the Entry |
754 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
755 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
754 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
755 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
756 | 756 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
757 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
758 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
757 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
758 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
759 | 759 | return false; |
760 | 760 | } |
761 | 761 | } |
762 | 762 | |
763 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
763 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
764 | 764 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
765 | 765 | return $entry; |
766 | 766 | } |
767 | 767 | |
768 | - $search_criteria = $criteria['search_criteria']; |
|
768 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
769 | 769 | unset( $criteria ); |
770 | 770 | |
771 | 771 | // check entry status |
772 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
773 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
772 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
773 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
774 | 774 | return false; |
775 | 775 | } |
776 | 776 | |
@@ -778,37 +778,37 @@ discard block |
||
778 | 778 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
779 | 779 | |
780 | 780 | // field_filters |
781 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
781 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
782 | 782 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
783 | 783 | return $entry; |
784 | 784 | } |
785 | 785 | |
786 | - $filters = $search_criteria['field_filters']; |
|
786 | + $filters = $search_criteria[ 'field_filters' ]; |
|
787 | 787 | unset( $search_criteria ); |
788 | 788 | |
789 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
790 | - unset( $filters['mode'] ); |
|
789 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
790 | + unset( $filters[ 'mode' ] ); |
|
791 | 791 | |
792 | - $form = self::get_form( $entry['form_id'] ); |
|
792 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
793 | 793 | |
794 | 794 | foreach ( $filters as $filter ) { |
795 | 795 | |
796 | - if ( ! isset( $filter['key'] ) ) { |
|
796 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
797 | 797 | continue; |
798 | 798 | } |
799 | 799 | |
800 | - $k = $filter['key']; |
|
800 | + $k = $filter[ 'key' ]; |
|
801 | 801 | |
802 | 802 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
803 | 803 | $field_value = $entry[ $k ]; |
804 | 804 | $field = null; |
805 | 805 | } else { |
806 | 806 | $field = self::get_field( $form, $k ); |
807 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
807 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
808 | 808 | } |
809 | 809 | |
810 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
811 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
810 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
811 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
812 | 812 | |
813 | 813 | // verify if we are already free to go! |
814 | 814 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | * Gravity Forms code to adjust date to locally-configured Time Zone |
867 | 867 | * @see GFCommon::format_date() for original code |
868 | 868 | */ |
869 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
869 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
870 | 870 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
871 | 871 | |
872 | - $format = rgar( $atts, 'format' ); |
|
873 | - $is_human = ! empty( $atts['human'] ); |
|
874 | - $is_diff = ! empty( $atts['diff'] ); |
|
875 | - $is_raw = ! empty( $atts['raw'] ); |
|
876 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
877 | - $include_time = ! empty( $atts['time'] ); |
|
872 | + $format = rgar( $atts, 'format' ); |
|
873 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
874 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
875 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
876 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
877 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
878 | 878 | |
879 | 879 | // If we're using time diff, we want to have a different default format |
880 | - if( empty( $format ) ) { |
|
880 | + if ( empty( $format ) ) { |
|
881 | 881 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
882 | 882 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
883 | 883 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | // If raw was specified, don't modify the stored value |
886 | 886 | if ( $is_raw ) { |
887 | 887 | $formatted_date = $date_string; |
888 | - } elseif( $is_timestamp ) { |
|
888 | + } elseif ( $is_timestamp ) { |
|
889 | 889 | $formatted_date = $date_local_timestamp; |
890 | 890 | } elseif ( $is_diff ) { |
891 | 891 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | } |
914 | 914 | |
915 | 915 | $field = self::get_field( $form, $field_id ); |
916 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
916 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; |
|
917 | 917 | |
918 | 918 | } |
919 | 919 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
932 | 932 | */ |
933 | 933 | public static function get_field( $form, $field_id ) { |
934 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
934 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
935 | 935 | return GFFormsModel::get_field( $form, $field_id ); |
936 | 936 | } else { |
937 | 937 | return null; |
@@ -978,19 +978,19 @@ discard block |
||
978 | 978 | $shortcodes = array(); |
979 | 979 | |
980 | 980 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
981 | - if ( empty( $matches ) ){ |
|
981 | + if ( empty( $matches ) ) { |
|
982 | 982 | return false; |
983 | 983 | } |
984 | 984 | |
985 | 985 | foreach ( $matches as $shortcode ) { |
986 | - if ( $tag === $shortcode[2] ) { |
|
986 | + if ( $tag === $shortcode[ 2 ] ) { |
|
987 | 987 | |
988 | 988 | // Changed this to $shortcode instead of true so we get the parsed atts. |
989 | - $shortcodes[] = $shortcode; |
|
989 | + $shortcodes[ ] = $shortcode; |
|
990 | 990 | |
991 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
992 | - foreach( $results as $result ) { |
|
993 | - $shortcodes[] = $result; |
|
991 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
992 | + foreach ( $results as $result ) { |
|
993 | + $shortcodes[ ] = $result; |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @return string html |
1142 | 1142 | */ |
1143 | 1143 | public static function get_sortable_fields( $formid, $current = '' ) { |
1144 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1144 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1145 | 1145 | |
1146 | 1146 | if ( empty( $formid ) ) { |
1147 | 1147 | return $output; |
@@ -1154,11 +1154,11 @@ discard block |
||
1154 | 1154 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1155 | 1155 | |
1156 | 1156 | foreach ( $fields as $id => $field ) { |
1157 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1157 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1158 | 1158 | continue; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1161 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1162 | 1162 | } |
1163 | 1163 | } |
1164 | 1164 | |
@@ -1193,9 +1193,9 @@ discard block |
||
1193 | 1193 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1194 | 1194 | |
1195 | 1195 | // TODO: Convert to using array_filter |
1196 | - foreach( $fields as $id => $field ) { |
|
1196 | + foreach ( $fields as $id => $field ) { |
|
1197 | 1197 | |
1198 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1198 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1199 | 1199 | unset( $fields[ $id ] ); |
1200 | 1200 | } |
1201 | 1201 | } |
@@ -1236,14 +1236,14 @@ discard block |
||
1236 | 1236 | * @param int|array $field field key or field array |
1237 | 1237 | * @return boolean |
1238 | 1238 | */ |
1239 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1239 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1240 | 1240 | |
1241 | 1241 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1242 | 1242 | $form = self::get_form( $form ); |
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | // If entry meta, it's a string. Otherwise, numeric |
1246 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1246 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1247 | 1247 | $type = $field; |
1248 | 1248 | } else { |
1249 | 1249 | $type = self::get_field_type( $form, $field ); |
@@ -1257,9 +1257,9 @@ discard block |
||
1257 | 1257 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1258 | 1258 | |
1259 | 1259 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1260 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1261 | - if( true === $gv_field->is_numeric ) { |
|
1262 | - $numeric_types[] = $gv_field->is_numeric; |
|
1260 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1261 | + if ( true === $gv_field->is_numeric ) { |
|
1262 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1263 | 1263 | } |
1264 | 1264 | } |
1265 | 1265 | |
@@ -1409,11 +1409,11 @@ discard block |
||
1409 | 1409 | $final_atts = array_filter( $final_atts ); |
1410 | 1410 | |
1411 | 1411 | // If the href wasn't passed as an attribute, use the value passed to the function |
1412 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1413 | - $final_atts['href'] = $href; |
|
1412 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1413 | + $final_atts[ 'href' ] = $href; |
|
1414 | 1414 | } |
1415 | 1415 | |
1416 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1416 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1417 | 1417 | |
1418 | 1418 | // Sort the attributes alphabetically, to help testing |
1419 | 1419 | ksort( $final_atts ); |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1425 | 1425 | } |
1426 | 1426 | |
1427 | - if( '' !== $output ) { |
|
1427 | + if ( '' !== $output ) { |
|
1428 | 1428 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1449 | 1449 | $merged = $array1; |
1450 | 1450 | |
1451 | - foreach ( $array2 as $key => &$value ) { |
|
1451 | + foreach ( $array2 as $key => &$value ) { |
|
1452 | 1452 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1453 | 1453 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1454 | 1454 | } else { |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1484 | 1484 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1485 | 1485 | */ |
1486 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1486 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1487 | 1487 | |
1488 | 1488 | return get_users( $get_users_settings ); |
1489 | 1489 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | * @return string |
1499 | 1499 | */ |
1500 | 1500 | public static function generate_notice( $notice, $class = '' ) { |
1501 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1501 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 |
@@ -5,220 +5,220 @@ |
||
5 | 5 | */ |
6 | 6 | class GravityView_Change_Entry_Creator { |
7 | 7 | |
8 | - function __construct() { |
|
9 | - |
|
10 | - /** |
|
11 | - * @since 1.5.1 |
|
12 | - */ |
|
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
14 | - |
|
15 | - // ONLY ADMIN FROM HERE ON. |
|
16 | - if( !is_admin() ) { return; } |
|
17 | - |
|
18 | - /** |
|
19 | - * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
20 | - * @since 1.7.4 |
|
21 | - * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
22 | - */ |
|
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
24 | - return; |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * Use `init` to fix bbPress warning |
|
29 | - * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
30 | - */ |
|
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
32 | - |
|
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
8 | + function __construct() { |
|
9 | + |
|
10 | + /** |
|
11 | + * @since 1.5.1 |
|
12 | + */ |
|
13 | + add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
14 | + |
|
15 | + // ONLY ADMIN FROM HERE ON. |
|
16 | + if( !is_admin() ) { return; } |
|
17 | + |
|
18 | + /** |
|
19 | + * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
20 | + * @since 1.7.4 |
|
21 | + * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
22 | + */ |
|
23 | + if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
24 | + return; |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * Use `init` to fix bbPress warning |
|
29 | + * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
30 | + */ |
|
31 | + add_action('init', array( $this, 'load'), 100 ); |
|
32 | + |
|
33 | + add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
34 | 34 | |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * When an user is created using the User Registration add-on, assign the entry to them |
|
39 | - * |
|
40 | - * @since 1.5.1 |
|
41 | - * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
42 | - * @param int $user_id WordPress User ID |
|
43 | - * @param array $config User registration feed configuration |
|
44 | - * @param array $entry GF Entry array |
|
45 | - * @param string $password User password |
|
46 | - * @return void |
|
47 | - */ |
|
48 | - function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
37 | + /** |
|
38 | + * When an user is created using the User Registration add-on, assign the entry to them |
|
39 | + * |
|
40 | + * @since 1.5.1 |
|
41 | + * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
42 | + * @param int $user_id WordPress User ID |
|
43 | + * @param array $config User registration feed configuration |
|
44 | + * @param array $entry GF Entry array |
|
45 | + * @param string $password User password |
|
46 | + * @return void |
|
47 | + */ |
|
48 | + function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
49 | 49 | |
50 | - /** |
|
51 | - * Disable assigning the new user to the entry by returning false. |
|
52 | - * @param int $user_id WordPress User ID |
|
53 | - * @param array $config User registration feed configuration |
|
54 | - * @param array $entry GF Entry array |
|
55 | - */ |
|
56 | - $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
57 | - |
|
58 | - // If filter returns false, do not process |
|
59 | - if( empty( $assign_to_lead ) ) { |
|
60 | - return; |
|
61 | - } |
|
50 | + /** |
|
51 | + * Disable assigning the new user to the entry by returning false. |
|
52 | + * @param int $user_id WordPress User ID |
|
53 | + * @param array $config User registration feed configuration |
|
54 | + * @param array $entry GF Entry array |
|
55 | + */ |
|
56 | + $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
57 | + |
|
58 | + // If filter returns false, do not process |
|
59 | + if( empty( $assign_to_lead ) ) { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
|
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
63 | + // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
|
64 | + $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
68 | - } else { |
|
69 | - $status = __('Success', 'gravityview'); |
|
70 | - } |
|
71 | - |
|
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
66 | + if( empty( $result ) ) { |
|
67 | + $status = __('Error', 'gravityview'); |
|
68 | + } else { |
|
69 | + $status = __('Success', 'gravityview'); |
|
70 | + } |
|
71 | + |
|
72 | + $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Disable previous functionality; use this one as the canonical. |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - function prevent_conflicts() { |
|
80 | + /** |
|
81 | + * Disable previous functionality; use this one as the canonical. |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + function prevent_conflicts() { |
|
85 | 85 | |
86 | - // Plugin that was provided here: |
|
87 | - // @link https://gravityview.co/support/documentation/201991205/ |
|
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
86 | + // Plugin that was provided here: |
|
87 | + // @link https://gravityview.co/support/documentation/201991205/ |
|
88 | + remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | + remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
90 | 90 | |
91 | - // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
91 | + // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
92 | + if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | - $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
94 | + $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
95 | 95 | |
96 | - // Now, no validation is required in the methods; let's hook in. |
|
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
96 | + // Now, no validation is required in the methods; let's hook in. |
|
97 | + remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
99 | + remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
102 | - } |
|
101 | + remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
102 | + } |
|
103 | 103 | |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * @since 3.6.3 |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - function load() { |
|
106 | + /** |
|
107 | + * @since 3.6.3 |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + function load() { |
|
111 | 111 | |
112 | - // Does GF exist? |
|
113 | - if( !class_exists('GFCommon') ) { |
|
114 | - return; |
|
115 | - } |
|
112 | + // Does GF exist? |
|
113 | + if( !class_exists('GFCommon') ) { |
|
114 | + return; |
|
115 | + } |
|
116 | 116 | |
117 | - // Can the user edit entries? |
|
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | - return; |
|
120 | - } |
|
117 | + // Can the user edit entries? |
|
118 | + if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | + return; |
|
120 | + } |
|
121 | 121 | |
122 | - // If screen mode isn't set, then we're in the wrong place. |
|
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
124 | - return; |
|
125 | - } |
|
122 | + // If screen mode isn't set, then we're in the wrong place. |
|
123 | + if( empty( $_REQUEST['screen_mode'] ) ) { |
|
124 | + return; |
|
125 | + } |
|
126 | 126 | |
127 | - // Now, no validation is required in the methods; let's hook in. |
|
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
127 | + // Now, no validation is required in the methods; let's hook in. |
|
128 | + add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
138 | - * @return void |
|
139 | - */ |
|
140 | - function set_screen_mode() { |
|
136 | + /** |
|
137 | + * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
138 | + * @return void |
|
139 | + */ |
|
140 | + function set_screen_mode() { |
|
141 | 141 | |
142 | - // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
145 | - } |
|
142 | + // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
143 | + if( rgget('screen_mode') === 'edit' ) { |
|
144 | + $_POST["screen_mode"] = 'edit'; |
|
145 | + } |
|
146 | 146 | |
147 | - } |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * When the entry creator is changed, add a note to the entry |
|
151 | - * @param array $form GF entry array |
|
152 | - * @param int $entry_id Entry ID |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - function update_entry_creator($form, $entry_id) { |
|
156 | - global $current_user; |
|
149 | + /** |
|
150 | + * When the entry creator is changed, add a note to the entry |
|
151 | + * @param array $form GF entry array |
|
152 | + * @param int $entry_id Entry ID |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + function update_entry_creator($form, $entry_id) { |
|
156 | + global $current_user; |
|
157 | 157 | |
158 | - // Update the entry |
|
159 | - $created_by = absint( rgpost('created_by') ); |
|
158 | + // Update the entry |
|
159 | + $created_by = absint( rgpost('created_by') ); |
|
160 | 160 | |
161 | - RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
161 | + RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
162 | 162 | |
163 | - // If the creator has changed, let's add a note about who it used to be. |
|
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
163 | + // If the creator has changed, let's add a note about who it used to be. |
|
164 | + $originally_created_by = rgpost('originally_created_by'); |
|
165 | 165 | |
166 | - // If there's no owner and there didn't used to be, keep going |
|
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | - return; |
|
169 | - } |
|
166 | + // If there's no owner and there didn't used to be, keep going |
|
167 | + if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | + return; |
|
169 | + } |
|
170 | 170 | |
171 | - // If the values have changed |
|
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
171 | + // If the values have changed |
|
172 | + if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata($current_user->ID); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
182 | - $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
183 | - } |
|
180 | + if( !empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata($originally_created_by); |
|
182 | + $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
183 | + } |
|
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
187 | - $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
188 | - } |
|
185 | + if( !empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata($created_by); |
|
187 | + $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
188 | + } |
|
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
191 | - } |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
191 | + } |
|
192 | 192 | |
193 | - } |
|
193 | + } |
|
194 | 194 | |
195 | - /** |
|
196 | - * Output the select to change the entry creator |
|
197 | - * @param int $form_id GF Form ID |
|
198 | - * @param array $entry GF entry array |
|
199 | - * @return void |
|
200 | - */ |
|
201 | - function add_select($form_id, $entry ) { |
|
195 | + /** |
|
196 | + * Output the select to change the entry creator |
|
197 | + * @param int $form_id GF Form ID |
|
198 | + * @param array $entry GF entry array |
|
199 | + * @return void |
|
200 | + */ |
|
201 | + function add_select($form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
204 | - return; |
|
205 | - } |
|
203 | + if( rgpost('screen_mode') !== 'edit' ) { |
|
204 | + return; |
|
205 | + } |
|
206 | 206 | |
207 | - $users = GVCommon::get_users( 'change_entry_creator' ); |
|
207 | + $users = GVCommon::get_users( 'change_entry_creator' ); |
|
208 | 208 | |
209 | - $output = '<label for="change_created_by">'; |
|
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
211 | - $output .= '</label> |
|
209 | + $output = '<label for="change_created_by">'; |
|
210 | + $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
211 | + $output .= '</label> |
|
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
216 | - } |
|
217 | - $output .= '</select>'; |
|
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
219 | - echo $output; |
|
220 | - |
|
221 | - } |
|
213 | + $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | + foreach($users as $user) { |
|
215 | + $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
216 | + } |
|
217 | + $output .= '</select>'; |
|
218 | + $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
219 | + echo $output; |
|
220 | + |
|
221 | + } |
|
222 | 222 | |
223 | 223 | } |
224 | 224 |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @since 1.5.1 |
12 | 12 | */ |
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
14 | 14 | |
15 | 15 | // ONLY ADMIN FROM HERE ON. |
16 | - if( !is_admin() ) { return; } |
|
16 | + if ( ! is_admin() ) { return; } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
20 | 20 | * @since 1.7.4 |
21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
22 | 22 | */ |
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * Use `init` to fix bbPress warning |
29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
30 | 30 | */ |
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
32 | 32 | |
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
57 | 57 | |
58 | 58 | // If filter returns false, do not process |
59 | - if( empty( $assign_to_lead ) ) { |
|
59 | + if ( empty( $assign_to_lead ) ) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
64 | + $result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
66 | + if ( empty( $result ) ) { |
|
67 | + $status = __( 'Error', 'gravityview' ); |
|
68 | 68 | } else { |
69 | - $status = __('Success', 'gravityview'); |
|
69 | + $status = __( 'Success', 'gravityview' ); |
|
70 | 70 | } |
71 | 71 | |
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | // Plugin that was provided here: |
87 | 87 | // @link https://gravityview.co/support/documentation/201991205/ |
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
88 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2 ); |
|
89 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2 ); |
|
90 | 90 | |
91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
92 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
95 | 95 | |
96 | 96 | // Now, no validation is required in the methods; let's hook in. |
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
97 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
99 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2 ); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
101 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2 ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | function load() { |
111 | 111 | |
112 | 112 | // Does GF exist? |
113 | - if( !class_exists('GFCommon') ) { |
|
113 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Can the user edit entries? |
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
118 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
123 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Now, no validation is required in the methods; let's hook in. |
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
128 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | function set_screen_mode() { |
141 | 141 | |
142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
143 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
144 | + $_POST[ "screen_mode" ] = 'edit'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -152,42 +152,42 @@ discard block |
||
152 | 152 | * @param int $entry_id Entry ID |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - function update_entry_creator($form, $entry_id) { |
|
155 | + function update_entry_creator( $form, $entry_id ) { |
|
156 | 156 | global $current_user; |
157 | 157 | |
158 | 158 | // Update the entry |
159 | - $created_by = absint( rgpost('created_by') ); |
|
159 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
160 | 160 | |
161 | 161 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
162 | 162 | |
163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
164 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
165 | 165 | |
166 | 166 | // If there's no owner and there didn't used to be, keep going |
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
167 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | 171 | // If the values have changed |
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
172 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata( $current_user->ID ); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
180 | + if ( ! empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
182 | 182 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
183 | 183 | } |
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
185 | + if ( ! empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata( $created_by ); |
|
187 | 187 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
188 | 188 | } |
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
198 | 198 | * @param array $entry GF entry array |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - function add_select($form_id, $entry ) { |
|
201 | + function add_select( $form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
203 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | 207 | $users = GVCommon::get_users( 'change_entry_creator' ); |
208 | 208 | |
209 | 209 | $output = '<label for="change_created_by">'; |
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
210 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
211 | 211 | $output .= '</label> |
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
213 | + $output .= '<option value=""> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
214 | + foreach ( $users as $user ) { |
|
215 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
216 | 216 | } |
217 | 217 | $output .= '</select>'; |
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
218 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
219 | 219 | echo $output; |
220 | 220 | |
221 | 221 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | var $style = NULL; |
24 | 24 | |
25 | 25 | /** |
26 | - * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
26 | + * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
27 | 27 | * @var string |
28 | 28 | */ |
29 | 29 | var $size = NULL; |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $atts = wp_parse_args( $atts, $defaults ); |
67 | 67 | |
68 | - foreach( $atts as $key => $val ) { |
|
68 | + foreach ( $atts as $key => $val ) { |
|
69 | 69 | $this->{$key} = $val; |
70 | 70 | } |
71 | 71 | |
72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
72 | + $this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
73 | 73 | |
74 | 74 | $this->set_image_size(); |
75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function validate_image_src() { |
87 | 87 | |
88 | - if ( !$this->validate_src ) { return true; } |
|
88 | + if ( ! $this->validate_src ) { return true; } |
|
89 | 89 | |
90 | 90 | $info = pathinfo( $this->src ); |
91 | 91 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag |
94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` |
95 | 95 | */ |
96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); |
|
96 | + $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) ); |
|
97 | 97 | |
98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); |
|
98 | + return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | // And there is no string size passed |
113 | 113 | // And we want to get the image size using PHP |
114 | - if ( empty( $string ) && !empty( $this->getimagesize ) ) { |
|
114 | + if ( empty( $string ) && ! empty( $this->getimagesize ) ) { |
|
115 | 115 | |
116 | 116 | $image_size = getimagesize( $this->src ); |
117 | 117 | |
118 | - if ( !empty( $image_size ) ) { |
|
118 | + if ( ! empty( $image_size ) ) { |
|
119 | 119 | list( $width, $height ) = $image_size; |
120 | 120 | } |
121 | 121 | |
@@ -128,33 +128,33 @@ discard block |
||
128 | 128 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels |
129 | 129 | */ |
130 | 130 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
131 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
132 | - 'small' => array('width' => 100, 'height' => 75), |
|
133 | - 'medium' => array('width' => 250, 'height' => 188), |
|
134 | - 'large' => array('width' => 448, 'height' => 336), |
|
131 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
132 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
133 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
134 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
135 | 135 | ) ); |
136 | 136 | |
137 | - switch( $this->size ) { |
|
137 | + switch ( $this->size ) { |
|
138 | 138 | case 'tiny': |
139 | - extract($image_sizes['tiny']); |
|
139 | + extract( $image_sizes[ 'tiny' ] ); |
|
140 | 140 | break; |
141 | 141 | case 'small': |
142 | 142 | case 's': |
143 | 143 | case 'thumb': |
144 | - extract($image_sizes['small']); |
|
144 | + extract( $image_sizes[ 'small' ] ); |
|
145 | 145 | break; |
146 | 146 | case 'm': |
147 | 147 | case 'medium': |
148 | - extract($image_sizes['medium']); |
|
148 | + extract( $image_sizes[ 'medium' ] ); |
|
149 | 149 | break; |
150 | 150 | case 'large': |
151 | 151 | case 'l': |
152 | - extract($image_sizes['large']); |
|
152 | + extract( $image_sizes[ 'large' ] ); |
|
153 | 153 | break; |
154 | 154 | default: |
155 | 155 | // Verify that the passed sizes are integers. |
156 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
156 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | - add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
15 | + add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
16 | 16 | |
17 | - // Load Debug Bar integration |
|
18 | - add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
17 | + // Load Debug Bar integration |
|
18 | + add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | - return $supported_plugins; |
|
47 | + $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | + return $supported_plugins; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | if ( class_exists("GFLogging") ) { |
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
101 | - } |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | static function log_error( $message = '', $data = null ) { |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | if ( class_exists("GFLogging") ) { |
119 | - GFLogging::include_logger(); |
|
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
119 | + GFLogging::include_logger(); |
|
120 | + GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct() { |
9 | 9 | |
10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
11 | 11 | |
12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
12 | + add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 ); |
|
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
35 | 35 | } |
36 | 36 | |
37 | - $panels[] = new GravityView_Debug_Bar; |
|
37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
38 | 38 | |
39 | 39 | return $panels; |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
48 | 48 | return $supported_plugins; |
49 | 49 | } |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string "print_r" or "var_export" |
73 | 73 | */ |
74 | 74 | static function get_print_function() { |
75 | - if( ob_get_level() > 0 ) { |
|
75 | + if ( ob_get_level() > 0 ) { |
|
76 | 76 | $function = 'var_export'; |
77 | 77 | } else { |
78 | 78 | $function = 'print_r'; |
@@ -88,36 +88,36 @@ discard block |
||
88 | 88 | $notice = array( |
89 | 89 | 'message' => $function( $message, true ), |
90 | 90 | 'data' => $data, |
91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
91 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
92 | 92 | ); |
93 | 93 | |
94 | - if( !in_array( $notice, self::$notices ) ) { |
|
95 | - self::$notices[] = $notice; |
|
94 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
95 | + self::$notices[ ] = $notice; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( class_exists("GFLogging") ) { |
|
98 | + if ( class_exists( "GFLogging" ) ) { |
|
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - static function log_error( $message = '', $data = null ) { |
|
104 | + static function log_error( $message = '', $data = null ) { |
|
105 | 105 | |
106 | 106 | $function = self::get_print_function(); |
107 | 107 | |
108 | 108 | $error = array( |
109 | 109 | 'message' => $message, |
110 | 110 | 'data' => $data, |
111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
111 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
112 | 112 | ); |
113 | 113 | |
114 | - if( !in_array( $error, self::$errors ) ) { |
|
115 | - self::$errors[] = $error; |
|
114 | + if ( ! in_array( $error, self::$errors ) ) { |
|
115 | + self::$errors[ ] = $error; |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( class_exists("GFLogging") ) { |
|
118 | + if ( class_exists( "GFLogging" ) ) { |
|
119 | 119 | GFLogging::include_logger(); |
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
120 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -180,8 +180,8 @@ |
||
180 | 180 | |
181 | 181 | // check widget settings: |
182 | 182 | // [search_free] => 1 |
183 | - // [search_date] => 1 |
|
184 | - $search_generic = array(); |
|
183 | + // [search_date] => 1 |
|
184 | + $search_generic = array(); |
|
185 | 185 | if( !empty( $widget['search_free'] ) ) { |
186 | 186 | $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
187 | 187 | } |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $redux_settings = $this->get_redux_settings(); |
52 | 52 | |
53 | 53 | // No need to process |
54 | - if( false === $redux_settings ) { |
|
54 | + if ( false === $redux_settings ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
58 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
59 | 59 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
60 | 60 | } |
61 | 61 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
70 | 70 | |
71 | 71 | // And now remove the previous option, so this is a one-time thing. |
72 | - delete_option('gravityview_settings'); |
|
73 | - delete_option('gravityview_settings-transients'); |
|
72 | + delete_option( 'gravityview_settings' ); |
|
73 | + delete_option( 'gravityview_settings-transients' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | |
87 | 87 | $data = array( |
88 | 88 | 'edd_action' => 'check_license', |
89 | - 'license' => rgget('license_key', $redux_settings ), |
|
89 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
90 | 90 | 'update' => false, |
91 | 91 | 'format' => 'object', |
92 | 92 | ); |
93 | 93 | |
94 | 94 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
95 | 95 | |
96 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | - $redux_settings['license_key_status'] = $license_call->license; |
|
98 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
96 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
98 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $redux_settings; |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | function get_redux_settings() { |
110 | 110 | |
111 | 111 | // Previous settings set by Redux |
112 | - $redux_option = get_option('gravityview_settings'); |
|
112 | + $redux_option = get_option( 'gravityview_settings' ); |
|
113 | 113 | |
114 | 114 | // No Redux settings? Don't proceed. |
115 | - if( false === $redux_option ) { |
|
115 | + if ( false === $redux_option ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -122,21 +122,21 @@ discard block |
||
122 | 122 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
123 | 123 | ); |
124 | 124 | |
125 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
125 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
126 | 126 | |
127 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
127 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
128 | 128 | |
129 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
129 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
130 | 130 | |
131 | 131 | // This contains the last response for license validation |
132 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
132 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
133 | 133 | |
134 | - $saved_license = rgget('license', $saved_values ); |
|
134 | + $saved_license = rgget( 'license', $saved_values ); |
|
135 | 135 | |
136 | 136 | // Only use the last-saved values if they are for the same license |
137 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
139 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
137 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
139 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | /** ---- Migrate from old search widget to new search widget ---- */ |
149 | 149 | function update_search_on_views() { |
150 | 150 | |
151 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
152 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
151 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
152 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Loop through all the views |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | $views = get_posts( $query_args ); |
163 | 163 | |
164 | - foreach( $views as $view ) { |
|
164 | + foreach ( $views as $view ) { |
|
165 | 165 | |
166 | 166 | $widgets = get_post_meta( $view->ID, '_gravityview_directory_widgets', true ); |
167 | 167 | $search_fields = null; |
168 | 168 | |
169 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
169 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
170 | 170 | |
171 | 171 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
172 | 172 | |
173 | - foreach( $widgets as $area => $ws ) { |
|
174 | - foreach( $ws as $k => $widget ) { |
|
175 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
173 | + foreach ( $widgets as $area => $ws ) { |
|
174 | + foreach ( $ws as $k => $widget ) { |
|
175 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
176 | 176 | |
177 | - if( is_null( $search_fields ) ) { |
|
177 | + if ( is_null( $search_fields ) ) { |
|
178 | 178 | $search_fields = $this->get_search_fields( $view->ID ); |
179 | 179 | } |
180 | 180 | |
@@ -182,24 +182,24 @@ discard block |
||
182 | 182 | // [search_free] => 1 |
183 | 183 | // [search_date] => 1 |
184 | 184 | $search_generic = array(); |
185 | - if( !empty( $widget['search_free'] ) ) { |
|
186 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
185 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
186 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
187 | 187 | } |
188 | - if( !empty( $widget['search_date'] ) ) { |
|
189 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
188 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
189 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $search_config = array_merge( $search_generic, $search_fields ); |
193 | 193 | |
194 | 194 | // don't throw '[]' when json_encode an empty array |
195 | - if( empty( $search_config ) ) { |
|
195 | + if ( empty( $search_config ) ) { |
|
196 | 196 | $search_config = ''; |
197 | 197 | } else { |
198 | 198 | $search_config = json_encode( $search_config ); |
199 | 199 | } |
200 | 200 | |
201 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
202 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
201 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
202 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
203 | 203 | |
204 | 204 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
205 | 205 | } |
@@ -227,26 +227,26 @@ discard block |
||
227 | 227 | // check view fields' settings |
228 | 228 | $fields = get_post_meta( $view_id, '_gravityview_directory_fields', true ); |
229 | 229 | |
230 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
230 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
231 | 231 | |
232 | - foreach( $fields as $t => $fs ) { |
|
232 | + foreach ( $fields as $t => $fs ) { |
|
233 | 233 | |
234 | - foreach( $fs as $k => $field ) { |
|
234 | + foreach ( $fs as $k => $field ) { |
|
235 | 235 | // is field a search_filter ? |
236 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
236 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
237 | 237 | |
238 | 238 | // get field type & calculate the input type (by default) |
239 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
239 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
240 | 240 | |
241 | - if( empty( $form_field['type'] ) ) { |
|
241 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // depending on the field type assign a group of possible search field types |
246 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
246 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
247 | 247 | |
248 | 248 | // add field to config |
249 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
249 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * GravityView default widgets and generic widget class |
|
4 | - * |
|
5 | - * @deprecated 1.7.5 |
|
6 | - */ |
|
3 | + * GravityView default widgets and generic widget class |
|
4 | + * |
|
5 | + * @deprecated 1.7.5 |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
@@ -5,4 +5,4 @@ |
||
5 | 5 | * @deprecated 1.7.5 |
6 | 6 | */ |
7 | 7 | |
8 | -include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
8 | +include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
@@ -7,15 +7,15 @@ |
||
7 | 7 | <div id="publishing-action"> |
8 | 8 | <?php |
9 | 9 | |
10 | - /** |
|
11 | - * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
12 | - * @since 1.11.1 |
|
13 | - * @param string $back_link Existing URL of the Cancel link |
|
14 | - * @param array $form The Gravity Forms form |
|
15 | - * @param array $entry The Gravity Forms entry |
|
16 | - * @param int $view_id The current View ID |
|
17 | - */ |
|
18 | - $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
10 | + /** |
|
11 | + * @filter `gravityview/edit_entry/cancel_link` Modify the cancel button link URL |
|
12 | + * @since 1.11.1 |
|
13 | + * @param string $back_link Existing URL of the Cancel link |
|
14 | + * @param array $form The Gravity Forms form |
|
15 | + * @param array $entry The Gravity Forms entry |
|
16 | + * @param int $view_id The current View ID |
|
17 | + */ |
|
18 | + $back_link = apply_filters( 'gravityview/edit_entry/cancel_link', remove_query_arg( array( 'page', 'view', 'edit' ) ), $object->form, $object->entry, $object->view_id ); |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @action `gravityview/edit-entry/publishing-action/before` Triggered before the submit buttons in the Edit Entry screen, inside the `<div id="publishing-action">` container. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $labels = array( |
31 | 31 | 'cancel' => __( 'Cancel', 'gravityview' ), |
32 | - 'submit' => __( 'Update', 'gravityview') |
|
32 | + 'submit' => __( 'Update', 'gravityview' ) |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id ); |
44 | 44 | |
45 | 45 | ?> |
46 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
46 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
47 | 47 | |
48 | - <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
48 | + <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
49 | 49 | <?php |
50 | 50 | |
51 | 51 | /** |
@@ -59,5 +59,5 @@ discard block |
||
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <input type="hidden" name="action" value="update" /> |
62 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
62 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
63 | 63 | </div> |