@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
| 267 | 267 | * @access public |
| 268 | - * @return void|boolean |
|
| 268 | + * @return false|null |
|
| 269 | 269 | */ |
| 270 | 270 | public function process_bulk_action() { |
| 271 | 271 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
| 363 | 363 | * @see GravityView_Entry_Approval::get_approved_column |
| 364 | 364 | * |
| 365 | - * @param mixed $form GF Form or Form ID |
|
| 365 | + * @param integer $form GF Form or Form ID |
|
| 366 | 366 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
| 367 | 367 | */ |
| 368 | 368 | static public function get_approved_column( $form ) { |
@@ -342,14 +342,14 @@ discard block |
||
| 342 | 342 | /** |
| 343 | 343 | * update_approved function. |
| 344 | 344 | * |
| 345 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 345 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 346 | 346 | * @see GravityView_Entry_Approval::update_approved |
| 347 | - * |
|
| 347 | + * |
|
| 348 | 348 | * @param int $entry_id (default: 0) |
| 349 | 349 | * @param int $approved (default: 0) |
| 350 | 350 | * @param int $form_id (default: 0) |
| 351 | 351 | * @param int $approvedcolumn (default: 0) |
| 352 | - * |
|
| 352 | + * |
|
| 353 | 353 | * @return boolean True: It worked; False: it failed |
| 354 | 354 | */ |
| 355 | 355 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * Calculate the approve field.input id |
| 361 | 361 | * |
| 362 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 363 | - * @see GravityView_Entry_Approval::get_approved_column |
|
| 364 | - * |
|
| 362 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 363 | + * @see GravityView_Entry_Approval::get_approved_column |
|
| 364 | + * |
|
| 365 | 365 | * @param mixed $form GF Form or Form ID |
| 366 | 366 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
| 367 | 367 | */ |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | /** |
| 491 | - * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 492 | - * |
|
| 493 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 494 | - * numeric, but it does group the approved entries together. |
|
| 495 | - * |
|
| 491 | + * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 492 | + * |
|
| 493 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 494 | + * numeric, but it does group the approved entries together. |
|
| 495 | + * |
|
| 496 | 496 | * @param int $form_id |
| 497 | 497 | * |
| 498 | 498 | * @return string Sorting link |
@@ -502,20 +502,20 @@ discard block |
||
| 502 | 502 | $approved_column_id = self::get_approved_column( $form_id ); |
| 503 | 503 | |
| 504 | 504 | if( ! $approved_column_id ) { |
| 505 | - return ''; |
|
| 506 | - } |
|
| 505 | + return ''; |
|
| 506 | + } |
|
| 507 | 507 | |
| 508 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 508 | + $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 509 | 509 | |
| 510 | - $args = array( |
|
| 511 | - 'orderby' => $approved_column_id, |
|
| 512 | - 'order' => $order, |
|
| 513 | - ); |
|
| 510 | + $args = array( |
|
| 511 | + 'orderby' => $approved_column_id, |
|
| 512 | + 'order' => $order, |
|
| 513 | + ); |
|
| 514 | 514 | |
| 515 | - $link = add_query_arg( $args ); |
|
| 515 | + $link = add_query_arg( $args ); |
|
| 516 | 516 | |
| 517 | 517 | return $link; |
| 518 | - } |
|
| 518 | + } |
|
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | 521 | * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** gf_entries page - entries table screen */ |
| 44 | 44 | |
| 45 | 45 | // capture bulk actions |
| 46 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
| 46 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
| 47 | 47 | |
| 48 | 48 | // add hidden field with approve status |
| 49 | 49 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 52 | 52 | |
| 53 | 53 | // adding styles and scripts |
| 54 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 54 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 55 | 55 | // bypass Gravity Forms no-conflict mode |
| 56 | 56 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 57 | 57 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
| 81 | 81 | * @param array $form GF Form object of current form |
| 82 | 82 | */ |
| 83 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 83 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 84 | 84 | return $filter_links; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | $approved_count = $disapproved_count = 0; |
| 102 | 102 | |
| 103 | 103 | // Only count if necessary |
| 104 | - if( $include_counts ) { |
|
| 105 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 106 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 104 | + if ( $include_counts ) { |
|
| 105 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 106 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $filter_links[] = array( |
|
| 109 | + $filter_links[ ] = array( |
|
| 110 | 110 | 'id' => 'gv_approved', |
| 111 | 111 | 'field_filters' => $field_filters_approved, |
| 112 | 112 | 'count' => $approved_count, |
| 113 | 113 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::Approved ), |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - $filter_links[] = array( |
|
| 116 | + $filter_links[ ] = array( |
|
| 117 | 117 | 'id' => 'gv_disapproved', |
| 118 | 118 | 'field_filters' => $field_filters_disapproved, |
| 119 | 119 | 'count' => $disapproved_count, |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function tooltips( $tooltips ) { |
| 134 | 134 | |
| 135 | - $tooltips['form_gravityview_fields'] = array( |
|
| 136 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 137 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 135 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 136 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 137 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | return $tooltips; |
@@ -245,15 +245,15 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $gv_bulk_action = false; |
| 247 | 247 | |
| 248 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 249 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
| 248 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 249 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
| 250 | 250 | } else { |
| 251 | 251 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
| 252 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
| 252 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
| 256 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
| 256 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
| 257 | 257 | $gv_bulk_action = $bulk_action; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | // gforms_entry_list is the nonce that confirms we're on the right page |
| 280 | 280 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 281 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
| 281 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 282 | 282 | |
| 283 | 283 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 284 | 284 | |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // All entries are set to be updated, not just the visible ones |
| 299 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 299 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 300 | 300 | |
| 301 | 301 | // Convert the current entry search into GF-formatted search criteria |
| 302 | 302 | $search = array( |
| 303 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 304 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 305 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 303 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 304 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 305 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } else { |
| 314 | 314 | |
| 315 | 315 | // Changed from 'lead' to 'entry' in 2.0 |
| 316 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
| 316 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
| 317 | 317 | |
| 318 | 318 | } |
| 319 | 319 | |
@@ -325,12 +325,12 @@ discard block |
||
| 325 | 325 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
| 326 | 326 | |
| 327 | 327 | switch ( $approved_status ) { |
| 328 | - case $this->bulk_action_prefixes['approve']: |
|
| 328 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
| 329 | 329 | GravityView_Entry_Approval::update_bulk( $entries, 1, $form_id ); |
| 330 | 330 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
| 331 | 331 | break; |
| 332 | 332 | |
| 333 | - case $this->bulk_action_prefixes['unapprove']: |
|
| 333 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
| 334 | 334 | GravityView_Entry_Approval::update_bulk( $entries, 0, $form_id ); |
| 335 | 335 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
| 336 | 336 | break; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @return boolean True: It worked; False: it failed |
| 354 | 354 | */ |
| 355 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 355 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 356 | 356 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
| 357 | 357 | } |
| 358 | 358 | |
@@ -382,18 +382,18 @@ discard block |
||
| 382 | 382 | * |
| 383 | 383 | * @return void |
| 384 | 384 | */ |
| 385 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 385 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 386 | 386 | |
| 387 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 387 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 388 | 388 | return; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if( empty( $entry['id'] ) ) { |
|
| 391 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 392 | 392 | return; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if( gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ) ) { |
|
| 396 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
| 395 | + if ( gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ) ) { |
|
| 396 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | private function get_form_id() { |
| 408 | 408 | |
| 409 | - $form_id = GFForms::get('id'); |
|
| 409 | + $form_id = GFForms::get( 'id' ); |
|
| 410 | 410 | |
| 411 | 411 | // If there are no forms identified, use the first form. That's how GF does it. |
| 412 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 412 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 413 | 413 | $form_id = $this->get_first_form_id(); |
| 414 | 414 | } |
| 415 | 415 | |
@@ -429,14 +429,14 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | $forms = RGFormsModel::get_forms( null, 'title' ); |
| 431 | 431 | |
| 432 | - if( ! isset( $forms[0] ) ) { |
|
| 432 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
| 433 | 433 | do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' ); |
| 434 | 434 | return 0; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $first_form = $forms[0]; |
|
| 437 | + $first_form = $forms[ 0 ]; |
|
| 438 | 438 | |
| 439 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
| 439 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
| 440 | 440 | |
| 441 | 441 | return intval( $form_id ); |
| 442 | 442 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | function add_scripts_and_styles( $hook ) { |
| 446 | 446 | |
| 447 | - if( ! class_exists( 'RGForms' ) ) { |
|
| 447 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 448 | 448 | |
| 449 | 449 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 450 | 450 | |
@@ -453,25 +453,25 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | // enqueue styles & scripts gf_entries |
| 455 | 455 | // But only if we're on the main Entries page, not on reports pages |
| 456 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
| 456 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
| 457 | 457 | return; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | $form_id = $this->get_form_id(); |
| 461 | 461 | |
| 462 | 462 | // Things are broken; no forms were found |
| 463 | - if( empty( $form_id ) ) { |
|
| 463 | + if ( empty( $form_id ) ) { |
|
| 464 | 464 | return; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 467 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 468 | 468 | |
| 469 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 469 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 470 | 470 | |
| 471 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 471 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 472 | 472 | |
| 473 | 473 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 474 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
| 474 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
| 475 | 475 | 'form_id' => $form_id, |
| 476 | 476 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 477 | 477 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | 'status_disapproved' => GravityView_Entry_Approval_Status::Disapproved, |
| 480 | 480 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 481 | 481 | 'bulk_message' => $this->bulk_update_message, |
| 482 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
| 483 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
| 484 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 482 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
| 483 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
| 484 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 485 | 485 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
| 486 | 486 | ) ); |
| 487 | 487 | |
@@ -501,11 +501,11 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | $approved_column_id = self::get_approved_column( $form_id ); |
| 503 | 503 | |
| 504 | - if( ! $approved_column_id ) { |
|
| 504 | + if ( ! $approved_column_id ) { |
|
| 505 | 505 | return ''; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 508 | + $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc'; |
|
| 509 | 509 | |
| 510 | 510 | $args = array( |
| 511 | 511 | 'orderby' => $approved_column_id, |
@@ -532,11 +532,11 @@ discard block |
||
| 532 | 532 | 'GravityView' => array( |
| 533 | 533 | array( |
| 534 | 534 | 'label' => __( 'Approve', 'gravityview' ), |
| 535 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
| 535 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
| 536 | 536 | ), |
| 537 | 537 | array( |
| 538 | 538 | 'label' => __( 'Disapprove', 'gravityview' ), |
| 539 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
| 539 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
| 540 | 540 | ), |
| 541 | 541 | ), |
| 542 | 542 | ); |
@@ -553,8 +553,8 @@ discard block |
||
| 553 | 553 | // Sanitize the values, just to be sure. |
| 554 | 554 | foreach ( $bulk_actions as $key => $group ) { |
| 555 | 555 | foreach ( $group as $i => $action ) { |
| 556 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 557 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 556 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 557 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
@@ -579,13 +579,13 @@ discard block |
||
| 579 | 579 | * @since 1.7.2 |
| 580 | 580 | * @param boolean $hide_if_no_connections |
| 581 | 581 | */ |
| 582 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 582 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 583 | 583 | |
| 584 | - if( $hide_if_no_connections ) { |
|
| 584 | + if ( $hide_if_no_connections ) { |
|
| 585 | 585 | |
| 586 | 586 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 587 | 587 | |
| 588 | - if( empty( $connected_views ) ) { |
|
| 588 | + if ( empty( $connected_views ) ) { |
|
| 589 | 589 | $show_approve_column = false; |
| 590 | 590 | } |
| 591 | 591 | } |
@@ -595,18 +595,18 @@ discard block |
||
| 595 | 595 | * @param boolean $show_approve_column Whether the column will be shown |
| 596 | 596 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 597 | 597 | */ |
| 598 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 598 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 599 | 599 | |
| 600 | 600 | return $show_approve_column; |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | function register_gform_noconflict_script( $scripts ) { |
| 604 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 604 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 605 | 605 | return $scripts; |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | function register_gform_noconflict_style( $styles ) { |
| 609 | - $styles[] = 'gravityview_entries_list'; |
|
| 609 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 610 | 610 | return $styles; |
| 611 | 611 | } |
| 612 | 612 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * Return array of fields' id and label, for a given Form ID |
| 210 | 210 | * |
| 211 | 211 | * @access public |
| 212 | - * @param string|array $form_id (default: '') or $form object |
|
| 212 | + * @param string|array $form (default: '') or $form object |
|
| 213 | 213 | * @param bool $add_default_properties |
| 214 | 214 | * @param bool $include_parent_field |
| 215 | 215 | * @return array |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * @param string $entry_id_or_slug The ID or slug of an entry. |
| 541 | 541 | * @param bool $force_allow_ids Whether to force allowing getting the ID of an entry, even if custom slugs are enabled |
| 542 | 542 | * |
| 543 | - * @return false|int|null Returns the ID of the entry found, if custom slugs is enabled. Returns original value if custom slugs is disabled. Returns false if not allowed to convert slug to ID. Returns NULL if entry not found for the passed slug. |
|
| 543 | + * @return integer|null Returns the ID of the entry found, if custom slugs is enabled. Returns original value if custom slugs is disabled. Returns false if not allowed to convert slug to ID. Returns NULL if entry not found for the passed slug. |
|
| 544 | 544 | */ |
| 545 | 545 | public static function get_entry_id( $entry_id_or_slug = '', $force_allow_ids = false ) { |
| 546 | 546 | |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | * |
| 873 | 873 | * @param array $form Gravity Forms form array |
| 874 | 874 | * @param string $field_id ID of the field. If an input, full input ID (like `1.3`) |
| 875 | - * @param string|array $field_value Raw value of the field. |
|
| 875 | + * @param string $field_value Raw value of the field. |
|
| 876 | 876 | * @return string |
| 877 | 877 | */ |
| 878 | 878 | public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) { |
@@ -1531,9 +1531,9 @@ discard block |
||
| 1531 | 1531 | * @param string $message Message body (required) |
| 1532 | 1532 | * @param string $from_name Displayed name of the sender |
| 1533 | 1533 | * @param string $message_format If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html". |
| 1534 | - * @param string|array $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
| 1534 | + * @param string $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
| 1535 | 1535 | * @param array|false $entry Gravity Forms entry array, related to the email. Default: false. |
| 1536 | - * @param array|false $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
| 1536 | + * @param boolean $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
| 1537 | 1537 | */ |
| 1538 | 1538 | public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) { |
| 1539 | 1539 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
| 176 | 176 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
| 177 | 177 | * @param int $form_id The Gravity Forms Form ID |
| 178 | - * @return boolean|void |
|
| 178 | + * @return false|null |
|
| 179 | 179 | */ |
| 180 | 180 | public static function update_bulk( $entries = array(), $approved, $form_id ) { |
| 181 | 181 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param int $entry_id ID of the Gravity Forms entry |
| 274 | 274 | * @param string $status String whether entry is approved or not. `0` for not approved, `Approved` for approved. |
| 275 | 275 | * @param int $form_id ID of the form of the entry being updated. Improves query performance. |
| 276 | - * @param string $approvedcolumn Gravity Forms Field ID |
|
| 276 | + * @param integer $approvedcolumn Gravity Forms Field ID |
|
| 277 | 277 | * |
| 278 | 278 | * @return true|WP_Error |
| 279 | 279 | */ |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * @access public |
| 377 | 377 | * @static |
| 378 | 378 | * @param mixed $form GF Form or Form ID |
| 379 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
| 379 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
| 380 | 380 | */ |
| 381 | 381 | static public function get_approved_column( $form ) { |
| 382 | 382 | |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | private function add_hooks() { |
| 40 | 40 | |
| 41 | 41 | // in case entry is edited (on admin or frontend) |
| 42 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 42 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 43 | 43 | |
| 44 | 44 | // when using the User opt-in field, check on entry submission |
| 45 | 45 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
| 46 | 46 | |
| 47 | 47 | // process ajax approve entry requests |
| 48 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
| 48 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function ajax_update_approved() { |
| 69 | 69 | |
| 70 | - $form_id = intval( rgpost('form_id') ); |
|
| 70 | + $form_id = intval( rgpost( 'form_id' ) ); |
|
| 71 | 71 | |
| 72 | - $entry_id = GVCommon::get_entry_id( rgpost('entry_slug') ); |
|
| 72 | + $entry_id = GVCommon::get_entry_id( rgpost( 'entry_slug' ) ); |
|
| 73 | 73 | |
| 74 | - $approval_status = rgpost('approved'); |
|
| 74 | + $approval_status = rgpost( 'approved' ); |
|
| 75 | 75 | |
| 76 | - $nonce = rgpost('nonce'); |
|
| 76 | + $nonce = rgpost( 'nonce' ); |
|
| 77 | 77 | |
| 78 | 78 | // Valid status |
| 79 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 79 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 80 | 80 | |
| 81 | 81 | do_action( 'gravityview_log_error', __METHOD__ . ': Invalid approval status', $_POST ); |
| 82 | 82 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 109 | 109 | |
| 110 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
| 110 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param $form array Gravity Forms form object |
| 137 | 137 | */ |
| 138 | 138 | public function after_submission( $entry, $form ) { |
| 139 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
| 139 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -150,18 +150,18 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 152 | 152 | |
| 153 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
| 153 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * If the form doesn't contain the approve field, don't assume anything. |
| 157 | 157 | */ |
| 158 | - if( empty( $approved_column ) ) { |
|
| 158 | + if ( empty( $approved_column ) ) { |
|
| 159 | 159 | return; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $entry = GFAPI::get_entry( $entry_id ); |
| 163 | 163 | |
| 164 | - self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form['id'] ); |
|
| 164 | + self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form[ 'id' ] ); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public static function update_bulk( $entries = array(), $approved, $form_id ) { |
| 181 | 181 | |
| 182 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
| 182 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
| 183 | 183 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 187 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 188 | 188 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 189 | 189 | return false; |
| 190 | 190 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // calculate approved field id once instead of looping through in the update_approved() method |
| 195 | 195 | $approved_column_id = self::get_approved_column( $form_id ); |
| 196 | 196 | |
| 197 | - foreach( $entries as $entry_id ) { |
|
| 197 | + foreach ( $entries as $entry_id ) { |
|
| 198 | 198 | self::update_approved( (int)$entry_id, $status, $form_id, $approved_column_id ); |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
| 217 | 217 | |
| 218 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 218 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 219 | 219 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 223 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 224 | 224 | do_action( 'gravityview_log_error', __METHOD__ . ': Not a valid approval value.' ); |
| 225 | 225 | return false; |
| 226 | 226 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // add note to entry if approval field updating worked or there was no approved field |
| 236 | 236 | // There's no validation for the meta |
| 237 | - if( true === $result ) { |
|
| 237 | + if ( true === $result ) { |
|
| 238 | 238 | |
| 239 | 239 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
| 247 | 247 | |
| 248 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 248 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 249 | 249 | $current_user = wp_get_current_user(); |
| 250 | 250 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
| 251 | 251 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | do_action( 'gravityview_clear_form_cache', $form_id ); |
| 259 | 259 | |
| 260 | - } else if( is_wp_error( $result ) ) { |
|
| 260 | + } else if ( is_wp_error( $result ) ) { |
|
| 261 | 261 | |
| 262 | 262 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 263 | 263 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
| 281 | 281 | |
| 282 | - if( empty( $approvedcolumn ) ) { |
|
| 282 | + if ( empty( $approvedcolumn ) ) { |
|
| 283 | 283 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | private static function update_approved_meta( $entry_id, $status, $form_id = 0 ) { |
| 319 | 319 | |
| 320 | 320 | if ( ! GravityView_Entry_Approval_Status::is_valid( $status ) ) { |
| 321 | - do_action('gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 321 | + do_action( 'gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 322 | 322 | return; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $approval_status = $is_approved ? GravityView_Entry_Approval_Status::Approved : GravityView_Entry_Approval_Status::Disapproved; |
| 332 | 332 | |
| 333 | 333 | // update entry meta |
| 334 | - if( function_exists('gform_update_meta') ) { |
|
| 334 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 335 | 335 | |
| 336 | 336 | gform_update_meta( $entry_id, self::meta_key, $approval_status, $form_id ); |
| 337 | 337 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | do_action( 'gravityview/approve_entries/updated', $entry_id, $approval_status ); |
| 345 | 345 | |
| 346 | - if( ! $is_approved ) { |
|
| 346 | + if ( ! $is_approved ) { |
|
| 347 | 347 | |
| 348 | 348 | /** |
| 349 | 349 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | } else { |
| 367 | 367 | |
| 368 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 368 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 369 | 369 | |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -380,29 +380,29 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | static public function get_approved_column( $form ) { |
| 382 | 382 | |
| 383 | - if( empty( $form ) ) { |
|
| 383 | + if ( empty( $form ) ) { |
|
| 384 | 384 | return null; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if( !is_array( $form ) ) { |
|
| 387 | + if ( ! is_array( $form ) ) { |
|
| 388 | 388 | $form = GVCommon::get_form( $form ); |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - foreach( $form['fields'] as $key => $field ) { |
|
| 391 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 392 | 392 | |
| 393 | - $field = (array) $field; |
|
| 393 | + $field = (array)$field; |
|
| 394 | 394 | |
| 395 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 396 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 397 | - return $field['inputs'][0]['id']; |
|
| 395 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 396 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 397 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 402 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 403 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 404 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 405 | - return $input['id']; |
|
| 402 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 403 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 404 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 405 | + return $input[ 'id' ]; |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | } |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
| 90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 91 | 91 | |
| 92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | $this->context_view_id = $view_id; |
| 236 | 236 | |
| 237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 238 | 238 | /** |
| 239 | 239 | * used on a has_multiple_views context |
| 240 | 240 | * @see GravityView_API::entry_link |
| 241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 242 | 242 | */ |
| 243 | - $this->context_view_id = $_GET['gvid']; |
|
| 243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 244 | 244 | |
| 245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
| 248 | 248 | unset( $array_keys ); |
@@ -277,24 +277,24 @@ discard block |
||
| 277 | 277 | global $wp_rewrite; |
| 278 | 278 | |
| 279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
| 280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
| 281 | - $front_page_id = get_option('page_on_front'); |
|
| 280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
| 281 | + $front_page_id = get_option( 'page_on_front' ); |
|
| 282 | 282 | |
| 283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 284 | 284 | |
| 285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
| 286 | 286 | $_query = wp_parse_args( $query->query ); |
| 287 | 287 | |
| 288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 290 | - unset( $_query['pagename'] ); |
|
| 289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 290 | + unset( $_query[ 'pagename' ] ); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // this is where will break from core wordpress |
| 294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
| 295 | 295 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
| 296 | - foreach ( (array) $endpoints as $endpoint ) { |
|
| 297 | - $ignore[] = $endpoint[1]; |
|
| 296 | + foreach ( (array)$endpoints as $endpoint ) { |
|
| 297 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 298 | 298 | } |
| 299 | 299 | unset( $endpoints ); |
| 300 | 300 | |
@@ -304,21 +304,21 @@ discard block |
||
| 304 | 304 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 305 | 305 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 306 | 306 | |
| 307 | - $qv =& $query->query_vars; |
|
| 307 | + $qv = & $query->query_vars; |
|
| 308 | 308 | |
| 309 | 309 | // Prevent redirect when on the single entry endpoint |
| 310 | - if( self::is_single_entry() ) { |
|
| 310 | + if ( self::is_single_entry() ) { |
|
| 311 | 311 | add_filter( 'redirect_canonical', '__return_false' ); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $query->is_page = true; |
| 315 | 315 | $query->is_home = false; |
| 316 | - $qv['page_id'] = $front_page_id; |
|
| 316 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 317 | 317 | |
| 318 | 318 | // Correct <!--nextpage--> for page_on_front |
| 319 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 320 | - $qv['page'] = $qv['paged']; |
|
| 321 | - unset( $qv['paged'] ); |
|
| 319 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 320 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 321 | + unset( $qv[ 'paged' ] ); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | global $post; |
| 337 | 337 | |
| 338 | 338 | // If in admin and NOT AJAX request, get outta here. |
| 339 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 339 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 340 | 340 | return; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 350 | 350 | |
| 351 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 351 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 352 | 352 | $this->setPostId( $post_id ); |
| 353 | 353 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 354 | 354 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 386 | 386 | |
| 387 | - if( 'post' === $search_method ) { |
|
| 387 | + if ( 'post' === $search_method ) { |
|
| 388 | 388 | $get = $_POST; |
| 389 | 389 | } else { |
| 390 | 390 | $get = $_GET; |
@@ -440,20 +440,20 @@ discard block |
||
| 440 | 440 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 441 | 441 | * @param array $entry Current entry |
| 442 | 442 | */ |
| 443 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 443 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 444 | 444 | |
| 445 | 445 | if ( ! $apply_outside_loop ) { |
| 446 | 446 | return $title; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | // User reported WooCommerce doesn't pass two args. |
| 450 | - if ( empty( $passed_post_id ) ) { |
|
| 450 | + if ( empty( $passed_post_id ) ) { |
|
| 451 | 451 | return $title; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // Don't modify the title for anything other than the current view/post. |
| 455 | 455 | // This is true for embedded shortcodes and Views. |
| 456 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 456 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 457 | 457 | return $title; |
| 458 | 458 | } |
| 459 | 459 | |
@@ -463,19 +463,19 @@ discard block |
||
| 463 | 463 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 464 | 464 | } else { |
| 465 | 465 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 466 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 466 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 467 | 467 | $view_meta = $view_data; |
| 468 | 468 | break; |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 473 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 474 | 474 | |
| 475 | - $title = $view_meta['atts']['single_title']; |
|
| 475 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 476 | 476 | |
| 477 | 477 | // We are allowing HTML in the fields, so no escaping the output |
| 478 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 478 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 479 | 479 | |
| 480 | 480 | $title = do_shortcode( $title ); |
| 481 | 481 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | public function render_view( $passed_args ) { |
| 577 | 577 | |
| 578 | 578 | // validate attributes |
| 579 | - if ( empty( $passed_args['id'] ) ) { |
|
| 579 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 580 | 580 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 581 | 581 | return null; |
| 582 | 582 | } |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | return null; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - $view_id = $passed_args['id']; |
|
| 601 | + $view_id = $passed_args[ 'id' ]; |
|
| 602 | 602 | |
| 603 | 603 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 604 | 604 | |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 612 | 612 | |
| 613 | 613 | //Override shortcode args over View template settings |
| 614 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 614 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 615 | 615 | |
| 616 | 616 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 617 | 617 | |
@@ -634,14 +634,14 @@ discard block |
||
| 634 | 634 | * @since 1.15 |
| 635 | 635 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
| 636 | 636 | */ |
| 637 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 637 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 638 | 638 | |
| 639 | 639 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
| 640 | 640 | |
| 641 | 641 | return null; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if( $this->isGravityviewPostType() ) { |
|
| 644 | + if ( $this->isGravityviewPostType() ) { |
|
| 645 | 645 | |
| 646 | 646 | /** |
| 647 | 647 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | */ |
| 654 | 654 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 655 | 655 | |
| 656 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 656 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 657 | 657 | |
| 658 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 658 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 659 | 659 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 660 | 660 | } |
| 661 | 661 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | $gravityview_view = new GravityView_View( $view_data ); |
| 672 | 672 | |
| 673 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 673 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 674 | 674 | |
| 675 | 675 | $gravityview_view->setPostId( $post_id ); |
| 676 | 676 | |
@@ -680,20 +680,20 @@ discard block |
||
| 680 | 680 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 681 | 681 | |
| 682 | 682 | //fetch template and slug |
| 683 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 683 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 684 | 684 | |
| 685 | 685 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 686 | 686 | |
| 687 | 687 | /** |
| 688 | 688 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 689 | 689 | */ |
| 690 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 690 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 691 | 691 | |
| 692 | 692 | /** |
| 693 | 693 | * Hide View data until search is performed |
| 694 | 694 | * @since 1.5.4 |
| 695 | 695 | */ |
| 696 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 696 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 697 | 697 | $gravityview_view->setHideUntilSearched( true ); |
| 698 | 698 | $get_entries = false; |
| 699 | 699 | } |
@@ -701,23 +701,23 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | if ( $get_entries ) { |
| 703 | 703 | |
| 704 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 704 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 705 | 705 | // add filter to enable column sorting |
| 706 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 706 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 709 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 710 | 710 | |
| 711 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 711 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 712 | 712 | |
| 713 | 713 | } else { |
| 714 | 714 | |
| 715 | 715 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 716 | 716 | |
| 717 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 717 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 720 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 721 | 721 | $gravityview_view->setContext( 'directory' ); |
| 722 | 722 | $sections = array( 'header', 'body', 'footer' ); |
| 723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
| 732 | 732 | * @since 1.17 |
| 733 | 733 | */ |
| 734 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 734 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 735 | 735 | |
| 736 | 736 | $entry = $this->getEntry(); |
| 737 | 737 | |
@@ -758,20 +758,20 @@ discard block |
||
| 758 | 758 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 759 | 759 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 760 | 760 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 761 | - 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 ); |
|
| 761 | + 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 ); |
|
| 762 | 762 | return null; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | //fetch template and slug |
| 766 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 766 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 767 | 767 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 768 | 768 | |
| 769 | 769 | //fetch entry detail |
| 770 | - $view_entries['count'] = 1; |
|
| 771 | - $view_entries['entries'][] = $entry; |
|
| 772 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 770 | + $view_entries[ 'count' ] = 1; |
|
| 771 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 772 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 773 | 773 | |
| 774 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 774 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 775 | 775 | |
| 776 | 776 | // set back link label |
| 777 | 777 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -781,11 +781,11 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | // add template style |
| 784 | - self::add_style( $view_data['template_id'] ); |
|
| 784 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 785 | 785 | |
| 786 | 786 | // Prepare to render view and set vars |
| 787 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 788 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 787 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 788 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 789 | 789 | |
| 790 | 790 | // If Edit |
| 791 | 791 | if ( 'edit' === gravityview_get_context() ) { |
@@ -798,11 +798,11 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | } else { |
| 800 | 800 | // finaly we'll render some html |
| 801 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 801 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 802 | 802 | |
| 803 | 803 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 804 | 804 | foreach ( $sections as $section ) { |
| 805 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 805 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 806 | 806 | $gravityview_view->render( $view_slug, $section, false ); |
| 807 | 807 | } |
| 808 | 808 | } |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | $datetime_format = 'Y-m-d H:i:s'; |
| 857 | 857 | $search_is_outside_view_bounds = false; |
| 858 | 858 | |
| 859 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 859 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 860 | 860 | |
| 861 | 861 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 862 | 862 | |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 885 | 885 | |
| 886 | 886 | // Then we override the search and re-set the start date |
| 887 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 887 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 888 | 888 | } |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 892 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 893 | 893 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 894 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 894 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 895 | 895 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 896 | 896 | } |
| 897 | 897 | } |
@@ -909,14 +909,14 @@ discard block |
||
| 909 | 909 | */ |
| 910 | 910 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 911 | 911 | |
| 912 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 912 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 913 | 913 | |
| 914 | - $search_criteria['field_filters'][] = array( |
|
| 914 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 915 | 915 | 'key' => GravityView_Entry_Approval::meta_key, |
| 916 | 916 | 'value' => GravityView_Entry_Approval_Status::Approved |
| 917 | 917 | ); |
| 918 | 918 | |
| 919 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 919 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 920 | 920 | |
| 921 | 921 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 922 | 922 | } |
@@ -943,12 +943,12 @@ discard block |
||
| 943 | 943 | */ |
| 944 | 944 | public static function is_entry_approved( $entry, $args = array() ) { |
| 945 | 945 | |
| 946 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 946 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 947 | 947 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 948 | 948 | return true; |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
| 951 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
| 952 | 952 | |
| 953 | 953 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
| 954 | 954 | } |
@@ -982,26 +982,26 @@ discard block |
||
| 982 | 982 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 983 | 983 | |
| 984 | 984 | // implicity search |
| 985 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 985 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 986 | 986 | |
| 987 | 987 | // Search operator options. Options: `is` or `contains` |
| 988 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 988 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 989 | 989 | |
| 990 | - $search_criteria['field_filters'][] = array( |
|
| 990 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 991 | 991 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 992 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 992 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 993 | 993 | 'operator' => $operator, |
| 994 | 994 | ); |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 997 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 998 | 998 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | 1001 | // Handle setting date range |
| 1002 | 1002 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 1003 | 1003 | |
| 1004 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 1004 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 1005 | 1005 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 1006 | 1006 | } |
| 1007 | 1007 | |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 1013 | 1013 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 1014 | 1014 | */ |
| 1015 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1015 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1016 | 1016 | |
| 1017 | 1017 | return $search_criteria; |
| 1018 | 1018 | } |
@@ -1058,16 +1058,16 @@ discard block |
||
| 1058 | 1058 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 1059 | 1059 | |
| 1060 | 1060 | // Paging & offset |
| 1061 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1061 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1062 | 1062 | |
| 1063 | 1063 | if ( -1 === $page_size ) { |
| 1064 | 1064 | $page_size = PHP_INT_MAX; |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | - if ( isset( $args['offset'] ) ) { |
|
| 1068 | - $offset = intval( $args['offset'] ); |
|
| 1067 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 1068 | + $offset = intval( $args[ 'offset' ] ); |
|
| 1069 | 1069 | } else { |
| 1070 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1070 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1071 | 1071 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1072 | 1072 | } |
| 1073 | 1073 | |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | 'search_criteria' => $search_criteria, |
| 1086 | 1086 | 'sorting' => $sorting, |
| 1087 | 1087 | 'paging' => $paging, |
| 1088 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1088 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1089 | 1089 | ); |
| 1090 | 1090 | |
| 1091 | 1091 | /** |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1111 | 1111 | * @param array $args View configuration args. |
| 1112 | 1112 | */ |
| 1113 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1113 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1114 | 1114 | |
| 1115 | 1115 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1116 | 1116 | |
@@ -1150,8 +1150,8 @@ discard block |
||
| 1150 | 1150 | */ |
| 1151 | 1151 | public static function updateViewSorting( $args, $form_id ) { |
| 1152 | 1152 | $sorting = array(); |
| 1153 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1154 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1153 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1154 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1155 | 1155 | |
| 1156 | 1156 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1157 | 1157 | |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | |
| 1192 | 1192 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1193 | 1193 | |
| 1194 | - switch ( $sort_field['type'] ) { |
|
| 1194 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1195 | 1195 | |
| 1196 | 1196 | case 'address': |
| 1197 | 1197 | // Sorting by full address |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | */ |
| 1209 | 1209 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1210 | 1210 | |
| 1211 | - switch( strtolower( $address_part ) ){ |
|
| 1211 | + switch ( strtolower( $address_part ) ) { |
|
| 1212 | 1212 | case 'street': |
| 1213 | 1213 | $sort_field_id .= '.1'; |
| 1214 | 1214 | break; |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | */ |
| 1289 | 1289 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1290 | 1290 | |
| 1291 | - if ( empty( $single_entry ) ){ |
|
| 1291 | + if ( empty( $single_entry ) ) { |
|
| 1292 | 1292 | return false; |
| 1293 | 1293 | } else { |
| 1294 | 1294 | return $single_entry; |
@@ -1315,7 +1315,7 @@ discard block |
||
| 1315 | 1315 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1316 | 1316 | * @since 1.15 |
| 1317 | 1317 | */ |
| 1318 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1318 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1319 | 1319 | continue; |
| 1320 | 1320 | } |
| 1321 | 1321 | |
@@ -1324,19 +1324,19 @@ discard block |
||
| 1324 | 1324 | $css_dependencies = array(); |
| 1325 | 1325 | |
| 1326 | 1326 | // If the thickbox is enqueued, add dependencies |
| 1327 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1327 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1328 | 1328 | |
| 1329 | 1329 | /** |
| 1330 | 1330 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1331 | 1331 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1332 | 1332 | */ |
| 1333 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1333 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1334 | 1334 | |
| 1335 | 1335 | /** |
| 1336 | 1336 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1337 | 1337 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1338 | 1338 | */ |
| 1339 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1339 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | /** |
@@ -1344,25 +1344,25 @@ discard block |
||
| 1344 | 1344 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1345 | 1345 | * @since 1.15 |
| 1346 | 1346 | */ |
| 1347 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1348 | - $css_dependencies[] = 'dashicons'; |
|
| 1347 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1348 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1352 | 1352 | |
| 1353 | 1353 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1354 | 1354 | |
| 1355 | - 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 ); |
|
| 1355 | + 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 ); |
|
| 1356 | 1356 | |
| 1357 | 1357 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1358 | 1358 | |
| 1359 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1359 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1360 | 1360 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1361 | 1361 | } |
| 1362 | 1362 | |
| 1363 | 1363 | $this->enqueue_default_style( $css_dependencies ); |
| 1364 | 1364 | |
| 1365 | - self::add_style( $data['template_id'] ); |
|
| 1365 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | } elseif ( empty( $template_id ) ) { |
| 1425 | 1425 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1426 | 1426 | } else { |
| 1427 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1427 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | } |
@@ -1449,11 +1449,11 @@ discard block |
||
| 1449 | 1449 | * Not a table-based template; don't add sort icons |
| 1450 | 1450 | * @since 1.12 |
| 1451 | 1451 | */ |
| 1452 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1452 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1453 | 1453 | return $label; |
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1456 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1457 | 1457 | return $label; |
| 1458 | 1458 | } |
| 1459 | 1459 | |
@@ -1461,29 +1461,29 @@ discard block |
||
| 1461 | 1461 | |
| 1462 | 1462 | $class = 'gv-sort'; |
| 1463 | 1463 | |
| 1464 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1464 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1465 | 1465 | |
| 1466 | 1466 | $sort_args = array( |
| 1467 | - 'sort' => $field['id'], |
|
| 1467 | + 'sort' => $field[ 'id' ], |
|
| 1468 | 1468 | 'dir' => 'asc', |
| 1469 | 1469 | ); |
| 1470 | 1470 | |
| 1471 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1471 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1472 | 1472 | //toggle sorting direction. |
| 1473 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1474 | - $sort_args['dir'] = 'desc'; |
|
| 1473 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1474 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1475 | 1475 | $class .= ' gv-icon-sort-desc'; |
| 1476 | 1476 | } else { |
| 1477 | - $sort_args['dir'] = 'asc'; |
|
| 1477 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1478 | 1478 | $class .= ' gv-icon-sort-asc'; |
| 1479 | 1479 | } |
| 1480 | 1480 | } else { |
| 1481 | 1481 | $class .= ' gv-icon-caret-up-down'; |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1484 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1485 | 1485 | |
| 1486 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1486 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1487 | 1487 | |
| 1488 | 1488 | } |
| 1489 | 1489 | |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | |
| 1502 | 1502 | $field_type = $field_id; |
| 1503 | 1503 | |
| 1504 | - if( is_numeric( $field_id ) ) { |
|
| 1504 | + if ( is_numeric( $field_id ) ) { |
|
| 1505 | 1505 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1506 | 1506 | $field_type = $field->type; |
| 1507 | 1507 | } |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | return false; |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1527 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1528 | 1528 | |
| 1529 | 1529 | } |
| 1530 | 1530 | |
@@ -54,20 +54,20 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | /** Load common & connector functions */ |
| 56 | 56 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
| 57 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
| 58 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
| 57 | +require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
| 58 | +require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
| 59 | 59 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
| 60 | 60 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
| 61 | 61 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
| 62 | 62 | |
| 63 | 63 | /** Register Post Types and Rewrite Rules */ |
| 64 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
| 64 | +require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
| 65 | 65 | |
| 66 | 66 | /** Add Cache Class */ |
| 67 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
| 67 | +require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
| 68 | 68 | |
| 69 | 69 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
| 70 | -if( is_admin() ) { |
|
| 70 | +if ( is_admin() ) { |
|
| 71 | 71 | register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
| 72 | 72 | register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
| 73 | 73 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public static function getInstance() { |
| 90 | 90 | |
| 91 | - if( empty( self::$instance ) ) { |
|
| 91 | + if ( empty( self::$instance ) ) { |
|
| 92 | 92 | self::$instance = new self; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | private function __construct() { |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
| 101 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function include_files() { |
| 129 | 129 | |
| 130 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
| 130 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
| 131 | 131 | |
| 132 | 132 | // Load fields |
| 133 | 133 | include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
@@ -139,22 +139,22 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
| 142 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
| 142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
| 143 | 143 | |
| 144 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
| 145 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
| 144 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
| 145 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
| 146 | 146 | |
| 147 | 147 | // Load Extensions |
| 148 | 148 | // @todo: Convert to a scan of the directory or a method where this all lives |
| 149 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 150 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 151 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 149 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 150 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 151 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 152 | 152 | |
| 153 | 153 | // Load WordPress Widgets |
| 154 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 154 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 155 | 155 | |
| 156 | 156 | // Load GravityView Widgets |
| 157 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 157 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 158 | 158 | |
| 159 | 159 | // Add oEmbed |
| 160 | 160 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 169 | 169 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 170 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 170 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 171 | 171 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 172 | 172 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 173 | 173 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return bool |
| 183 | 183 | */ |
| 184 | 184 | public static function is_network_activated() { |
| 185 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 185 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @since 1.7.5.1 |
| 248 | 248 | */ |
| 249 | 249 | public static function include_widget_class() { |
| 250 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 250 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | if ( ! $loaded ) { |
| 271 | 271 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 272 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 272 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 273 | 273 | load_textdomain( 'gravityview', $mofile ); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | */ |
| 301 | 301 | public function frontend_actions( $force = false ) { |
| 302 | 302 | |
| 303 | - if( self::is_admin() && ! $force ) { return; } |
|
| 303 | + if ( self::is_admin() && ! $force ) { return; } |
|
| 304 | 304 | |
| 305 | 305 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 306 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 307 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 308 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 306 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 307 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 308 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 309 | 309 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 310 | 310 | |
| 311 | 311 | |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public static function get_default_widget_areas() { |
| 332 | 332 | $default_areas = array( |
| 333 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 334 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 333 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 334 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @param mixed $data Additional data to display |
| 350 | 350 | * @return void |
| 351 | 351 | */ |
| 352 | - public static function log_debug( $message, $data = null ){ |
|
| 352 | + public static function log_debug( $message, $data = null ) { |
|
| 353 | 353 | /** |
| 354 | 354 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 355 | 355 | * @param string $message Message to display |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param string $message log message |
| 364 | 364 | * @return void |
| 365 | 365 | */ |
| 366 | - public static function log_error( $message, $data = null ){ |
|
| 366 | + public static function log_error( $message, $data = null ) { |
|
| 367 | 367 | /** |
| 368 | 368 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 369 | 369 | * @param string $message Error message to display |
@@ -374,4 +374,4 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | } // end class GravityView_Plugin |
| 376 | 376 | |
| 377 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 377 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
|