@@ -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 | |
@@ -34,23 +34,23 @@ discard block |
||
| 34 | 34 | /** gf_entries page - entries table screen */ |
| 35 | 35 | |
| 36 | 36 | // capture bulk actions |
| 37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
| 37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
| 38 | 38 | // add hidden field with approve status |
| 39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
| 40 | 40 | // process ajax approve entry requests |
| 41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
| 41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
| 42 | 42 | |
| 43 | 43 | // when using the User opt-in field, check on entry submission |
| 44 | 44 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
| 45 | 45 | |
| 46 | 46 | // in case entry is edited (on admin or frontend) |
| 47 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 47 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 51 | 51 | |
| 52 | 52 | // adding styles and scripts |
| 53 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 53 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 54 | 54 | // bypass Gravity Forms no-conflict mode |
| 55 | 55 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 56 | 56 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function tooltips( $tooltips ) { |
| 67 | 67 | |
| 68 | - $tooltips['form_gravityview_fields'] = array( |
|
| 69 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 70 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 68 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 69 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 70 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | return $tooltips; |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 185 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
| 185 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 186 | 186 | |
| 187 | 187 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 188 | 188 | |
| 189 | 189 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
| 190 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
| 190 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // All entries are set to be updated, not just the visible ones |
| 206 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 206 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 207 | 207 | |
| 208 | 208 | // Convert the current entry search into GF-formatted search criteria |
| 209 | 209 | $search = array( |
| 210 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 211 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 212 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 210 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 211 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 212 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | } else { |
| 221 | 221 | |
| 222 | - $entries = $_POST['lead']; |
|
| 222 | + $entries = $_POST[ 'lead' ]; |
|
| 223 | 223 | |
| 224 | 224 | } |
| 225 | 225 | |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private static function update_bulk( $entries, $approved, $form_id ) { |
| 262 | 262 | |
| 263 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
| 263 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
| 264 | 264 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
| 265 | 265 | return false; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 268 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 269 | 269 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 270 | 270 | return false; |
| 271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // calculate approved field id |
| 276 | 276 | $approved_column_id = self::get_approved_column( $form_id ); |
| 277 | 277 | |
| 278 | - foreach( $entries as $entry_id ) { |
|
| 278 | + foreach ( $entries as $entry_id ) { |
|
| 279 | 279 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | * @param int $approvedcolumn (default: 0) |
| 295 | 295 | * @return boolean True: It worked; False: it failed |
| 296 | 296 | */ |
| 297 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 297 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 298 | 298 | |
| 299 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 299 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 300 | 300 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if( empty( $approvedcolumn ) ) { |
|
| 304 | + if ( empty( $approvedcolumn ) ) { |
|
| 305 | 305 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | self::update_approved_meta( $entry_id, $approved ); |
| 321 | 321 | |
| 322 | 322 | // add note to entry |
| 323 | - if( $result === true ) { |
|
| 323 | + if ( $result === true ) { |
|
| 324 | 324 | |
| 325 | 325 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 326 | 326 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
| 333 | 333 | |
| 334 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 334 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 335 | 335 | $current_user = wp_get_current_user(); |
| 336 | 336 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
| 337 | 337 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | do_action( 'gravityview_clear_form_cache', $form_id ); |
| 345 | 345 | |
| 346 | - } else if( is_wp_error( $result ) ) { |
|
| 346 | + } else if ( is_wp_error( $result ) ) { |
|
| 347 | 347 | |
| 348 | 348 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 349 | 349 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * @param $form array Gravity Forms form object |
| 365 | 365 | */ |
| 366 | 366 | public function after_submission( $entry, $form ) { |
| 367 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
| 367 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
@@ -380,12 +380,12 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 382 | 382 | |
| 383 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
| 383 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * If the form doesn't contain the approve field, don't assume anything. |
| 387 | 387 | */ |
| 388 | - if( empty( $approvedcolumn ) ) { |
|
| 388 | + if ( empty( $approvedcolumn ) ) { |
|
| 389 | 389 | return; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $is_approved = empty( $is_approved ) ? 0 : 'Approved'; |
| 414 | 414 | |
| 415 | 415 | // update entry meta |
| 416 | - if( function_exists('gform_update_meta') ) { |
|
| 416 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 417 | 417 | |
| 418 | 418 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
| 419 | 419 | |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | */ |
| 426 | 426 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
| 427 | 427 | |
| 428 | - if( empty( $is_approved ) ) { |
|
| 428 | + if ( empty( $is_approved ) ) { |
|
| 429 | 429 | |
| 430 | 430 | /** |
| 431 | 431 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | } else { |
| 449 | 449 | |
| 450 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 450 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 451 | 451 | |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -459,21 +459,21 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | public function ajax_update_approved() { |
| 461 | 461 | |
| 462 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
| 462 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
| 463 | 463 | |
| 464 | 464 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 465 | 465 | |
| 466 | 466 | $result = false; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 469 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
| 470 | 470 | |
| 471 | 471 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 472 | 472 | |
| 473 | 473 | $result = false; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 476 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
| 477 | 477 | |
| 478 | 478 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 479 | 479 | |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | else { |
| 484 | 484 | |
| 485 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
| 485 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
| 486 | 486 | |
| 487 | - if( is_wp_error( $result ) ) { |
|
| 487 | + if ( is_wp_error( $result ) ) { |
|
| 488 | 488 | /** @var WP_Error $result */ |
| 489 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
| 489 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
| 490 | 490 | $result = false; |
| 491 | 491 | } |
| 492 | 492 | |
@@ -506,29 +506,29 @@ discard block |
||
| 506 | 506 | */ |
| 507 | 507 | static public function get_approved_column( $form ) { |
| 508 | 508 | |
| 509 | - if( empty( $form ) ) { |
|
| 509 | + if ( empty( $form ) ) { |
|
| 510 | 510 | return null; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if( !is_array( $form ) ) { |
|
| 513 | + if ( ! is_array( $form ) ) { |
|
| 514 | 514 | $form = GVCommon::get_form( $form ); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - foreach( $form['fields'] as $key => $field ) { |
|
| 517 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 518 | 518 | |
| 519 | - $field = (array) $field; |
|
| 519 | + $field = (array)$field; |
|
| 520 | 520 | |
| 521 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 522 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 523 | - return $field['inputs'][0]['id']; |
|
| 521 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 522 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 523 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 528 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 529 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 530 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 531 | - return $input['id']; |
|
| 528 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 529 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 530 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 531 | + return $input[ 'id' ]; |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -539,18 +539,18 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | |
| 541 | 541 | |
| 542 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 542 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 543 | 543 | |
| 544 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 544 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 545 | 545 | return; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if( empty( $entry['id'] ) ) { |
|
| 548 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 549 | 549 | return; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
| 553 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
| 552 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
| 553 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | function add_scripts_and_styles( $hook ) { |
| 561 | 561 | |
| 562 | - if( !class_exists( 'RGForms' ) ) { |
|
| 562 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 563 | 563 | |
| 564 | 564 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 565 | 565 | |
@@ -568,39 +568,39 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | // enqueue styles & scripts gf_entries |
| 570 | 570 | // But only if we're on the main Entries page, not on reports pages |
| 571 | - if( RGForms::get_page() === 'entry_list' ) { |
|
| 571 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
| 572 | 572 | |
| 573 | - $form_id = RGForms::get('id'); |
|
| 573 | + $form_id = RGForms::get( 'id' ); |
|
| 574 | 574 | |
| 575 | 575 | // If there are no forms identified, use the first form. That's how GF does it. |
| 576 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 576 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 577 | 577 | $forms = gravityview_get_forms(); |
| 578 | - if( !empty( $forms ) ) { |
|
| 579 | - $form_id = $forms[0]['id']; |
|
| 578 | + if ( ! empty( $forms ) ) { |
|
| 579 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 584 | 584 | |
| 585 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 585 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 586 | 586 | wp_enqueue_style( 'gravityview_entries_list' ); |
| 587 | 587 | |
| 588 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 588 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 589 | 589 | |
| 590 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 590 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 591 | 591 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
| 592 | 592 | |
| 593 | 593 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 594 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
| 594 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
| 595 | 595 | 'form_id' => $form_id, |
| 596 | 596 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 597 | 597 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
| 598 | 598 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 599 | 599 | 'bulk_message' => $this->bulk_update_message, |
| 600 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
| 601 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
| 602 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 603 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
| 600 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
| 601 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
| 602 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 603 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
| 604 | 604 | ) ); |
| 605 | 605 | |
| 606 | 606 | } |
@@ -643,8 +643,8 @@ discard block |
||
| 643 | 643 | // Sanitize the values, just to be sure. |
| 644 | 644 | foreach ( $bulk_actions as $key => $group ) { |
| 645 | 645 | foreach ( $group as $i => $action ) { |
| 646 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 647 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 646 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 647 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
@@ -669,13 +669,13 @@ discard block |
||
| 669 | 669 | * @since 1.7.2 |
| 670 | 670 | * @param boolean $hide_if_no_connections |
| 671 | 671 | */ |
| 672 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 672 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 673 | 673 | |
| 674 | - if( $hide_if_no_connections ) { |
|
| 674 | + if ( $hide_if_no_connections ) { |
|
| 675 | 675 | |
| 676 | 676 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 677 | 677 | |
| 678 | - if( empty( $connected_views ) ) { |
|
| 678 | + if ( empty( $connected_views ) ) { |
|
| 679 | 679 | $show_approve_column = false; |
| 680 | 680 | } |
| 681 | 681 | } |
@@ -685,18 +685,18 @@ discard block |
||
| 685 | 685 | * @param boolean $show_approve_column Whether the column will be shown |
| 686 | 686 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 687 | 687 | */ |
| 688 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 688 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 689 | 689 | |
| 690 | 690 | return $show_approve_column; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | function register_gform_noconflict_script( $scripts ) { |
| 694 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 694 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 695 | 695 | return $scripts; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | function register_gform_noconflict_style( $styles ) { |
| 699 | - $styles[] = 'gravityview_entries_list'; |
|
| 699 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 700 | 700 | return $styles; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -171,11 +171,13 @@ |
||
| 171 | 171 | $public_display['nickname'] = $profileuser->nickname; |
| 172 | 172 | $public_display['username'] = $profileuser->user_login; |
| 173 | 173 | |
| 174 | - if ( !empty($profileuser->first_name) ) |
|
| 175 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 174 | + if ( !empty($profileuser->first_name) ) { |
|
| 175 | + $public_display['firstname'] = $profileuser->first_name; |
|
| 176 | + } |
|
| 176 | 177 | |
| 177 | - if ( !empty($profileuser->last_name) ) |
|
| 178 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 178 | + if ( !empty($profileuser->last_name) ) { |
|
| 179 | + $public_display['lastname'] = $profileuser->last_name; |
|
| 180 | + } |
|
| 179 | 181 | |
| 180 | 182 | if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
| 181 | 183 | $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @since 1.11 |
| 44 | 44 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
| 45 | 45 | */ |
| 46 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 47 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
| 46 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 47 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
| 48 | 48 | |
| 49 | 49 | // last resort in case the current user display name don't match any of the defaults |
| 50 | 50 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function update_user( $form = array(), $entry_id = 0 ) { |
| 64 | 64 | |
| 65 | - if( !class_exists( 'GFAPI' ) || !class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
| 65 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // support for GF User Registration 3.x |
| 70 | - $gf_user_3 = class_exists('GF_User_Registration') ? true : false; |
|
| 70 | + $gf_user_3 = class_exists( 'GF_User_Registration' ) ? true : false; |
|
| 71 | 71 | |
| 72 | - if( $gf_user_3 ) { |
|
| 72 | + if ( $gf_user_3 ) { |
|
| 73 | 73 | $gf_user_registration = GF_User_Registration::get_instance(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @since 1.14 |
| 88 | 88 | */ |
| 89 | - if( $gf_user_3 ) { |
|
| 89 | + if ( $gf_user_3 ) { |
|
| 90 | 90 | $config = $gf_user_registration->get_single_submission_feed( $entry, $form ); |
| 91 | 91 | } else { |
| 92 | 92 | $config = GFUser::get_active_config( $form, $entry ); |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
| 104 | 104 | |
| 105 | - if( $preserve_role ) { |
|
| 106 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
| 105 | + if ( $preserve_role ) { |
|
| 106 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Make sure the current display name is not changed with the update user method. |
| 111 | 111 | * @since 1.15 |
| 112 | 112 | */ |
| 113 | - $config['meta']['displayname'] = $this->match_current_display_name( $entry['created_by'] ); |
|
| 113 | + $config[ 'meta' ][ 'displayname' ] = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $is_create_feed = ( $config && rgars( $config, $feed_pos ) === 'create' ); |
| 128 | 128 | |
| 129 | 129 | // Only update if it's a create feed |
| 130 | - if( ! $is_create_feed ) { |
|
| 130 | + if ( ! $is_create_feed ) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | add_filter( 'send_email_change_email', '__return_false', 3 ); |
| 137 | 137 | |
| 138 | 138 | // Trigger the User Registration update user method |
| 139 | - if( $gf_user_3 ) { |
|
| 139 | + if ( $gf_user_3 ) { |
|
| 140 | 140 | $gf_user_registration->update_user( $entry, $form, $config ); |
| 141 | 141 | } else { |
| 142 | 142 | GFUser::update_user( $entry, $form, $config ); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // In case we can't find the current display name format, or it is the 'nickname' format (which Gravity Forms doesn't support) |
| 168 | 168 | // trigger last resort method at the 'gform_user_updated' hook |
| 169 | - if( false === $format || 'nickname' === $format ) { |
|
| 169 | + if ( false === $format || 'nickname' === $format ) { |
|
| 170 | 170 | $this->_user_before_update = $user; |
| 171 | 171 | $format = 'nickname'; |
| 172 | 172 | } |
@@ -186,18 +186,18 @@ discard block |
||
| 186 | 186 | public function generate_display_names( $profileuser ) { |
| 187 | 187 | |
| 188 | 188 | $public_display = array(); |
| 189 | - $public_display['nickname'] = $profileuser->nickname; |
|
| 190 | - $public_display['username'] = $profileuser->user_login; |
|
| 189 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
| 190 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
| 191 | 191 | |
| 192 | - if ( !empty($profileuser->first_name) ) |
|
| 193 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 192 | + if ( ! empty( $profileuser->first_name ) ) |
|
| 193 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
| 194 | 194 | |
| 195 | - if ( !empty($profileuser->last_name) ) |
|
| 196 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 195 | + if ( ! empty( $profileuser->last_name ) ) |
|
| 196 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
| 197 | 197 | |
| 198 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
| 199 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 200 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 198 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
| 199 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 200 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $public_display = array_map( 'trim', $public_display ); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
| 229 | 229 | |
| 230 | - $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' ); |
|
| 230 | + $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' ); |
|
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Don't restore display name: |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * - or we don't need as we found the correct format before updating user. |
| 237 | 237 | * @since 1.14.4 |
| 238 | 238 | */ |
| 239 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 239 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -262,10 +262,10 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | $updated = wp_update_user( $restored_user ); |
| 264 | 264 | |
| 265 | - if( is_wp_error( $updated ) ) { |
|
| 266 | - do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
| 265 | + if ( is_wp_error( $updated ) ) { |
|
| 266 | + do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
| 267 | 267 | } else { |
| 268 | - do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
| 268 | + do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $this->_user_before_update = null; |
@@ -4,7 +4,9 @@ |
||
| 4 | 4 | //set_site_transient( 'update_plugins', null ); |
| 5 | 5 | |
| 6 | 6 | // Exit if accessed directly |
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 8 | + exit; |
|
| 9 | +} |
|
| 8 | 10 | |
| 9 | 11 | /** |
| 10 | 12 | * Allows plugins to use their own update API. |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | * @since 1.0 |
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
| 37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
| 38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
| 39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
| 39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | // Add help page to GravityView menu |
| 54 | 54 | add_submenu_page( |
| 55 | 55 | 'edit.php?post_type=gravityview', |
| 56 | - __('GravityView: Getting Started', 'gravityview'), |
|
| 57 | - __('Getting Started', 'gravityview'), |
|
| 56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
| 57 | + __( 'Getting Started', 'gravityview' ), |
|
| 58 | 58 | $this->minimum_capability, |
| 59 | 59 | 'gv-getting-started', |
| 60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return boolean $is_page True: yep; false: nope |
| 89 | 89 | */ |
| 90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
| 90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
| 91 | 91 | global $plugin_page; |
| 92 | 92 | |
| 93 | - if($is_page) { return $is_page; } |
|
| 93 | + if ( $is_page ) { return $is_page; } |
|
| 94 | 94 | |
| 95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
| 109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
| 110 | 110 | |
| 111 | - if( !$this->is_dashboard_page() ) { return; } |
|
| 111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
| 112 | 112 | |
| 113 | 113 | ?> |
| 114 | 114 | <style type="text/css" media="screen"> |
@@ -141,20 +141,20 @@ discard block |
||
| 141 | 141 | // Don't fetch -beta, etc. |
| 142 | 142 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
| 143 | 143 | |
| 144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 144 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 145 | 145 | ?> |
| 146 | 146 | |
| 147 | 147 | <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
| 148 | 148 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
| 149 | 149 | |
| 150 | 150 | <h2 class="nav-tab-wrapper clear"> |
| 151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 152 | 152 | <?php _e( "Getting Started", 'gravityview' ); ?> |
| 153 | 153 | </a> |
| 154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 155 | 155 | <?php _e( "List of Changes", 'gravityview' ); ?> |
| 156 | 156 | </a> |
| 157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 158 | 158 | <?php _e( 'Credits', 'gravityview' ); ?> |
| 159 | 159 | </a> |
| 160 | 160 | </h2> |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | <h2>Create a View</h2> |
| 191 | 191 | |
| 192 | 192 | <ol class="ol-decimal"> |
| 193 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
| 193 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
| 194 | 194 | <li>If you want to <strong>create a new form</strong>, click the "Start Fresh" button</li> |
| 195 | 195 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
| 196 | 196 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | </ul> |
| 526 | 526 | |
| 527 | 527 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
| 528 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 528 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 529 | 529 | </div> |
| 530 | 530 | </div> |
| 531 | 531 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | global $plugin_page; |
| 566 | 566 | |
| 567 | 567 | // Bail if we're just editing the plugin |
| 568 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 568 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 569 | 569 | |
| 570 | 570 | // Bail if no activation redirect |
| 571 | 571 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
| 577 | 577 | |
| 578 | 578 | // Don't do anything if they've already seen the new version info |
| 579 | - if( $upgrade === GravityView_Plugin::version ) { |
|
| 579 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
| 580 | 580 | return; |
| 581 | 581 | } |
| 582 | 582 | |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
| 585 | 585 | |
| 586 | 586 | // Bail if activating from network, or bulk |
| 587 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
| 587 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
| 588 | 588 | |
| 589 | 589 | // First time install |
| 590 | - if( ! $upgrade ) { |
|
| 590 | + if ( ! $upgrade ) { |
|
| 591 | 591 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
| 592 | 592 | } |
| 593 | 593 | // Update |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | $delete = $this->get_delete_setting(); |
| 36 | 36 | |
| 37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 37 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 38 | 38 | $this->fire_everything(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 99 | 99 | |
| 100 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 101 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 100 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 101 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 102 | 102 | |
| 103 | 103 | $sql = $wpdb->prepare( " |
| 104 | 104 | DELETE FROM $notes_table |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @param mixed $data Additional data to display |
| 352 | 352 | * @return void |
| 353 | 353 | */ |
| 354 | - public static function log_debug( $message, $data = null ){ |
|
| 354 | + public static function log_debug( $message, $data = null ) { |
|
| 355 | 355 | /** |
| 356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @param string $message log message |
| 366 | 366 | * @return void |
| 367 | 367 | */ |
| 368 | - public static function log_error( $message, $data = null ){ |
|
| 368 | + public static function log_error( $message, $data = null ) { |
|
| 369 | 369 | /** |
| 370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 371 | 371 | * @param string $message Error message to display |
@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | /** Load common & connector functions */ |
| 68 | 68 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
| 69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
| 70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
| 69 | +require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
| 70 | +require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
| 71 | 71 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
| 72 | 72 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
| 73 | 73 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
| 74 | 74 | |
| 75 | 75 | /** Register Post Types and Rewrite Rules */ |
| 76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
| 76 | +require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
| 77 | 77 | |
| 78 | 78 | /** Add Cache Class */ |
| 79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
| 79 | +require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
| 80 | 80 | |
| 81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
| 82 | -if( is_admin() ) { |
|
| 82 | +if ( is_admin() ) { |
|
| 83 | 83 | register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
| 84 | 84 | register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
| 85 | 85 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public static function getInstance() { |
| 102 | 102 | |
| 103 | - if( empty( self::$instance ) ) { |
|
| 103 | + if ( empty( self::$instance ) ) { |
|
| 104 | 104 | self::$instance = new self; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | private function __construct() { |
| 111 | 111 | |
| 112 | 112 | |
| 113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
| 113 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function include_files() { |
| 141 | 141 | |
| 142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
| 142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
| 143 | 143 | |
| 144 | 144 | // Load fields |
| 145 | 145 | include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
@@ -150,20 +150,20 @@ discard block |
||
| 150 | 150 | include_once( $gv_field_filename ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
| 154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
| 153 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
| 154 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
| 155 | 155 | |
| 156 | 156 | // Load Extensions |
| 157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
| 158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 160 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 158 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 159 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 160 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 161 | 161 | |
| 162 | 162 | // Load WordPress Widgets |
| 163 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 163 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 164 | 164 | |
| 165 | 165 | // Load GravityView Widgets |
| 166 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 166 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 167 | 167 | |
| 168 | 168 | // Add oEmbed |
| 169 | 169 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 178 | 178 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 179 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 182 | 182 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @return bool |
| 192 | 192 | */ |
| 193 | 193 | public static function is_network_activated() { |
| 194 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 194 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @since 1.7.5.1 |
| 257 | 257 | */ |
| 258 | 258 | public static function include_widget_class() { |
| 259 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 259 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | if ( ! $loaded ) { |
| 280 | 280 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 281 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 281 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 282 | 282 | load_textdomain( 'gravityview', $mofile ); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -309,12 +309,12 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function frontend_actions( $force = false ) { |
| 311 | 311 | |
| 312 | - if( self::is_admin() && ! $force ) { return; } |
|
| 312 | + if ( self::is_admin() && ! $force ) { return; } |
|
| 313 | 313 | |
| 314 | 314 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 315 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 316 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 317 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 315 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 316 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 317 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 318 | 318 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 319 | 319 | |
| 320 | 320 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public static function get_default_widget_areas() { |
| 341 | 341 | $default_areas = array( |
| 342 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 343 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 342 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 343 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 344 | 344 | ); |
| 345 | 345 | |
| 346 | 346 | /** |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @param mixed $data Additional data to display |
| 359 | 359 | * @return void |
| 360 | 360 | */ |
| 361 | - public static function log_debug( $message, $data = null ){ |
|
| 361 | + public static function log_debug( $message, $data = null ) { |
|
| 362 | 362 | /** |
| 363 | 363 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 364 | 364 | * @param string $message Message to display |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @param string $message log message |
| 373 | 373 | * @return void |
| 374 | 374 | */ |
| 375 | - public static function log_error( $message, $data = null ){ |
|
| 375 | + public static function log_error( $message, $data = null ) { |
|
| 376 | 376 | /** |
| 377 | 377 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 378 | 378 | * @param string $message Error message to display |
@@ -383,4 +383,4 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | } // end class GravityView_Plugin |
| 385 | 385 | |
| 386 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 386 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
|
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Don't exit if we're running test suite. |
| 37 | 37 | * @since 1.15 |
| 38 | 38 | */ |
| 39 | - if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 39 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 40 | 40 | return $mixed; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | 52 | function check_ajax_nonce() { |
| 53 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) { |
|
| 53 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) { |
|
| 54 | 54 | $this->_exit( false ); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | //check nonce |
| 68 | 68 | $this->check_ajax_nonce(); |
| 69 | 69 | |
| 70 | - $context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory'; |
|
| 70 | + $context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory'; |
|
| 71 | 71 | |
| 72 | 72 | // If Form was changed, JS sends form ID, if start fresh, JS sends template_id |
| 73 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 74 | - do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context ); |
|
| 73 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 74 | + do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context ); |
|
| 75 | 75 | $this->_exit(); |
| 76 | - } elseif( !empty( $_POST['template_id'] ) ) { |
|
| 77 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 76 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 77 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 78 | 78 | do_action( 'gravityview_render_available_fields', $form, $context ); |
| 79 | 79 | $this->_exit(); |
| 80 | 80 | } |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | function get_active_areas() { |
| 95 | 95 | $this->check_ajax_nonce(); |
| 96 | 96 | |
| 97 | - if( empty( $_POST['template_id'] ) ) { |
|
| 97 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 98 | 98 | $this->_exit( false ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | ob_start(); |
| 102 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true ); |
|
| 103 | - $response['directory'] = ob_get_clean(); |
|
| 102 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true ); |
|
| 103 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 104 | 104 | |
| 105 | 105 | ob_start(); |
| 106 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'single', '', true ); |
|
| 107 | - $response['single'] = ob_get_clean(); |
|
| 106 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true ); |
|
| 107 | + $response[ 'single' ] = ob_get_clean(); |
|
| 108 | 108 | |
| 109 | 109 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 110 | 110 | |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $this->check_ajax_nonce(); |
| 121 | 121 | |
| 122 | - if( empty( $_POST['template_id'] ) ) { |
|
| 122 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 123 | 123 | $this->_exit( false ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // get the fields xml config file for this specific preset |
| 127 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
| 127 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
| 128 | 128 | // import fields |
| 129 | - if( !empty( $preset_fields_path ) ) { |
|
| 129 | + if ( ! empty( $preset_fields_path ) ) { |
|
| 130 | 130 | $presets = $this->import_fields( $preset_fields_path ); |
| 131 | 131 | } else { |
| 132 | 132 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
| 135 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
| 136 | 136 | |
| 137 | 137 | // template areas |
| 138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -142,20 +142,20 @@ discard block |
||
| 142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 143 | 143 | |
| 144 | 144 | ob_start(); |
| 145 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
| 146 | - $response['header'] = ob_get_clean(); |
|
| 145 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 146 | + $response[ 'header' ] = ob_get_clean(); |
|
| 147 | 147 | |
| 148 | 148 | ob_start(); |
| 149 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
| 150 | - $response['footer'] = ob_get_clean(); |
|
| 149 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 150 | + $response[ 'footer' ] = ob_get_clean(); |
|
| 151 | 151 | |
| 152 | 152 | ob_start(); |
| 153 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
| 154 | - $response['directory'] = ob_get_clean(); |
|
| 153 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
| 154 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 155 | 155 | |
| 156 | 156 | ob_start(); |
| 157 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
| 158 | - $response['single'] = ob_get_clean(); |
|
| 157 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
| 158 | + $response[ 'single' ] = ob_get_clean(); |
|
| 159 | 159 | |
| 160 | 160 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 161 | 161 | |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $this->check_ajax_nonce(); |
| 175 | 175 | |
| 176 | - if( empty( $_POST['template_id'] ) ) { |
|
| 176 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 177 | 177 | do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' ); |
| 178 | 178 | $this->_exit( false ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // get the xml for this specific template_id |
| 182 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
| 182 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
| 183 | 183 | |
| 184 | 184 | // import form |
| 185 | 185 | $form = $this->import_form( $preset_form_xml_path ); |
| 186 | 186 | |
| 187 | 187 | // get the form ID |
| 188 | - if( false === $form ) { |
|
| 188 | + if ( false === $form ) { |
|
| 189 | 189 | // send error to user |
| 190 | - do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] ); |
|
| 190 | + do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] ); |
|
| 191 | 191 | |
| 192 | 192 | $this->_exit( false ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
| 195 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path ); |
| 208 | 208 | |
| 209 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
| 209 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
| 210 | 210 | do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path ); |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count ); |
| 219 | 219 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms ); |
| 220 | 220 | |
| 221 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
| 221 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
| 222 | 222 | do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' ); |
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | // import success - return form id |
| 227 | - return $forms[0]; |
|
| 227 | + return $forms[ 0 ]; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | function get_field_options() { |
| 239 | 239 | $this->check_ajax_nonce(); |
| 240 | 240 | |
| 241 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
| 241 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
| 242 | 242 | do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' ); |
| 243 | 243 | $this->_exit( false ); |
| 244 | 244 | } |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | $_post = array_map( 'esc_attr', $_post ); |
| 251 | 251 | |
| 252 | 252 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
| 253 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
| 254 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
| 253 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
| 254 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
| 255 | 255 | |
| 256 | - $response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
| 256 | + $response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
| 257 | 257 | |
| 258 | 258 | $response = gravityview_strip_whitespace( $response ); |
| 259 | 259 | |
@@ -274,15 +274,15 @@ discard block |
||
| 274 | 274 | $form = ''; |
| 275 | 275 | |
| 276 | 276 | // if form id is set, use it, else, get form from preset |
| 277 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 277 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 278 | 278 | |
| 279 | - $form = (int) $_POST['form_id']; |
|
| 279 | + $form = (int)$_POST[ 'form_id' ]; |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | // get form from preset |
| 283 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
| 283 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 284 | 284 | |
| 285 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 285 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
@@ -298,27 +298,27 @@ discard block |
||
| 298 | 298 | * @param string $template_id Preset template |
| 299 | 299 | * |
| 300 | 300 | */ |
| 301 | - static function pre_get_form_fields( $template_id = '') { |
|
| 301 | + static function pre_get_form_fields( $template_id = '' ) { |
|
| 302 | 302 | |
| 303 | - if( empty( $template_id ) ) { |
|
| 303 | + if ( empty( $template_id ) ) { |
|
| 304 | 304 | do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' ); |
| 305 | 305 | return false; |
| 306 | 306 | } else { |
| 307 | 307 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
| 308 | - if( !file_exists( $form_file ) ) { |
|
| 309 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file ); |
|
| 308 | + if ( ! file_exists( $form_file ) ) { |
|
| 309 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file ); |
|
| 310 | 310 | return false; |
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Load xml parser (from GravityForms) |
| 315 | - if( class_exists( 'GFCommon' ) ) { |
|
| 315 | + if ( class_exists( 'GFCommon' ) ) { |
|
| 316 | 316 | $xml_parser = GFCommon::get_base_path() . '/xml.php'; |
| 317 | 317 | } else { |
| 318 | 318 | $xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php'; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if( file_exists( $xml_parser ) ) { |
|
| 321 | + if ( file_exists( $xml_parser ) ) { |
|
| 322 | 322 | require_once( $xml_parser ); |
| 323 | 323 | } else { |
| 324 | 324 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser ); |
@@ -329,37 +329,37 @@ discard block |
||
| 329 | 329 | $xmlstr = file_get_contents( $form_file ); |
| 330 | 330 | |
| 331 | 331 | $options = array( |
| 332 | - "page" => array("unserialize_as_array" => true), |
|
| 333 | - "form"=> array("unserialize_as_array" => true), |
|
| 334 | - "field"=> array("unserialize_as_array" => true), |
|
| 335 | - "rule"=> array("unserialize_as_array" => true), |
|
| 336 | - "choice"=> array("unserialize_as_array" => true), |
|
| 337 | - "input"=> array("unserialize_as_array" => true), |
|
| 338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | - "routin"=> array("unserialize_as_array" => true), |
|
| 341 | - "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | - "notification" => array("unserialize_as_array" => true) |
|
| 332 | + "page" => array( "unserialize_as_array" => true ), |
|
| 333 | + "form"=> array( "unserialize_as_array" => true ), |
|
| 334 | + "field"=> array( "unserialize_as_array" => true ), |
|
| 335 | + "rule"=> array( "unserialize_as_array" => true ), |
|
| 336 | + "choice"=> array( "unserialize_as_array" => true ), |
|
| 337 | + "input"=> array( "unserialize_as_array" => true ), |
|
| 338 | + "routing_item"=> array( "unserialize_as_array" => true ), |
|
| 339 | + "creditCard"=> array( "unserialize_as_array" => true ), |
|
| 340 | + "routin"=> array( "unserialize_as_array" => true ), |
|
| 341 | + "confirmation" => array( "unserialize_as_array" => true ), |
|
| 342 | + "notification" => array( "unserialize_as_array" => true ) |
|
| 343 | 343 | ); |
| 344 | 344 | |
| 345 | - $xml = new RGXML($options); |
|
| 346 | - $forms = $xml->unserialize($xmlstr); |
|
| 345 | + $xml = new RGXML( $options ); |
|
| 346 | + $forms = $xml->unserialize( $xmlstr ); |
|
| 347 | 347 | |
| 348 | - if( !$forms ) { |
|
| 349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 348 | + if ( ! $forms ) { |
|
| 349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file ); |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | - $form = $forms[0]; |
|
| 353 | + if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) { |
|
| 354 | + $form = $forms[ 0 ]; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if( empty( $form ) ) { |
|
| 357 | + if ( empty( $form ) ) { |
|
| 358 | 358 | do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form ); |
|
| 363 | 363 | |
| 364 | 364 | return $form; |
| 365 | 365 | |
@@ -373,38 +373,38 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | function import_fields( $file ) { |
| 375 | 375 | |
| 376 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
| 376 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
| 377 | 377 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file ); |
| 378 | 378 | return false; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if( !class_exists('WXR_Parser') ) { |
|
| 381 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
| 382 | 382 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | $parser = new WXR_Parser(); |
| 386 | 386 | $presets = $parser->parse( $file ); |
| 387 | 387 | |
| 388 | - if(is_wp_error( $presets )) { |
|
| 388 | + if ( is_wp_error( $presets ) ) { |
|
| 389 | 389 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets ); |
| 390 | 390 | return false; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
| 393 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
| 394 | 394 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file ); |
| 395 | 395 | return false; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] ); |
|
| 398 | + do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] ); |
|
| 399 | 399 | |
| 400 | 400 | $fields = $widgets = array(); |
| 401 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
| 402 | - switch ($meta['key']) { |
|
| 401 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
| 402 | + switch ( $meta[ 'key' ] ) { |
|
| 403 | 403 | case '_gravityview_directory_fields': |
| 404 | - $fields = maybe_unserialize( $meta['value'] ); |
|
| 404 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
| 405 | 405 | break; |
| 406 | 406 | case '_gravityview_directory_widgets': |
| 407 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
| 407 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | $this->context_view_id = $_GET['gvid']; |
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // User reported WooCommerce doesn't pass two args. |
| 375 | - if ( empty( $passed_post_id ) ) { |
|
| 375 | + if ( empty( $passed_post_id ) ) { |
|
| 376 | 376 | return $title; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | */ |
| 1109 | 1109 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1110 | 1110 | |
| 1111 | - switch( strtolower( $address_part ) ){ |
|
| 1111 | + switch( strtolower( $address_part ) ) { |
|
| 1112 | 1112 | case 'street': |
| 1113 | 1113 | $sort_field_id .= '.1'; |
| 1114 | 1114 | break; |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1190 | 1190 | |
| 1191 | - if ( empty( $single_entry ) ){ |
|
| 1191 | + if ( empty( $single_entry ) ) { |
|
| 1192 | 1192 | return false; |
| 1193 | 1193 | } else { |
| 1194 | 1194 | return $single_entry; |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; |
| 235 | 235 | |
| 236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | 237 | /** |
| 238 | 238 | * used on a has_multiple_views context |
| 239 | 239 | * @see GravityView_API::entry_link |
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 241 | 241 | */ |
| 242 | - $this->context_view_id = $_GET['gvid']; |
|
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 285 | 285 | $this->setPostId( $post_id ); |
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 319 | 319 | |
| 320 | - if( 'post' === $search_method ) { |
|
| 320 | + if ( 'post' === $search_method ) { |
|
| 321 | 321 | $get = $_POST; |
| 322 | 322 | } else { |
| 323 | 323 | $get = $_GET; |
@@ -373,20 +373,20 @@ discard block |
||
| 373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 374 | 374 | * @param array $entry Current entry |
| 375 | 375 | */ |
| 376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 377 | 377 | |
| 378 | 378 | if ( ! $apply_outside_loop ) { |
| 379 | 379 | return $title; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // User reported WooCommerce doesn't pass two args. |
| 383 | - if ( empty( $passed_post_id ) ) { |
|
| 383 | + if ( empty( $passed_post_id ) ) { |
|
| 384 | 384 | return $title; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Don't modify the title for anything other than the current view/post. |
| 388 | 388 | // This is true for embedded shortcodes and Views. |
| 389 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 389 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 390 | 390 | return $title; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -396,19 +396,19 @@ discard block |
||
| 396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 397 | 397 | } else { |
| 398 | 398 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 399 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 399 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 400 | 400 | $view_meta = $view_data; |
| 401 | 401 | break; |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 406 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 407 | 407 | |
| 408 | - $title = $view_meta['atts']['single_title']; |
|
| 408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 409 | 409 | |
| 410 | 410 | // We are allowing HTML in the fields, so no escaping the output |
| 411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 412 | 412 | |
| 413 | 413 | $title = do_shortcode( $title ); |
| 414 | 414 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | public function render_view( $passed_args ) { |
| 510 | 510 | |
| 511 | 511 | // validate attributes |
| 512 | - if ( empty( $passed_args['id'] ) ) { |
|
| 512 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 514 | 514 | return null; |
| 515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | return null; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - $view_id = $passed_args['id']; |
|
| 534 | + $view_id = $passed_args[ 'id' ]; |
|
| 535 | 535 | |
| 536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 545 | 545 | |
| 546 | 546 | //Override shortcode args over View template settings |
| 547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 548 | 548 | |
| 549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 550 | 550 | |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | * Don't render View if user isn't allowed to see it |
| 567 | 567 | * @since 1.15 |
| 568 | 568 | */ |
| 569 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 569 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 570 | 570 | return null; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if( $this->isGravityviewPostType() ) { |
|
| 573 | + if ( $this->isGravityviewPostType() ) { |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | */ |
| 583 | 583 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 584 | 584 | |
| 585 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 585 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 586 | 586 | |
| 587 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 587 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 588 | 588 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 589 | 589 | } |
| 590 | 590 | } |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | $gravityview_view = new GravityView_View( $view_data ); |
| 601 | 601 | |
| 602 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 602 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 603 | 603 | |
| 604 | 604 | $gravityview_view->setPostId( $post_id ); |
| 605 | 605 | |
@@ -609,20 +609,20 @@ discard block |
||
| 609 | 609 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 610 | 610 | |
| 611 | 611 | //fetch template and slug |
| 612 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 612 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 613 | 613 | |
| 614 | 614 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 618 | 618 | */ |
| 619 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 619 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | 622 | * Hide View data until search is performed |
| 623 | 623 | * @since 1.5.4 |
| 624 | 624 | */ |
| 625 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 625 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 626 | 626 | $gravityview_view->setHideUntilSearched( true ); |
| 627 | 627 | $get_entries = false; |
| 628 | 628 | } |
@@ -630,23 +630,23 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | if ( $get_entries ) { |
| 632 | 632 | |
| 633 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 633 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 634 | 634 | // add filter to enable column sorting |
| 635 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 635 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 638 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 639 | 639 | |
| 640 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 640 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 641 | 641 | |
| 642 | 642 | } else { |
| 643 | 643 | |
| 644 | 644 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 645 | 645 | |
| 646 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 646 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 649 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 650 | 650 | $gravityview_view->setContext( 'directory' ); |
| 651 | 651 | $sections = array( 'header', 'body', 'footer' ); |
| 652 | 652 | |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | // user requested Single Entry View |
| 656 | 656 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
| 657 | 657 | |
| 658 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 658 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 659 | 659 | |
| 660 | 660 | $entry = $this->getEntry(); |
| 661 | 661 | |
@@ -682,20 +682,20 @@ discard block |
||
| 682 | 682 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 683 | 683 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 684 | 684 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 685 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
| 685 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
| 686 | 686 | return null; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | //fetch template and slug |
| 690 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 690 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 691 | 691 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 692 | 692 | |
| 693 | 693 | //fetch entry detail |
| 694 | - $view_entries['count'] = 1; |
|
| 695 | - $view_entries['entries'][] = $entry; |
|
| 696 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 694 | + $view_entries[ 'count' ] = 1; |
|
| 695 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 696 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 697 | 697 | |
| 698 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 698 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 699 | 699 | |
| 700 | 700 | // set back link label |
| 701 | 701 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -705,11 +705,11 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // add template style |
| 708 | - self::add_style( $view_data['template_id'] ); |
|
| 708 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 709 | 709 | |
| 710 | 710 | // Prepare to render view and set vars |
| 711 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 712 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 711 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 712 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 713 | 713 | |
| 714 | 714 | // If Edit |
| 715 | 715 | if ( 'edit' === gravityview_get_context() ) { |
@@ -722,11 +722,11 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | } else { |
| 724 | 724 | // finaly we'll render some html |
| 725 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 725 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 726 | 726 | |
| 727 | 727 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 728 | 728 | foreach ( $sections as $section ) { |
| 729 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 729 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 730 | 730 | $gravityview_view->render( $view_slug, $section, false ); |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $datetime_format = 'Y-m-d H:i:s'; |
| 781 | 781 | $search_is_outside_view_bounds = false; |
| 782 | 782 | |
| 783 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 783 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 784 | 784 | |
| 785 | 785 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 786 | 786 | |
@@ -808,14 +808,14 @@ discard block |
||
| 808 | 808 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 809 | 809 | |
| 810 | 810 | // Then we override the search and re-set the start date |
| 811 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 811 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 816 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 817 | 817 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 818 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 818 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 819 | 819 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 820 | 820 | } |
| 821 | 821 | } |
@@ -833,9 +833,9 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 835 | 835 | |
| 836 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 837 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 836 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 837 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 839 | 839 | |
| 840 | 840 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 841 | 841 | } |
@@ -859,12 +859,12 @@ discard block |
||
| 859 | 859 | */ |
| 860 | 860 | public static function is_entry_approved( $entry, $args = array() ) { |
| 861 | 861 | |
| 862 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 862 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 863 | 863 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 864 | 864 | return true; |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 867 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 868 | 868 | |
| 869 | 869 | if ( $is_approved ) { |
| 870 | 870 | return true; |
@@ -897,26 +897,26 @@ discard block |
||
| 897 | 897 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 898 | 898 | |
| 899 | 899 | // implicity search |
| 900 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 900 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 901 | 901 | |
| 902 | 902 | // Search operator options. Options: `is` or `contains` |
| 903 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 903 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 904 | 904 | |
| 905 | - $search_criteria['field_filters'][] = array( |
|
| 905 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 906 | 906 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 907 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 907 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 908 | 908 | 'operator' => $operator, |
| 909 | 909 | ); |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 912 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 913 | 913 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // Handle setting date range |
| 917 | 917 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 918 | 918 | |
| 919 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 919 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 920 | 920 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 921 | 921 | } |
| 922 | 922 | |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 928 | 928 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 929 | 929 | */ |
| 930 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 930 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 931 | 931 | |
| 932 | 932 | return $search_criteria; |
| 933 | 933 | } |
@@ -973,16 +973,16 @@ discard block |
||
| 973 | 973 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 974 | 974 | |
| 975 | 975 | // Paging & offset |
| 976 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 976 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 977 | 977 | |
| 978 | 978 | if ( -1 === $page_size ) { |
| 979 | 979 | $page_size = PHP_INT_MAX; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - if ( isset( $args['offset'] ) ) { |
|
| 983 | - $offset = intval( $args['offset'] ); |
|
| 982 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 983 | + $offset = intval( $args[ 'offset' ] ); |
|
| 984 | 984 | } else { |
| 985 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 985 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 986 | 986 | $offset = ( $curr_page - 1 ) * $page_size; |
| 987 | 987 | } |
| 988 | 988 | |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | 'search_criteria' => $search_criteria, |
| 1001 | 1001 | 'sorting' => $sorting, |
| 1002 | 1002 | 'paging' => $paging, |
| 1003 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1003 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1004 | 1004 | ); |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1026 | 1026 | * @param array $args View configuration args. |
| 1027 | 1027 | */ |
| 1028 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1028 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1029 | 1029 | |
| 1030 | 1030 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1031 | 1031 | |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | */ |
| 1066 | 1066 | public static function updateViewSorting( $args, $form_id ) { |
| 1067 | 1067 | $sorting = array(); |
| 1068 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1069 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1068 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1069 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1072 | 1072 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1108 | 1108 | |
| 1109 | - switch ( $sort_field['type'] ) { |
|
| 1109 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1110 | 1110 | |
| 1111 | 1111 | case 'address': |
| 1112 | 1112 | // Sorting by full address |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | */ |
| 1124 | 1124 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1125 | 1125 | |
| 1126 | - switch( strtolower( $address_part ) ){ |
|
| 1126 | + switch ( strtolower( $address_part ) ) { |
|
| 1127 | 1127 | case 'street': |
| 1128 | 1128 | $sort_field_id .= '.1'; |
| 1129 | 1129 | break; |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | */ |
| 1204 | 1204 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1205 | 1205 | |
| 1206 | - if ( empty( $single_entry ) ){ |
|
| 1206 | + if ( empty( $single_entry ) ) { |
|
| 1207 | 1207 | return false; |
| 1208 | 1208 | } else { |
| 1209 | 1209 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1231 | 1231 | * @since 1.15 |
| 1232 | 1232 | */ |
| 1233 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1233 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1234 | 1234 | continue; |
| 1235 | 1235 | } |
| 1236 | 1236 | |
@@ -1239,19 +1239,19 @@ discard block |
||
| 1239 | 1239 | $css_dependencies = array(); |
| 1240 | 1240 | |
| 1241 | 1241 | // If the thickbox is enqueued, add dependencies |
| 1242 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1242 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1243 | 1243 | |
| 1244 | 1244 | /** |
| 1245 | 1245 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1246 | 1246 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1247 | 1247 | */ |
| 1248 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1248 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1249 | 1249 | |
| 1250 | 1250 | /** |
| 1251 | 1251 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1252 | 1252 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1253 | 1253 | */ |
| 1254 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1254 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | /** |
@@ -1259,25 +1259,25 @@ discard block |
||
| 1259 | 1259 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1260 | 1260 | * @since 1.15 |
| 1261 | 1261 | */ |
| 1262 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1263 | - $css_dependencies[] = 'dashicons'; |
|
| 1262 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1263 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1267 | 1267 | |
| 1268 | 1268 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1269 | 1269 | |
| 1270 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1270 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1271 | 1271 | |
| 1272 | 1272 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1273 | 1273 | |
| 1274 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1274 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1275 | 1275 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1279 | 1279 | |
| 1280 | - self::add_style( $data['template_id'] ); |
|
| 1280 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1281 | 1281 | |
| 1282 | 1282 | } |
| 1283 | 1283 | |
@@ -1313,7 +1313,7 @@ discard block |
||
| 1313 | 1313 | } elseif ( empty( $template_id ) ) { |
| 1314 | 1314 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1315 | 1315 | } else { |
| 1316 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1316 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | } |
@@ -1338,11 +1338,11 @@ discard block |
||
| 1338 | 1338 | * Not a table-based template; don't add sort icons |
| 1339 | 1339 | * @since 1.12 |
| 1340 | 1340 | */ |
| 1341 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1341 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1342 | 1342 | return $label; |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1345 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1346 | 1346 | return $label; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
@@ -1350,29 +1350,29 @@ discard block |
||
| 1350 | 1350 | |
| 1351 | 1351 | $class = 'gv-sort'; |
| 1352 | 1352 | |
| 1353 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1353 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1354 | 1354 | |
| 1355 | 1355 | $sort_args = array( |
| 1356 | - 'sort' => $field['id'], |
|
| 1356 | + 'sort' => $field[ 'id' ], |
|
| 1357 | 1357 | 'dir' => 'asc', |
| 1358 | 1358 | ); |
| 1359 | 1359 | |
| 1360 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1360 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1361 | 1361 | //toggle sorting direction. |
| 1362 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1363 | - $sort_args['dir'] = 'desc'; |
|
| 1362 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1363 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1364 | 1364 | $class .= ' gv-icon-sort-desc'; |
| 1365 | 1365 | } else { |
| 1366 | - $sort_args['dir'] = 'asc'; |
|
| 1366 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1367 | 1367 | $class .= ' gv-icon-sort-asc'; |
| 1368 | 1368 | } |
| 1369 | 1369 | } else { |
| 1370 | 1370 | $class .= ' gv-icon-caret-up-down'; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1373 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1374 | 1374 | |
| 1375 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1375 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1376 | 1376 | |
| 1377 | 1377 | } |
| 1378 | 1378 | |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | |
| 1391 | 1391 | $field_type = $field_id; |
| 1392 | 1392 | |
| 1393 | - if( is_numeric( $field_id ) ) { |
|
| 1393 | + if ( is_numeric( $field_id ) ) { |
|
| 1394 | 1394 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1395 | 1395 | $field_type = $field->type; |
| 1396 | 1396 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | return false; |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1416 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1417 | 1417 | |
| 1418 | 1418 | } |
| 1419 | 1419 | |
@@ -295,7 +295,8 @@ discard block |
||
| 295 | 295 | if ( empty( $license_data ) ) { |
| 296 | 296 | if ( $is_ajax ) { |
| 297 | 297 | exit( json_encode( array() ) ); |
| 298 | - } else { // Non-ajax call |
|
| 298 | + } else { |
|
| 299 | +// Non-ajax call |
|
| 299 | 300 | return json_encode( array() ); |
| 300 | 301 | } |
| 301 | 302 | } |
@@ -325,7 +326,8 @@ discard block |
||
| 325 | 326 | |
| 326 | 327 | if ( $is_ajax ) { |
| 327 | 328 | exit( $json ); |
| 328 | - } else { // Non-ajax call |
|
| 329 | + } else { |
|
| 330 | +// Non-ajax call |
|
| 329 | 331 | return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
| 330 | 332 | } |
| 331 | 333 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @return GV_License_Handler |
| 41 | 41 | */ |
| 42 | 42 | public static function get_instance( GravityView_Settings $GFAddOn ) { |
| 43 | - if( empty( self::$instance ) ) { |
|
| 43 | + if ( empty( self::$instance ) ) { |
|
| 44 | 44 | self::$instance = new self( $GFAddOn ); |
| 45 | 45 | } |
| 46 | 46 | return self::$instance; |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | public function refresh_license_status() { |
| 71 | 71 | |
| 72 | 72 | // Only perform on GravityView pages |
| 73 | - if( ! gravityview_is_admin_page() ) { |
|
| 73 | + if ( ! gravityview_is_admin_page() ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // The transient is fresh; don't fetch. |
| 78 | - if( $status = get_transient( self::status_transient_key ) ) { |
|
| 78 | + if ( $status = get_transient( self::status_transient_key ) ) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -100,37 +100,37 @@ discard block |
||
| 100 | 100 | $status = trim( $this->Addon->get_app_setting( 'license_key_status' ) ); |
| 101 | 101 | $key = trim( $this->Addon->get_app_setting( 'license_key' ) ); |
| 102 | 102 | |
| 103 | - if( !empty( $key ) ) { |
|
| 103 | + if ( ! empty( $key ) ) { |
|
| 104 | 104 | $response = $this->Addon->get_app_setting( 'license_key_response' ); |
| 105 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 105 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 106 | 106 | } else { |
| 107 | 107 | $response = array(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array( |
| 111 | 111 | 'license_box' => $this->get_license_message( $response ) |
| 112 | - )); |
|
| 112 | + ) ); |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | $fields = array( |
| 116 | 116 | array( |
| 117 | 117 | 'name' => 'edd-activate', |
| 118 | - 'value' => __('Activate License', 'gravityview'), |
|
| 119 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
| 118 | + 'value' => __( 'Activate License', 'gravityview' ), |
|
| 119 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
| 120 | 120 | 'data-edd_action' => 'activate_license', |
| 121 | 121 | 'class' => 'button-primary', |
| 122 | 122 | ), |
| 123 | 123 | array( |
| 124 | 124 | 'name' => 'edd-deactivate', |
| 125 | - 'value' => __('Deactivate License', 'gravityview'), |
|
| 126 | - 'data-pending_text' => __('Deactivating license…', 'gravityview'), |
|
| 125 | + 'value' => __( 'Deactivate License', 'gravityview' ), |
|
| 126 | + 'data-pending_text' => __( 'Deactivating license…', 'gravityview' ), |
|
| 127 | 127 | 'data-edd_action' => 'deactivate_license', |
| 128 | 128 | 'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ), |
| 129 | 129 | ), |
| 130 | 130 | array( |
| 131 | 131 | 'name' => 'edd-check', |
| 132 | - 'value' => __('Check License', 'gravityview'), |
|
| 133 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
| 132 | + 'value' => __( 'Check License', 'gravityview' ), |
|
| 133 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
| 134 | 134 | 'title' => 'Check the license before saving it', |
| 135 | 135 | 'data-edd_action' => 'check_license', |
| 136 | 136 | 'class' => 'button-secondary', |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $class = 'button gv-edd-action'; |
| 142 | 142 | |
| 143 | - $class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
| 143 | + $class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
| 144 | 144 | |
| 145 | 145 | $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
| 146 | 146 | |
| 147 | 147 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 148 | 148 | foreach ( $fields as $field ) { |
| 149 | - $field['type'] = 'button'; |
|
| 150 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 151 | - $field['style'] = 'margin-left: 10px;'; |
|
| 152 | - if( $disabled_attribute ) { |
|
| 153 | - $field['disabled'] = $disabled_attribute; |
|
| 149 | + $field[ 'type' ] = 'button'; |
|
| 150 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 151 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 152 | + if ( $disabled_attribute ) { |
|
| 153 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 154 | 154 | } |
| 155 | 155 | $submit .= $this->Addon->settings_submit( $field, $echo ); |
| 156 | 156 | } |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function setup_edd() { |
| 168 | 168 | |
| 169 | - if( !class_exists('EDD_SL_Plugin_Updater') ) { |
|
| 170 | - require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php'); |
|
| 169 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 170 | + require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // setup the updater |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | 'url' => home_url(), |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - if( !empty( $action ) ) { |
|
| 208 | - $settings['edd_action'] = esc_attr( $action ); |
|
| 207 | + if ( ! empty( $action ) ) { |
|
| 208 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $settings = array_map( 'urlencode', $settings ); |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | private function _license_get_remote_response( $data, $license = '' ) { |
| 221 | 221 | |
| 222 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 222 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 223 | 223 | |
| 224 | 224 | $url = add_query_arg( $api_params, self::url ); |
| 225 | 225 | |
| 226 | 226 | $response = wp_remote_get( $url, array( |
| 227 | 227 | 'timeout' => 15, |
| 228 | 228 | 'sslverify' => false, |
| 229 | - )); |
|
| 229 | + ) ); |
|
| 230 | 230 | |
| 231 | 231 | if ( is_wp_error( $response ) ) { |
| 232 | 232 | return array(); |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function get_license_message( $license_data ) { |
| 261 | 261 | |
| 262 | - if( empty( $license_data ) ) { |
|
| 262 | + if ( empty( $license_data ) ) { |
|
| 263 | 263 | $message = ''; |
| 264 | 264 | } else { |
| 265 | 265 | |
| 266 | - if( ! empty( $license_data->error ) ) { |
|
| 266 | + if ( ! empty( $license_data->error ) ) { |
|
| 267 | 267 | $class = 'error'; |
| 268 | 268 | $string_key = $license_data->error; |
| 269 | 269 | } else { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $string_key = $license_data->license; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) ); |
|
| 274 | + $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) ); |
|
| 275 | 275 | |
| 276 | 276 | $message = $this->generate_license_box( $message, $class ); |
| 277 | 277 | } |
@@ -308,15 +308,15 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function license_details( $response = array() ) { |
| 310 | 310 | |
| 311 | - $response = (array) $response; |
|
| 311 | + $response = (array)$response; |
|
| 312 | 312 | |
| 313 | 313 | $return = ''; |
| 314 | 314 | $return .= '<span class="gv-license-details" aria-live="polite" aria-busy="false">'; |
| 315 | 315 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
| 316 | 316 | |
| 317 | - if( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
| 318 | - $return .= $this->strings( $response['license'], $response ); |
|
| 319 | - } elseif( ! empty( $response['license_name'] ) ) { |
|
| 317 | + if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
| 318 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
| 319 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
| 320 | 320 | |
| 321 | 321 | $response_keys = array( |
| 322 | 322 | 'license_name' => '', |
@@ -331,19 +331,19 @@ discard block |
||
| 331 | 331 | // Make sure all the keys are set |
| 332 | 332 | $response = wp_parse_args( $response, $response_keys ); |
| 333 | 333 | |
| 334 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 335 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 334 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 335 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 336 | 336 | $details = array( |
| 337 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 338 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
| 339 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
| 340 | - 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 341 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 337 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 338 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
| 339 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
| 340 | + 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 341 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 345 | - unset( $details['upgrade'] ); |
|
| 346 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 344 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 345 | + unset( $details[ 'upgrade' ] ); |
|
| 346 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -367,11 +367,11 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $output = ''; |
| 369 | 369 | |
| 370 | - if( ! empty( $upgrades ) ) { |
|
| 370 | + if ( ! empty( $upgrades ) ) { |
|
| 371 | 371 | |
| 372 | 372 | $locale_parts = explode( '_', get_locale() ); |
| 373 | 373 | |
| 374 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 374 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 375 | 375 | |
| 376 | 376 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 377 | 377 | |
@@ -379,14 +379,14 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 381 | 381 | |
| 382 | - $upgrade = (object) $upgrade; |
|
| 382 | + $upgrade = (object)$upgrade; |
|
| 383 | 383 | |
| 384 | 384 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
| 385 | 385 | |
| 386 | - if( $is_english && isset( $upgrade->description ) ) { |
|
| 386 | + if ( $is_english && isset( $upgrade->description ) ) { |
|
| 387 | 387 | $message = esc_html( $upgrade->description ); |
| 388 | 388 | } else { |
| 389 | - switch( $upgrade->price_id ) { |
|
| 389 | + switch ( $upgrade->price_id ) { |
|
| 390 | 390 | // Interstellar |
| 391 | 391 | case 1: |
| 392 | 392 | default: |
@@ -424,16 +424,16 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function license_call( $array = array() ) { |
| 426 | 426 | |
| 427 | - $is_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); |
|
| 428 | - $data = empty( $array ) ? $_POST['data'] : $array; |
|
| 427 | + $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 428 | + $data = empty( $array ) ? $_POST[ 'data' ] : $array; |
|
| 429 | 429 | $has_cap = GVCommon::has_cap( 'gravityview_edit_settings' ); |
| 430 | 430 | |
| 431 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
| 432 | - die( - 1 ); |
|
| 431 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
| 432 | + die( -1 ); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // If the user isn't allowed to edit settings, show an error message |
| 436 | - if( ! $has_cap ) { |
|
| 436 | + if ( ! $has_cap ) { |
|
| 437 | 437 | $license_data = new stdClass(); |
| 438 | 438 | $license_data->error = 'capability'; |
| 439 | 439 | $license_data->message = $this->get_license_message( $license_data ); |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $json = json_encode( $license_data ); |
| 459 | 459 | |
| 460 | - $update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) ); |
|
| 460 | + $update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) ); |
|
| 461 | 461 | |
| 462 | - $is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 462 | + $is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 463 | 463 | |
| 464 | 464 | // Failed is the response from trying to de-activate a license and it didn't work. |
| 465 | 465 | // This likely happened because people entered in a different key and clicked "Deactivate", |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // most likely a mistake. |
| 468 | 468 | if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) { |
| 469 | 469 | |
| 470 | - if ( ! empty( $data['field_id'] ) ) { |
|
| 470 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
| 471 | 471 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
| 472 | 472 | } |
| 473 | 473 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | if ( $is_ajax ) { |
| 479 | 479 | exit( $json ); |
| 480 | 480 | } else { // Non-ajax call |
| 481 | - return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
|
| 481 | + return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json; |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
@@ -492,9 +492,9 @@ discard block |
||
| 492 | 492 | // Update option with passed data license |
| 493 | 493 | $settings = $this->Addon->get_app_settings(); |
| 494 | 494 | |
| 495 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 496 | - $settings['license_key_status'] = $license_data->license; |
|
| 497 | - $settings['license_key_response'] = (array)$license_data; |
|
| 495 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 496 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 497 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 498 | 498 | |
| 499 | 499 | $this->Addon->update_app_settings( $settings ); |
| 500 | 500 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | private function get_license_renewal_url( $license_data ) { |
| 509 | 509 | $license_data = is_array( $license_data ) ? (object)$license_data : $license_data; |
| 510 | - $renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
| 510 | + $renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
| 511 | 511 | return $renew_license_url; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -522,31 +522,31 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | |
| 524 | 524 | $strings = array( |
| 525 | - 'status' => esc_html__('Status', 'gravityview'), |
|
| 526 | - 'error' => esc_html__('There was an error processing the request.', 'gravityview'), |
|
| 527 | - 'failed' => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'), |
|
| 528 | - 'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
| 529 | - 'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
| 530 | - 'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
| 531 | - 'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'), |
|
| 532 | - 'valid' => esc_html__('The license key is valid and active.', 'gravityview'), |
|
| 533 | - 'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'), |
|
| 534 | - 'missing' => esc_html__('Invalid license key.', 'gravityview'), |
|
| 535 | - 'revoked' => esc_html__('This license key has been revoked.', 'gravityview'), |
|
| 536 | - 'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
| 525 | + 'status' => esc_html__( 'Status', 'gravityview' ), |
|
| 526 | + 'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ), |
|
| 527 | + 'failed' => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ), |
|
| 528 | + 'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
| 529 | + 'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
| 530 | + 'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
| 531 | + 'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ), |
|
| 532 | + 'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ), |
|
| 533 | + 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
|
| 534 | + 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
|
| 535 | + 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
|
| 536 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
| 537 | 537 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 538 | 538 | |
| 539 | - 'verifying_license' => esc_html__('Verifying license…', 'gravityview'), |
|
| 540 | - 'activate_license' => esc_html__('Activate License', 'gravityview'), |
|
| 541 | - 'deactivate_license' => esc_html__('Deactivate License', 'gravityview'), |
|
| 542 | - 'check_license' => esc_html__('Verify License', 'gravityview'), |
|
| 539 | + 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
|
| 540 | + 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
|
| 541 | + 'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ), |
|
| 542 | + 'check_license' => esc_html__( 'Verify License', 'gravityview' ), |
|
| 543 | 543 | ); |
| 544 | 544 | |
| 545 | - if( empty( $status ) ) { |
|
| 545 | + if ( empty( $status ) ) { |
|
| 546 | 546 | return $strings; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - if( isset( $strings[ $status ] ) ) { |
|
| 549 | + if ( isset( $strings[ $status ] ) ) { |
|
| 550 | 550 | return $strings[ $status ]; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | parent::add_hooks(); |
| 58 | 58 | |
| 59 | - if( gravityview_is_admin_page() ) { |
|
| 59 | + if ( gravityview_is_admin_page() ) { |
|
| 60 | 60 | |
| 61 | 61 | // Make Yoast metabox go down to the bottom please. |
| 62 | 62 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | global $pagenow; |
| 84 | 84 | |
| 85 | 85 | // New View page |
| 86 | - if( $pagenow === 'post-new.php' ) { |
|
| 87 | - $options['hideeditbox-gravityview'] = true; |
|
| 86 | + if ( $pagenow === 'post-new.php' ) { |
|
| 87 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $options; |