@@ -59,8 +59,8 @@ |
||
| 59 | 59 | |
| 60 | 60 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 61 | 61 | |
| 62 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 63 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 62 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 63 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 64 | 64 | |
| 65 | 65 | $sql = $wpdb->prepare( " |
| 66 | 66 | DELETE FROM $notes_table |
@@ -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 ) { |
@@ -346,14 +346,14 @@ discard block |
||
| 346 | 346 | /** |
| 347 | 347 | * update_approved function. |
| 348 | 348 | * |
| 349 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 349 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 350 | 350 | * @see GravityView_Entry_Approval::update_approved |
| 351 | - * |
|
| 351 | + * |
|
| 352 | 352 | * @param int $entry_id (default: 0) |
| 353 | 353 | * @param int $approved (default: 0) |
| 354 | 354 | * @param int $form_id (default: 0) |
| 355 | 355 | * @param int $approvedcolumn (default: 0) |
| 356 | - * |
|
| 356 | + * |
|
| 357 | 357 | * @return boolean True: It worked; False: it failed |
| 358 | 358 | */ |
| 359 | 359 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | /** |
| 364 | 364 | * Calculate the approve field.input id |
| 365 | 365 | * |
| 366 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 367 | - * @see GravityView_Entry_Approval::get_approved_column |
|
| 368 | - * |
|
| 366 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 367 | + * @see GravityView_Entry_Approval::get_approved_column |
|
| 368 | + * |
|
| 369 | 369 | * @param mixed $form GF Form or Form ID |
| 370 | 370 | * @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. |
| 371 | 371 | */ |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 488 | 488 | 'bulk_message' => $this->bulk_update_message, |
| 489 | 489 | 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
| 490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 491 | 491 | 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
| 492 | 492 | 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
| 493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
@@ -496,11 +496,11 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
| 499 | - * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 500 | - * |
|
| 501 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 502 | - * numeric, but it does group the approved entries together. |
|
| 503 | - * |
|
| 499 | + * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 500 | + * |
|
| 501 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 502 | + * numeric, but it does group the approved entries together. |
|
| 503 | + * |
|
| 504 | 504 | * @param int $form_id |
| 505 | 505 | * |
| 506 | 506 | * @return string Sorting link |
@@ -510,20 +510,20 @@ discard block |
||
| 510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
| 511 | 511 | |
| 512 | 512 | if( ! $approved_column_id ) { |
| 513 | - return ''; |
|
| 514 | - } |
|
| 513 | + return ''; |
|
| 514 | + } |
|
| 515 | 515 | |
| 516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 516 | + $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 517 | 517 | |
| 518 | - $args = array( |
|
| 519 | - 'orderby' => $approved_column_id, |
|
| 520 | - 'order' => $order, |
|
| 521 | - ); |
|
| 518 | + $args = array( |
|
| 519 | + 'orderby' => $approved_column_id, |
|
| 520 | + 'order' => $order, |
|
| 521 | + ); |
|
| 522 | 522 | |
| 523 | - $link = add_query_arg( $args ); |
|
| 523 | + $link = add_query_arg( $args ); |
|
| 524 | 524 | |
| 525 | 525 | return $link; |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | 529 | * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** gf_entries page - entries table screen */ |
| 45 | 45 | |
| 46 | 46 | // capture bulk actions |
| 47 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
| 47 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
| 48 | 48 | |
| 49 | 49 | // add hidden field with approve status |
| 50 | 50 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 53 | 53 | |
| 54 | 54 | // adding styles and scripts |
| 55 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 55 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 56 | 56 | // bypass Gravity Forms no-conflict mode |
| 57 | 57 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 58 | 58 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
| 82 | 82 | * @param array $form GF Form object of current form |
| 83 | 83 | */ |
| 84 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 84 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 85 | 85 | return $filter_links; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -102,19 +102,19 @@ discard block |
||
| 102 | 102 | $approved_count = $disapproved_count = 0; |
| 103 | 103 | |
| 104 | 104 | // Only count if necessary |
| 105 | - if( $include_counts ) { |
|
| 106 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 107 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 105 | + if ( $include_counts ) { |
|
| 106 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 107 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $filter_links[] = array( |
|
| 110 | + $filter_links[ ] = array( |
|
| 111 | 111 | 'id' => 'gv_approved', |
| 112 | 112 | 'field_filters' => $field_filters_approved, |
| 113 | 113 | 'count' => $approved_count, |
| 114 | 114 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - $filter_links[] = array( |
|
| 117 | + $filter_links[ ] = array( |
|
| 118 | 118 | 'id' => 'gv_disapproved', |
| 119 | 119 | 'field_filters' => $field_filters_disapproved, |
| 120 | 120 | 'count' => $disapproved_count, |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function tooltips( $tooltips ) { |
| 135 | 135 | |
| 136 | - $tooltips['form_gravityview_fields'] = array( |
|
| 137 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 138 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 136 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 137 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 138 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | return $tooltips; |
@@ -246,15 +246,15 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $gv_bulk_action = false; |
| 248 | 248 | |
| 249 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 250 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
| 249 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 250 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
| 251 | 251 | } else { |
| 252 | 252 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
| 253 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
| 253 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
| 257 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
| 257 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
| 258 | 258 | $gv_bulk_action = $bulk_action; |
| 259 | 259 | } |
| 260 | 260 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | // gforms_entry_list is the nonce that confirms we're on the right page |
| 281 | 281 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 282 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
| 282 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 283 | 283 | |
| 284 | 284 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 285 | 285 | |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // All entries are set to be updated, not just the visible ones |
| 300 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 300 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 301 | 301 | |
| 302 | 302 | // Convert the current entry search into GF-formatted search criteria |
| 303 | 303 | $search = array( |
| 304 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 305 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 306 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 304 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 305 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 306 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } else { |
| 315 | 315 | |
| 316 | 316 | // Changed from 'lead' to 'entry' in 2.0 |
| 317 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
| 317 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
| 318 | 318 | |
| 319 | 319 | } |
| 320 | 320 | |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
| 327 | 327 | |
| 328 | 328 | switch ( $approved_status ) { |
| 329 | - case $this->bulk_action_prefixes['approve']: |
|
| 329 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
| 330 | 330 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
| 331 | 331 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
| 332 | 332 | break; |
| 333 | - case $this->bulk_action_prefixes['unapprove']: |
|
| 333 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
| 334 | 334 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
| 335 | 335 | $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
| 336 | 336 | break; |
| 337 | - case $this->bulk_action_prefixes['disapprove']: |
|
| 337 | + case $this->bulk_action_prefixes[ 'disapprove' ]: |
|
| 338 | 338 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
| 339 | 339 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
| 340 | 340 | break; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * |
| 357 | 357 | * @return boolean True: It worked; False: it failed |
| 358 | 358 | */ |
| 359 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 359 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 360 | 360 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
| 361 | 361 | } |
| 362 | 362 | |
@@ -386,20 +386,20 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @return void |
| 388 | 388 | */ |
| 389 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 389 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 390 | 390 | |
| 391 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 391 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 392 | 392 | return; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if( empty( $entry['id'] ) ) { |
|
| 395 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 396 | 396 | return; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
| 400 | 400 | |
| 401 | - if( $status_value ) { |
|
| 402 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
| 401 | + if ( $status_value ) { |
|
| 402 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -412,10 +412,10 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | private function get_form_id() { |
| 414 | 414 | |
| 415 | - $form_id = GFForms::get('id'); |
|
| 415 | + $form_id = GFForms::get( 'id' ); |
|
| 416 | 416 | |
| 417 | 417 | // If there are no forms identified, use the first form. That's how GF does it. |
| 418 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 418 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 419 | 419 | $form_id = $this->get_first_form_id(); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -435,14 +435,14 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $forms = RGFormsModel::get_forms( null, 'title' ); |
| 437 | 437 | |
| 438 | - if( ! isset( $forms[0] ) ) { |
|
| 438 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
| 439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' ); |
| 440 | 440 | return 0; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - $first_form = $forms[0]; |
|
| 443 | + $first_form = $forms[ 0 ]; |
|
| 444 | 444 | |
| 445 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
| 445 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
| 446 | 446 | |
| 447 | 447 | return intval( $form_id ); |
| 448 | 448 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | function add_scripts_and_styles( $hook ) { |
| 452 | 452 | |
| 453 | - if( ! class_exists( 'RGForms' ) ) { |
|
| 453 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 454 | 454 | |
| 455 | 455 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 456 | 456 | |
@@ -459,25 +459,25 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // enqueue styles & scripts gf_entries |
| 461 | 461 | // But only if we're on the main Entries page, not on reports pages |
| 462 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
| 462 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
| 463 | 463 | return; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | $form_id = $this->get_form_id(); |
| 467 | 467 | |
| 468 | 468 | // Things are broken; no forms were found |
| 469 | - if( empty( $form_id ) ) { |
|
| 469 | + if ( empty( $form_id ) ) { |
|
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 473 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 474 | 474 | |
| 475 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 475 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 476 | 476 | |
| 477 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 477 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 478 | 478 | |
| 479 | 479 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 480 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
| 480 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
| 481 | 481 | 'form_id' => $form_id, |
| 482 | 482 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 483 | 483 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -486,10 +486,10 @@ discard block |
||
| 486 | 486 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
| 487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 488 | 488 | 'bulk_message' => $this->bulk_update_message, |
| 489 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
| 490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 491 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
| 492 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 489 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
| 490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
| 491 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
| 492 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
| 494 | 494 | ) ); |
| 495 | 495 | |
@@ -509,11 +509,11 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
| 511 | 511 | |
| 512 | - if( ! $approved_column_id ) { |
|
| 512 | + if ( ! $approved_column_id ) { |
|
| 513 | 513 | return ''; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 516 | + $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc'; |
|
| 517 | 517 | |
| 518 | 518 | $args = array( |
| 519 | 519 | 'orderby' => $approved_column_id, |
@@ -539,16 +539,16 @@ discard block |
||
| 539 | 539 | $bulk_actions = array( |
| 540 | 540 | 'GravityView' => array( |
| 541 | 541 | array( |
| 542 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
| 543 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
| 542 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
| 543 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
| 544 | 544 | ), |
| 545 | 545 | array( |
| 546 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
| 547 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ), |
|
| 546 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
| 547 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
| 548 | 548 | ), |
| 549 | 549 | array( |
| 550 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
| 551 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
| 550 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
| 551 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
| 552 | 552 | ), |
| 553 | 553 | ), |
| 554 | 554 | ); |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | // Sanitize the values, just to be sure. |
| 566 | 566 | foreach ( $bulk_actions as $key => $group ) { |
| 567 | 567 | foreach ( $group as $i => $action ) { |
| 568 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 569 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 568 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 569 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
@@ -591,13 +591,13 @@ discard block |
||
| 591 | 591 | * @since 1.7.2 |
| 592 | 592 | * @param boolean $hide_if_no_connections |
| 593 | 593 | */ |
| 594 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 594 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 595 | 595 | |
| 596 | - if( $hide_if_no_connections ) { |
|
| 596 | + if ( $hide_if_no_connections ) { |
|
| 597 | 597 | |
| 598 | 598 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 599 | 599 | |
| 600 | - if( empty( $connected_views ) ) { |
|
| 600 | + if ( empty( $connected_views ) ) { |
|
| 601 | 601 | $show_approve_column = false; |
| 602 | 602 | } |
| 603 | 603 | } |
@@ -607,18 +607,18 @@ discard block |
||
| 607 | 607 | * @param boolean $show_approve_column Whether the column will be shown |
| 608 | 608 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 609 | 609 | */ |
| 610 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 610 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 611 | 611 | |
| 612 | 612 | return $show_approve_column; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | function register_gform_noconflict_script( $scripts ) { |
| 616 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 616 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 617 | 617 | return $scripts; |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | function register_gform_noconflict_style( $styles ) { |
| 621 | - $styles[] = 'gravityview_entries_list'; |
|
| 621 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 622 | 622 | return $styles; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @param int $entry_id ID of the Gravity Forms entry |
| 325 | 325 | * @param string $status String whether entry is approved or not. `0` for not approved, `Approved` for approved. |
| 326 | 326 | * @param int $form_id ID of the form of the entry being updated. Improves query performance. |
| 327 | - * @param string $approvedcolumn Gravity Forms Field ID |
|
| 327 | + * @param integer $approvedcolumn Gravity Forms Field ID |
|
| 328 | 328 | * |
| 329 | 329 | * @return true|WP_Error |
| 330 | 330 | */ |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @access public |
| 417 | 417 | * @static |
| 418 | 418 | * @param mixed $form GF Form or Form ID |
| 419 | - * @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. |
|
| 419 | + * @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. |
|
| 420 | 420 | */ |
| 421 | 421 | static public function get_approved_column( $form ) { |
| 422 | 422 | |
@@ -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 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function get_entry_status( $entry, $value_or_label = 'label' ) { |
| 64 | 64 | |
| 65 | - $entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry ); |
|
| 65 | + $entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry ); |
|
| 66 | 66 | |
| 67 | 67 | $status = gform_get_meta( $entry_id, self::meta_key ); |
| 68 | 68 | |
| 69 | 69 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
| 70 | 70 | |
| 71 | - if( 'value' === $value_or_label ) { |
|
| 71 | + if ( 'value' === $value_or_label ) { |
|
| 72 | 72 | return $status; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function ajax_update_approved() { |
| 95 | 95 | |
| 96 | - $form_id = intval( rgpost('form_id') ); |
|
| 96 | + $form_id = intval( rgpost( 'form_id' ) ); |
|
| 97 | 97 | |
| 98 | - $entry_id = GVCommon::get_entry_id( rgpost('entry_slug'), true ); |
|
| 98 | + $entry_id = GVCommon::get_entry_id( rgpost( 'entry_slug' ), true ); |
|
| 99 | 99 | |
| 100 | - $approval_status = rgpost('approved'); |
|
| 100 | + $approval_status = rgpost( 'approved' ); |
|
| 101 | 101 | |
| 102 | - $nonce = rgpost('nonce'); |
|
| 102 | + $nonce = rgpost( 'nonce' ); |
|
| 103 | 103 | |
| 104 | 104 | // Valid status |
| 105 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 105 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 106 | 106 | |
| 107 | 107 | do_action( 'gravityview_log_error', __METHOD__ . ': Invalid approval status', $_POST ); |
| 108 | 108 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 135 | 135 | |
| 136 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
| 136 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param $form array Gravity Forms form object |
| 167 | 167 | */ |
| 168 | 168 | public function after_submission( $entry, $form ) { |
| 169 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
| 169 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -180,18 +180,18 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 182 | 182 | |
| 183 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
| 183 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * If the form doesn't contain the approve field, don't assume anything. |
| 187 | 187 | */ |
| 188 | - if( empty( $approved_column ) ) { |
|
| 188 | + if ( empty( $approved_column ) ) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $entry = GFAPI::get_entry( $entry_id ); |
| 193 | 193 | |
| 194 | - self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form['id'] ); |
|
| 194 | + self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form[ 'id' ] ); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $success = true; |
| 232 | 232 | foreach ( $entries as $entry_id ) { |
| 233 | - $update_success = self::update_approved( (int) $entry_id, $approved, $form_id, $approved_column_id ); |
|
| 233 | + $update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
|
| 234 | 234 | |
| 235 | 235 | if ( ! $update_success ) { |
| 236 | 236 | $success = false; |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
| 258 | 258 | |
| 259 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 259 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 264 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ': Not a valid approval value.' ); |
| 266 | 266 | return false; |
| 267 | 267 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // If the form has an Approve/Reject field, update that value |
| 279 | 279 | $result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn ); |
| 280 | 280 | |
| 281 | - if( is_wp_error( $result ) ) { |
|
| 281 | + if ( is_wp_error( $result ) ) { |
|
| 282 | 282 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 283 | 283 | return false; |
| 284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | // add note to entry if approval field updating worked or there was no approved field |
| 292 | 292 | // There's no validation for the meta |
| 293 | - if( true === $result ) { |
|
| 293 | + if ( true === $result ) { |
|
| 294 | 294 | |
| 295 | 295 | // Add an entry note |
| 296 | 296 | self::add_approval_status_updated_note( $entry_id, $approved ); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $note_id = false; |
| 345 | 345 | |
| 346 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 346 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 347 | 347 | |
| 348 | 348 | $current_user = wp_get_current_user(); |
| 349 | 349 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
| 367 | 367 | |
| 368 | - if( empty( $approvedcolumn ) ) { |
|
| 368 | + if ( empty( $approvedcolumn ) ) { |
|
| 369 | 369 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | private static function update_approved_meta( $entry_id, $status, $form_id = 0 ) { |
| 414 | 414 | |
| 415 | 415 | if ( ! GravityView_Entry_Approval_Status::is_valid( $status ) ) { |
| 416 | - do_action('gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 416 | + do_action( 'gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 417 | 417 | return; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
| 421 | 421 | |
| 422 | 422 | // update entry meta |
| 423 | - if( function_exists('gform_update_meta') ) { |
|
| 423 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 424 | 424 | |
| 425 | - if( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
| 425 | + if ( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
| 426 | 426 | gform_delete_meta( $entry_id, self::meta_key ); |
| 427 | 427 | } else { |
| 428 | 428 | gform_update_meta( $entry_id, self::meta_key, $status, $form_id ); |
@@ -445,11 +445,11 @@ discard block |
||
| 445 | 445 | * @since 1.18 Added "unapproved" |
| 446 | 446 | * @param int $entry_id ID of the Gravity Forms entry |
| 447 | 447 | */ |
| 448 | - do_action( 'gravityview/approve_entries/' . $action , $entry_id ); |
|
| 448 | + do_action( 'gravityview/approve_entries/' . $action, $entry_id ); |
|
| 449 | 449 | |
| 450 | 450 | } else { |
| 451 | 451 | |
| 452 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 452 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 453 | 453 | |
| 454 | 454 | } |
| 455 | 455 | } |
@@ -464,29 +464,29 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | static public function get_approved_column( $form ) { |
| 466 | 466 | |
| 467 | - if( empty( $form ) ) { |
|
| 467 | + if ( empty( $form ) ) { |
|
| 468 | 468 | return null; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if( !is_array( $form ) ) { |
|
| 471 | + if ( ! is_array( $form ) ) { |
|
| 472 | 472 | $form = GVCommon::get_form( $form ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - foreach( $form['fields'] as $key => $field ) { |
|
| 475 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 476 | 476 | |
| 477 | - $field = (array) $field; |
|
| 477 | + $field = (array)$field; |
|
| 478 | 478 | |
| 479 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 480 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 481 | - return $field['inputs'][0]['id']; |
|
| 479 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 480 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 481 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 486 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 487 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 488 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 489 | - return $input['id']; |
|
| 486 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 487 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 488 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 489 | + return $input[ 'id' ]; |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function __construct() { |
| 22 | 22 | |
| 23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
| 23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
| 24 | 24 | |
| 25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
| 25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
| 26 | 26 | |
| 27 | 27 | // adding styles and scripts |
| 28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 29 | 29 | |
| 30 | 30 | // ajax - populate sort fields based on the selected view |
| 31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function is_post_editor_screen() { |
| 42 | 42 | global $current_screen, $pagenow; |
| 43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
| 43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @since 1.15.3 |
| 57 | 57 | */ |
| 58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
| 58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if( !$this->is_post_editor_screen() ) { |
|
| 62 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | ?> |
| 66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
| 66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
| 67 | 67 | <?php |
| 68 | 68 | |
| 69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | function add_shortcode_popup() { |
| 80 | 80 | global $post; |
| 81 | 81 | |
| 82 | - if( !$this->is_post_editor_screen() ) { |
|
| 82 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $post_type = get_post_type_object($post->post_type); |
|
| 86 | + $post_type = get_post_type_object( $post->post_type ); |
|
| 87 | 87 | |
| 88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
| 88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
| 89 | 89 | |
| 90 | 90 | // If there are no views set up yet, we get outta here. |
| 91 | - if( empty( $views ) ) { |
|
| 91 | + if ( empty( $views ) ) { |
|
| 92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
| 93 | 93 | return; |
| 94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | <div class="wrap"> |
| 100 | 100 | |
| 101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
| 102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
| 102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
| 103 | 103 | |
| 104 | 104 | <div> |
| 105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
| 108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
| 109 | 109 | <?php |
| 110 | - foreach( $views as $view ) { |
|
| 111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
| 112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
| 110 | + foreach ( $views as $view ) { |
|
| 111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
| 112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
| 113 | 113 | } |
| 114 | 114 | ?> |
| 115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | foreach ( $settings as $key => $setting ) { |
| 127 | 127 | |
| 128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
| 128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
| 129 | 129 | |
| 130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
| 131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | </table> |
| 135 | 135 | |
| 136 | 136 | <div class="submit"> |
| 137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
| 138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
| 137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
| 138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
| 139 | 139 | </div> |
| 140 | 140 | |
| 141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function add_scripts_and_styles() { |
| 158 | 158 | |
| 159 | - if( ! $this->is_post_editor_screen() ) { |
|
| 159 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
| 169 | 169 | |
| 170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
| 170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
| 171 | 171 | |
| 172 | 172 | //enqueue styles |
| 173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
| 175 | 175 | |
| 176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 177 | 177 | |
| 178 | 178 | // custom js |
| 179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
| 179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
| 180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
| 181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
| 182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
| 181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
| 182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
| 183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
| 184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
| 185 | - )); |
|
| 184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
| 185 | + ) ); |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | function get_sortable_fields() { |
| 199 | 199 | |
| 200 | 200 | // Not properly formatted request |
| 201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
| 201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
| 202 | 202 | exit( false ); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // Not valid request |
| 206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
| 206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
| 207 | 207 | exit( false ); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - $viewid = (int)$_POST['viewid']; |
|
| 210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
| 211 | 211 | |
| 212 | 212 | // fetch form id assigned to the view |
| 213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -113,16 +113,16 @@ discard block |
||
| 113 | 113 | $new_value = $old_value; |
| 114 | 114 | |
| 115 | 115 | // Meta value does not exist yet |
| 116 | - if( false === $old_value ) { |
|
| 116 | + if ( false === $old_value ) { |
|
| 117 | 117 | return self::UNAPPROVED; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Meta value does not exist yet |
| 121 | - if( true === $old_value ) { |
|
| 121 | + if ( true === $old_value ) { |
|
| 122 | 122 | return self::APPROVED; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - switch ( (string) $old_value ) { |
|
| 125 | + switch ( (string)$old_value ) { |
|
| 126 | 126 | |
| 127 | 127 | // Approved values |
| 128 | 128 | case 'Approved': |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | foreach ( $choices as $key => $choice ) { |
| 248 | 248 | |
| 249 | 249 | // Is the passed status value the same as the choice value or key? |
| 250 | - if ( $status === $choice['value'] || $status === $key ) { |
|
| 250 | + if ( $status === $choice[ 'value' ] || $status === $key ) { |
|
| 251 | 251 | |
| 252 | - if( 'key' === $attr_key ) { |
|
| 252 | + if ( 'key' === $attr_key ) { |
|
| 253 | 253 | return $key; |
| 254 | 254 | } else { |
| 255 | 255 | return rgar( $choice, $attr_key, false ); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | // Load even when invalid to allow for export |
| 20 | 20 | add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) ); |
| 21 | 21 | |
| 22 | - if( GravityView_Compatibility::is_valid() ) { |
|
| 22 | + if ( GravityView_Compatibility::is_valid() ) { |
|
| 23 | 23 | add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) ); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $supports = array( 'title', 'revisions' ); |
| 45 | 45 | |
| 46 | - if( $is_hierarchical ) { |
|
| 47 | - $supports[] = 'page-attributes'; |
|
| 46 | + if ( $is_hierarchical ) { |
|
| 47 | + $supports[ ] = 'page-attributes'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
| 81 | 81 | */ |
| 82 | - foreach( $this->lead_db_columns as $column ) { |
|
| 82 | + foreach ( $this->lead_db_columns as $column ) { |
|
| 83 | 83 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
| 115 | + do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
| 116 | 116 | |
| 117 | - $this->blacklist_add( $entry['form_id'] ); |
|
| 117 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function entry_updated( $form, $lead_id ) { |
| 129 | 129 | |
| 130 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
| 130 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
| 131 | 131 | |
| 132 | - $this->blacklist_add( $form['id'] ); |
|
| 132 | + $this->blacklist_add( $form[ 'id' ] ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function entry_created( $entry, $form ) { |
| 146 | 146 | |
| 147 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' ); |
|
| 147 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' ); |
|
| 148 | 148 | |
| 149 | - $this->blacklist_add( $form['id'] ); |
|
| 149 | + $this->blacklist_add( $form[ 'id' ] ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Normally just one form, but supports multiple forms |
| 166 | 166 | // |
| 167 | 167 | // Array of IDs 12, 5, 14 would result in `f-12f-5f-14` |
| 168 | - $forms = 'f:' . implode( '&f:', (array) $form_ids ); |
|
| 168 | + $forms = 'f:' . implode( '&f:', (array)$form_ids ); |
|
| 169 | 169 | |
| 170 | 170 | // Prefix for transient keys |
| 171 | 171 | // Now the prefix would be: `gv-cache-f-12f-5f-14` |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | ) ); |
| 223 | 223 | |
| 224 | 224 | // Add the passed form IDs |
| 225 | - $blacklist = array_merge( (array) $blacklist, $form_ids ); |
|
| 225 | + $blacklist = array_merge( (array)$blacklist, $form_ids ); |
|
| 226 | 226 | |
| 227 | 227 | // Don't duplicate |
| 228 | 228 | $blacklist = array_unique( $blacklist ); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
| 244 | 244 | |
| 245 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
| 245 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
| 246 | 246 | |
| 247 | 247 | do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array( |
| 248 | 248 | '$form_ids' => $form_ids, |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return false; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - foreach ( (array) $form_ids as $form_id ) { |
|
| 278 | + foreach ( (array)$form_ids as $form_id ) { |
|
| 279 | 279 | |
| 280 | 280 | if ( in_array( $form_id, $blacklist ) ) { |
| 281 | 281 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
| 348 | 348 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
| 349 | 349 | */ |
| 350 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
| 350 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
| 351 | 351 | |
| 352 | 352 | do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' ); |
| 353 | 353 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | return; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - foreach ( (array) $form_ids as $form_id ) { |
|
| 386 | + foreach ( (array)$form_ids as $form_id ) { |
|
| 387 | 387 | |
| 388 | 388 | $key = $this->get_cache_key_prefix( $form_id ); |
| 389 | 389 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
| 499 | 499 | |
| 500 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
| 500 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
| 501 | 501 | |
| 502 | 502 | do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' ); |
| 503 | 503 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
| 528 | 528 | |
| 529 | - return (boolean) $use_cache; |
|
| 529 | + return (boolean)$use_cache; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
| 50 | 50 | |
| 51 | 51 | // Get details about the current View |
| 52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
| 53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
| 52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
| 53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
| 87 | 87 | |
| 88 | 88 | // Only keep the passed attributes after making sure that they're valid pairs |
| 89 | - $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts; |
|
| 89 | + $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts; |
|
| 90 | 90 | |
| 91 | 91 | $atts = array(); |
| 92 | 92 | |
| 93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 94 | 94 | |
| 95 | 95 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
| 96 | 96 | $passed_value = GravityView_Merge_Tags::replace_variables( $passed_value ); |
| 97 | 97 | |
| 98 | - switch( $defaults[ $key ]['type'] ) { |
|
| 98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 104 | 104 | */ |
| 105 | 105 | case 'number': |
| 106 | - if( is_numeric( $passed_value ) ) { |
|
| 106 | + if ( is_numeric( $passed_value ) ) { |
|
| 107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
| 108 | 108 | } |
| 109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | case 'select': |
| 120 | 120 | case 'radio': |
| 121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 123 | 123 | $atts[ $key ] = $passed_value; |
| 124 | 124 | } |
| 125 | 125 | break; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
| 149 | 149 | $return = ''; |
| 150 | 150 | |
| 151 | - switch( $detail ) { |
|
| 151 | + switch ( $detail ) { |
|
| 152 | 152 | case 'total_entries': |
| 153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
| 154 | 154 | break; |