| @@ -432,23 +432,17 @@ | ||
| 432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); | 
| 433 | 433 | |
| 434 | 434 | $result = false; | 
| 435 | - } | |
| 436 | - | |
| 437 | -		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { | |
| 435 | +		} else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { | |
| 438 | 436 | |
| 439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); | 
| 440 | 438 | |
| 441 | 439 | $result = false; | 
| 442 | - } | |
| 443 | - | |
| 444 | -		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { | |
| 440 | +		} else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { | |
| 445 | 441 | |
| 446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); | 
| 447 | 443 | |
| 448 | 444 | $result = false; | 
| 449 | - } | |
| 450 | - | |
| 451 | -		else { | |
| 445 | +		} else { | |
| 452 | 446 | |
| 453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); | 
| 454 | 448 | |
| @@ -34,19 +34,19 @@ discard block | ||
| 34 | 34 | /** gf_entries page - entries table screen */ | 
| 35 | 35 | |
| 36 | 36 | // capture bulk actions | 
| 37 | - add_action( 'init', array( $this, 'process_bulk_action') ); | |
| 37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); | |
| 38 | 38 | // add hidden field with approve status | 
| 39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); | 
| 40 | 40 | // process ajax approve entry requests | 
| 41 | -		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); | |
| 41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); | |
| 42 | 42 | |
| 43 | 43 | // in case entry is edited (on admin or frontend) | 
| 44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); | |
| 44 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); | |
| 45 | 45 | |
| 46 | 46 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); | 
| 47 | 47 | |
| 48 | 48 | // adding styles and scripts | 
| 49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); | |
| 49 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); | |
| 50 | 50 | // bypass Gravity Forms no-conflict mode | 
| 51 | 51 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); | 
| 52 | 52 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); | 
| @@ -61,9 +61,9 @@ discard block | ||
| 61 | 61 | */ | 
| 62 | 62 |  	function tooltips( $tooltips ) { | 
| 63 | 63 | |
| 64 | - $tooltips['form_gravityview_fields'] = array( | |
| 65 | -			'title' => __('GravityView Fields', 'gravityview'), | |
| 66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), | |
| 64 | + $tooltips[ 'form_gravityview_fields' ] = array( | |
| 65 | + 'title' => __( 'GravityView Fields', 'gravityview' ), | |
| 66 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), | |
| 67 | 67 | ); | 
| 68 | 68 | |
| 69 | 69 | return $tooltips; | 
| @@ -178,12 +178,12 @@ discard block | ||
| 178 | 178 | } | 
| 179 | 179 | |
| 180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. | 
| 181 | -		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { | |
| 181 | +		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { | |
| 182 | 182 | |
| 183 | 183 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); | 
| 184 | 184 | |
| 185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. | 
| 186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; | |
| 186 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; | |
| 187 | 187 | |
| 188 | 188 | /** | 
| 189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. | 
| @@ -199,13 +199,13 @@ discard block | ||
| 199 | 199 | } | 
| 200 | 200 | |
| 201 | 201 | // All entries are set to be updated, not just the visible ones | 
| 202 | -			if ( ! empty( $_POST['all_entries'] ) ) { | |
| 202 | +			if ( ! empty( $_POST[ 'all_entries' ] ) ) { | |
| 203 | 203 | |
| 204 | 204 | // Convert the current entry search into GF-formatted search criteria | 
| 205 | 205 | $search = array( | 
| 206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, | |
| 207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', | |
| 208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', | |
| 206 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, | |
| 207 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', | |
| 208 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', | |
| 209 | 209 | ); | 
| 210 | 210 | |
| 211 | 211 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); | 
| @@ -215,7 +215,7 @@ discard block | ||
| 215 | 215 | |
| 216 | 216 |  			} else { | 
| 217 | 217 | |
| 218 | - $entries = $_POST['lead']; | |
| 218 | + $entries = $_POST[ 'lead' ]; | |
| 219 | 219 | |
| 220 | 220 | } | 
| 221 | 221 | |
| @@ -256,12 +256,12 @@ discard block | ||
| 256 | 256 | */ | 
| 257 | 257 |  	private static function update_bulk( $entries, $approved, $form_id ) { | 
| 258 | 258 | |
| 259 | -		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { | |
| 259 | +		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { | |
| 260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); | 
| 261 | 261 | return false; | 
| 262 | 262 | } | 
| 263 | 263 | |
| 264 | -		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { | |
| 264 | +		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { | |
| 265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); | 
| 266 | 266 | return false; | 
| 267 | 267 | } | 
| @@ -271,7 +271,7 @@ discard block | ||
| 271 | 271 | // calculate approved field id | 
| 272 | 272 | $approved_column_id = self::get_approved_column( $form_id ); | 
| 273 | 273 | |
| 274 | -		foreach( $entries as $entry_id ) { | |
| 274 | +		foreach ( $entries as $entry_id ) { | |
| 275 | 275 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); | 
| 276 | 276 | } | 
| 277 | 277 | } | 
| @@ -290,14 +290,14 @@ discard block | ||
| 290 | 290 | * @param int $approvedcolumn (default: 0) | 
| 291 | 291 | * @return boolean True: It worked; False: it failed | 
| 292 | 292 | */ | 
| 293 | -	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { | |
| 293 | +	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { | |
| 294 | 294 | |
| 295 | -		if( !class_exists( 'GFAPI' ) ) { | |
| 295 | +		if ( ! class_exists( 'GFAPI' ) ) { | |
| 296 | 296 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); | 
| 297 | 297 | return false; | 
| 298 | 298 | } | 
| 299 | 299 | |
| 300 | -		if( empty( $approvedcolumn ) ) { | |
| 300 | +		if ( empty( $approvedcolumn ) ) { | |
| 301 | 301 | $approvedcolumn = self::get_approved_column( $form_id ); | 
| 302 | 302 | } | 
| 303 | 303 | |
| @@ -316,7 +316,7 @@ discard block | ||
| 316 | 316 | self::update_approved_meta( $entry_id, $approved ); | 
| 317 | 317 | |
| 318 | 318 | // add note to entry | 
| 319 | -		if( $result === true ) { | |
| 319 | +		if ( $result === true ) { | |
| 320 | 320 | |
| 321 | 321 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); | 
| 322 | 322 | |
| @@ -327,7 +327,7 @@ discard block | ||
| 327 | 327 | */ | 
| 328 | 328 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); | 
| 329 | 329 | |
| 330 | -			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { | |
| 330 | +			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { | |
| 331 | 331 | $current_user = wp_get_current_user(); | 
| 332 | 332 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); | 
| 333 | 333 | } | 
| @@ -339,7 +339,7 @@ discard block | ||
| 339 | 339 | */ | 
| 340 | 340 | do_action( 'gravityview_clear_form_cache', $form_id ); | 
| 341 | 341 | |
| 342 | -		} else if( is_wp_error( $result ) ) { | |
| 342 | +		} else if ( is_wp_error( $result ) ) { | |
| 343 | 343 | |
| 344 | 344 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); | 
| 345 | 345 | |
| @@ -361,12 +361,12 @@ discard block | ||
| 361 | 361 | */ | 
| 362 | 362 |  	public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { | 
| 363 | 363 | |
| 364 | - $approvedcolumn = self::get_approved_column( $form['id'] ); | |
| 364 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); | |
| 365 | 365 | |
| 366 | 366 | /** | 
| 367 | 367 | * If the form doesn't contain the approve field, don't assume anything. | 
| 368 | 368 | */ | 
| 369 | -        if( empty( $approvedcolumn ) ) { | |
| 369 | +        if ( empty( $approvedcolumn ) ) { | |
| 370 | 370 | return; | 
| 371 | 371 | } | 
| 372 | 372 | |
| @@ -388,7 +388,7 @@ discard block | ||
| 388 | 388 |  	private static function update_approved_meta( $entry_id, $is_approved ) { | 
| 389 | 389 | |
| 390 | 390 | // update entry meta | 
| 391 | -		if( function_exists('gform_update_meta') ) { | |
| 391 | +		if ( function_exists( 'gform_update_meta' ) ) { | |
| 392 | 392 | |
| 393 | 393 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); | 
| 394 | 394 | |
| @@ -400,7 +400,7 @@ discard block | ||
| 400 | 400 | */ | 
| 401 | 401 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); | 
| 402 | 402 | |
| 403 | -			if( empty( $is_approved ) ) { | |
| 403 | +			if ( empty( $is_approved ) ) { | |
| 404 | 404 | |
| 405 | 405 | /** | 
| 406 | 406 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected | 
| @@ -422,7 +422,7 @@ discard block | ||
| 422 | 422 | |
| 423 | 423 |  		} else { | 
| 424 | 424 | |
| 425 | -			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); | |
| 425 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); | |
| 426 | 426 | |
| 427 | 427 | } | 
| 428 | 428 | } | 
| @@ -434,21 +434,21 @@ discard block | ||
| 434 | 434 | */ | 
| 435 | 435 |  	public function ajax_update_approved() { | 
| 436 | 436 | |
| 437 | -		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { | |
| 437 | +		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { | |
| 438 | 438 | |
| 439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); | 
| 440 | 440 | |
| 441 | 441 | $result = false; | 
| 442 | 442 | } | 
| 443 | 443 | |
| 444 | -		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { | |
| 444 | +		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { | |
| 445 | 445 | |
| 446 | 446 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); | 
| 447 | 447 | |
| 448 | 448 | $result = false; | 
| 449 | 449 | } | 
| 450 | 450 | |
| 451 | -		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { | |
| 451 | +		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { | |
| 452 | 452 | |
| 453 | 453 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); | 
| 454 | 454 | |
| @@ -457,11 +457,11 @@ discard block | ||
| 457 | 457 | |
| 458 | 458 |  		else { | 
| 459 | 459 | |
| 460 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); | |
| 460 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); | |
| 461 | 461 | |
| 462 | -			if( is_wp_error( $result ) ) { | |
| 462 | +			if ( is_wp_error( $result ) ) { | |
| 463 | 463 | /** @var WP_Error $result */ | 
| 464 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); | |
| 464 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); | |
| 465 | 465 | $result = false; | 
| 466 | 466 | } | 
| 467 | 467 | |
| @@ -481,29 +481,29 @@ discard block | ||
| 481 | 481 | */ | 
| 482 | 482 |  	static public function get_approved_column( $form ) { | 
| 483 | 483 | |
| 484 | -        if( empty( $form ) ) { | |
| 484 | +        if ( empty( $form ) ) { | |
| 485 | 485 | return null; | 
| 486 | 486 | } | 
| 487 | 487 | |
| 488 | -        if( !is_array( $form ) ) { | |
| 488 | +        if ( ! is_array( $form ) ) { | |
| 489 | 489 | $form = GVCommon::get_form( $form ); | 
| 490 | 490 | } | 
| 491 | 491 | |
| 492 | -		foreach( $form['fields'] as $key => $field ) { | |
| 492 | +		foreach ( $form[ 'fields' ] as $key => $field ) { | |
| 493 | 493 | |
| 494 | - $field = (array) $field; | |
| 494 | + $field = (array)$field; | |
| 495 | 495 | |
| 496 | -			if( !empty( $field['gravityview_approved'] ) ) { | |
| 497 | -				if( !empty($field['inputs'][0]['id']) ) { | |
| 498 | - return $field['inputs'][0]['id']; | |
| 496 | +			if ( ! empty( $field[ 'gravityview_approved' ] ) ) { | |
| 497 | +				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { | |
| 498 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; | |
| 499 | 499 | } | 
| 500 | 500 | } | 
| 501 | 501 | |
| 502 | 502 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. | 
| 503 | -            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { | |
| 504 | -                foreach ( $field['inputs'] as $key2 => $input ) { | |
| 505 | -                    if ( strtolower( $input['label'] ) == 'approved' ) { | |
| 506 | - return $input['id']; | |
| 503 | +            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { | |
| 504 | +                foreach ( $field[ 'inputs' ] as $key2 => $input ) { | |
| 505 | +                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) { | |
| 506 | + return $input[ 'id' ]; | |
| 507 | 507 | } | 
| 508 | 508 | } | 
| 509 | 509 | } | 
| @@ -514,18 +514,18 @@ discard block | ||
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | |
| 517 | -	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) { | |
| 517 | +	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { | |
| 518 | 518 | |
| 519 | -		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { | |
| 519 | +		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { | |
| 520 | 520 | return; | 
| 521 | 521 | } | 
| 522 | 522 | |
| 523 | -		if( empty( $entry['id'] ) ) { | |
| 523 | +		if ( empty( $entry[ 'id' ] ) ) { | |
| 524 | 524 | return; | 
| 525 | 525 | } | 
| 526 | 526 | |
| 527 | -		if( gform_get_meta( $entry['id'], 'is_approved' ) ) { | |
| 528 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; | |
| 527 | +		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { | |
| 528 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; | |
| 529 | 529 | } | 
| 530 | 530 | } | 
| 531 | 531 | |
| @@ -534,7 +534,7 @@ discard block | ||
| 534 | 534 | |
| 535 | 535 |  	function add_scripts_and_styles( $hook ) { | 
| 536 | 536 | |
| 537 | -		if( !class_exists( 'RGForms' ) ) { | |
| 537 | +		if ( ! class_exists( 'RGForms' ) ) { | |
| 538 | 538 | |
| 539 | 539 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); | 
| 540 | 540 | |
| @@ -543,39 +543,39 @@ discard block | ||
| 543 | 543 | |
| 544 | 544 | // enqueue styles & scripts gf_entries | 
| 545 | 545 | // But only if we're on the main Entries page, not on reports pages | 
| 546 | -		if( RGForms::get_page() === 'entry_list' ) { | |
| 546 | +		if ( RGForms::get_page() === 'entry_list' ) { | |
| 547 | 547 | |
| 548 | -			$form_id = RGForms::get('id'); | |
| 548 | + $form_id = RGForms::get( 'id' ); | |
| 549 | 549 | |
| 550 | 550 | // If there are no forms identified, use the first form. That's how GF does it. | 
| 551 | -			if( empty( $form_id ) && class_exists('RGFormsModel') ) { | |
| 551 | +			if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { | |
| 552 | 552 | $forms = gravityview_get_forms(); | 
| 553 | -				if( !empty( $forms ) ) { | |
| 554 | - $form_id = $forms[0]['id']; | |
| 553 | +				if ( ! empty( $forms ) ) { | |
| 554 | + $form_id = $forms[ 0 ][ 'id' ]; | |
| 555 | 555 | } | 
| 556 | 556 | } | 
| 557 | 557 | |
| 558 | 558 | $approvedcolumn = self::get_approved_column( $form_id ); | 
| 559 | 559 | |
| 560 | -			wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); | |
| 560 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); | |
| 561 | 561 | wp_enqueue_style( 'gravityview_entries_list' ); | 
| 562 | 562 | |
| 563 | -			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | |
| 563 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | |
| 564 | 564 | |
| 565 | -			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); | |
| 565 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); | |
| 566 | 566 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); | 
| 567 | 567 | |
| 568 | 568 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( | 
| 569 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), | |
| 569 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), | |
| 570 | 570 | 'form_id' => $form_id, | 
| 571 | 571 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), | 
| 572 | 572 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), | 
| 573 | 573 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), | 
| 574 | 574 | 'bulk_message' => $this->bulk_update_message, | 
| 575 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), | |
| 576 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), | |
| 577 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), | |
| 578 | -				'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), | |
| 575 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), | |
| 576 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), | |
| 577 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), | |
| 578 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), | |
| 579 | 579 | ) ); | 
| 580 | 580 | |
| 581 | 581 | } | 
| @@ -618,8 +618,8 @@ discard block | ||
| 618 | 618 | // Sanitize the values, just to be sure. | 
| 619 | 619 |  		foreach ( $bulk_actions as $key => $group ) { | 
| 620 | 620 |  			foreach ( $group as $i => $action ) { | 
| 621 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); | |
| 622 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); | |
| 621 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); | |
| 622 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); | |
| 623 | 623 | } | 
| 624 | 624 | } | 
| 625 | 625 | |
| @@ -644,13 +644,13 @@ discard block | ||
| 644 | 644 | * @since 1.7.2 | 
| 645 | 645 | * @param boolean $hide_if_no_connections | 
| 646 | 646 | */ | 
| 647 | -		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); | |
| 647 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); | |
| 648 | 648 | |
| 649 | -		if( $hide_if_no_connections ) { | |
| 649 | +		if ( $hide_if_no_connections ) { | |
| 650 | 650 | |
| 651 | 651 | $connected_views = gravityview_get_connected_views( $form_id ); | 
| 652 | 652 | |
| 653 | -			if( empty( $connected_views ) ) { | |
| 653 | +			if ( empty( $connected_views ) ) { | |
| 654 | 654 | $show_approve_column = false; | 
| 655 | 655 | } | 
| 656 | 656 | } | 
| @@ -660,18 +660,18 @@ discard block | ||
| 660 | 660 | * @param boolean $show_approve_column Whether the column will be shown | 
| 661 | 661 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown | 
| 662 | 662 | */ | 
| 663 | -		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); | |
| 663 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); | |
| 664 | 664 | |
| 665 | 665 | return $show_approve_column; | 
| 666 | 666 | } | 
| 667 | 667 | |
| 668 | 668 |  	function register_gform_noconflict_script( $scripts ) { | 
| 669 | - $scripts[] = 'gravityview_gf_entries_scripts'; | |
| 669 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; | |
| 670 | 670 | return $scripts; | 
| 671 | 671 | } | 
| 672 | 672 | |
| 673 | 673 |  	function register_gform_noconflict_style( $styles ) { | 
| 674 | - $styles[] = 'gravityview_entries_list'; | |
| 674 | + $styles[ ] = 'gravityview_entries_list'; | |
| 675 | 675 | return $styles; | 
| 676 | 676 | } | 
| 677 | 677 | |
| @@ -363,12 +363,12 @@ discard block | ||
| 363 | 363 | |
| 364 | 364 | $approvedcolumn = self::get_approved_column( $form['id'] ); | 
| 365 | 365 | |
| 366 | - /** | |
| 367 | - * If the form doesn't contain the approve field, don't assume anything. | |
| 368 | - */ | |
| 369 | -        if( empty( $approvedcolumn ) ) { | |
| 370 | - return; | |
| 371 | - } | |
| 366 | + /** | |
| 367 | + * If the form doesn't contain the approve field, don't assume anything. | |
| 368 | + */ | |
| 369 | +		if( empty( $approvedcolumn ) ) { | |
| 370 | + return; | |
| 371 | + } | |
| 372 | 372 | |
| 373 | 373 | $entry = GFAPI::get_entry( $entry_id ); | 
| 374 | 374 | |
| @@ -481,17 +481,17 @@ discard block | ||
| 481 | 481 | */ | 
| 482 | 482 |  	static public function get_approved_column( $form ) { | 
| 483 | 483 | |
| 484 | -        if( empty( $form ) ) { | |
| 485 | - return null; | |
| 486 | - } | |
| 484 | +		if( empty( $form ) ) { | |
| 485 | + return null; | |
| 486 | + } | |
| 487 | 487 | |
| 488 | -        if( !is_array( $form ) ) { | |
| 489 | - $form = GVCommon::get_form( $form ); | |
| 490 | - } | |
| 488 | +		if( !is_array( $form ) ) { | |
| 489 | + $form = GVCommon::get_form( $form ); | |
| 490 | + } | |
| 491 | 491 | |
| 492 | 492 |  		foreach( $form['fields'] as $key => $field ) { | 
| 493 | 493 | |
| 494 | - $field = (array) $field; | |
| 494 | + $field = (array) $field; | |
| 495 | 495 | |
| 496 | 496 |  			if( !empty( $field['gravityview_approved'] ) ) { | 
| 497 | 497 |  				if( !empty($field['inputs'][0]['id']) ) { | 
| @@ -499,14 +499,14 @@ discard block | ||
| 499 | 499 | } | 
| 500 | 500 | } | 
| 501 | 501 | |
| 502 | - // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. | |
| 503 | -            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { | |
| 504 | -                foreach ( $field['inputs'] as $key2 => $input ) { | |
| 505 | -                    if ( strtolower( $input['label'] ) == 'approved' ) { | |
| 506 | - return $input['id']; | |
| 507 | - } | |
| 508 | - } | |
| 509 | - } | |
| 502 | + // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. | |
| 503 | +			if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { | |
| 504 | +				foreach ( $field['inputs'] as $key2 => $input ) { | |
| 505 | +					if ( strtolower( $input['label'] ) == 'approved' ) { | |
| 506 | + return $input['id']; | |
| 507 | + } | |
| 508 | + } | |
| 509 | + } | |
| 510 | 510 | } | 
| 511 | 511 | |
| 512 | 512 | return null; | 
| @@ -1,15 +1,15 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * GravityView template tags API | |
| 4 | - * | |
| 5 | - * @package GravityView | |
| 6 | - * @license GPL2+ | |
| 7 | - * @author Katz Web Services, Inc. | |
| 8 | - * @link http://gravityview.co | |
| 9 | - * @copyright Copyright 2014, Katz Web Services, Inc. | |
| 10 | - * | |
| 11 | - * @since 1.0.0 | |
| 12 | - */ | |
| 3 | + * GravityView template tags API | |
| 4 | + * | |
| 5 | + * @package GravityView | |
| 6 | + * @license GPL2+ | |
| 7 | + * @author Katz Web Services, Inc. | |
| 8 | + * @link http://gravityview.co | |
| 9 | + * @copyright Copyright 2014, Katz Web Services, Inc. | |
| 10 | + * | |
| 11 | + * @since 1.0.0 | |
| 12 | + */ | |
| 13 | 13 | |
| 14 | 14 |  class GravityView_API { | 
| 15 | 15 | |
| @@ -146,20 +146,20 @@ discard block | ||
| 146 | 146 | |
| 147 | 147 |  		if( !empty( $field['custom_class'] ) ) { | 
| 148 | 148 | |
| 149 | - $custom_class = $field['custom_class']; | |
| 149 | + $custom_class = $field['custom_class']; | |
| 150 | 150 | |
| 151 | -            if( !empty( $entry ) ) { | |
| 151 | +			if( !empty( $entry ) ) { | |
| 152 | 152 | |
| 153 | - // We want the merge tag to be formatted as a class. The merge tag may be | |
| 154 | - // replaced by a multiple-word value that should be output as a single class. | |
| 155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` | |
| 156 | -                add_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 153 | + // We want the merge tag to be formatted as a class. The merge tag may be | |
| 154 | + // replaced by a multiple-word value that should be output as a single class. | |
| 155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` | |
| 156 | +				add_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 157 | 157 | |
| 158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); | |
| 158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); | |
| 159 | 159 | |
| 160 | - // And then we want life to return to normal | |
| 161 | -                remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 162 | - } | |
| 160 | + // And then we want life to return to normal | |
| 161 | +				remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 162 | + } | |
| 163 | 163 | |
| 164 | 164 | // And now we want the spaces to be handled nicely. | 
| 165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); | 
| @@ -292,7 +292,7 @@ discard block | ||
| 292 | 292 | 'format' => $format, | 
| 293 | 293 | 'entry' => $entry, | 
| 294 | 294 |  			'field_type' => $field_type, /** {@since 1.6} */ | 
| 295 | -		    'field_path' => $field_path, /** {@since 1.16} */ | |
| 295 | +			'field_path' => $field_path, /** {@since 1.16} */ | |
| 296 | 296 | )); | 
| 297 | 297 | |
| 298 | 298 |  		if( ! empty( $field_path ) ) { | 
| @@ -603,29 +603,29 @@ discard block | ||
| 603 | 603 | return sanitize_title( $slug ); | 
| 604 | 604 | } | 
| 605 | 605 | |
| 606 | - /** | |
| 607 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta | |
| 608 | - * | |
| 609 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); | |
| 610 | - * | |
| 611 | - * @param $entry array Gravity Forms entry object | |
| 612 | - * @param $form array Gravity Forms form object | |
| 613 | - */ | |
| 614 | -    public static function entry_create_custom_slug( $entry, $form ) { | |
| 615 | - /** | |
| 616 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta | |
| 617 | - * @param boolean $custom Should we process the custom entry slug? | |
| 618 | - */ | |
| 619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); | |
| 620 | -        if( $custom ) { | |
| 621 | - // create the gravityview_unique_id and save it | |
| 606 | + /** | |
| 607 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta | |
| 608 | + * | |
| 609 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); | |
| 610 | + * | |
| 611 | + * @param $entry array Gravity Forms entry object | |
| 612 | + * @param $form array Gravity Forms form object | |
| 613 | + */ | |
| 614 | +	public static function entry_create_custom_slug( $entry, $form ) { | |
| 615 | + /** | |
| 616 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta | |
| 617 | + * @param boolean $custom Should we process the custom entry slug? | |
| 618 | + */ | |
| 619 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); | |
| 620 | +		if( $custom ) { | |
| 621 | + // create the gravityview_unique_id and save it | |
| 622 | 622 | |
| 623 | - // Get the entry hash | |
| 624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); | |
| 625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); | |
| 623 | + // Get the entry hash | |
| 624 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); | |
| 625 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); | |
| 626 | 626 | |
| 627 | - } | |
| 628 | - } | |
| 627 | + } | |
| 628 | + } | |
| 629 | 629 | |
| 630 | 630 | |
| 631 | 631 | |
| @@ -889,7 +889,7 @@ discard block | ||
| 889 | 889 | |
| 890 | 890 | // If there was an error, continue to the next term. | 
| 891 | 891 |  			if ( is_wp_error( $term_link ) ) { | 
| 892 | - continue; | |
| 892 | + continue; | |
| 893 | 893 | } | 
| 894 | 894 | |
| 895 | 895 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); | 
| @@ -214,7 +214,6 @@ discard block | ||
| 214 | 214 | * | 
| 215 | 215 | * @access public | 
| 216 | 216 | * @param array $entry | 
| 217 | - * @param array $field | |
| 218 | 217 | * @return null|string | 
| 219 | 218 | */ | 
| 220 | 219 |  	public static function field_value( $entry, $field_settings, $format = 'html' ) { | 
| @@ -1000,7 +999,7 @@ discard block | ||
| 1000 | 999 | * Get the current View ID being rendered | 
| 1001 | 1000 | * | 
| 1002 | 1001 | * @global GravityView_View $gravityview_view | 
| 1003 | - * @return string View context "directory" or "single" | |
| 1002 | + * @return integer View context "directory" or "single" | |
| 1004 | 1003 | */ | 
| 1005 | 1004 |  function gravityview_get_view_id() { | 
| 1006 | 1005 | return GravityView_View::getInstance()->getViewId(); | 
| @@ -30,29 +30,29 @@ discard block | ||
| 30 | 30 | |
| 31 | 31 | $label = ''; | 
| 32 | 32 | |
| 33 | -		if( !empty( $field['show_label'] ) || $force_show_label ) { | |
| 33 | +		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { | |
| 34 | 34 | |
| 35 | - $label = $field['label']; | |
| 35 | + $label = $field[ 'label' ]; | |
| 36 | 36 | |
| 37 | 37 | // Support Gravity Forms 1.9+ | 
| 38 | -			if( class_exists( 'GF_Field' ) ) { | |
| 38 | +			if ( class_exists( 'GF_Field' ) ) { | |
| 39 | 39 | |
| 40 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); | |
| 40 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); | |
| 41 | 41 | |
| 42 | -				if( $field_object ) { | |
| 42 | +				if ( $field_object ) { | |
| 43 | 43 | |
| 44 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); | |
| 44 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); | |
| 45 | 45 | |
| 46 | 46 | // This is a complex field, with labels on a per-input basis | 
| 47 | -					if( $input ) { | |
| 47 | +					if ( $input ) { | |
| 48 | 48 | |
| 49 | 49 | // Does the input have a custom label on a per-input basis? Otherwise, default label. | 
| 50 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; | |
| 50 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; | |
| 51 | 51 | |
| 52 | 52 |  					} else { | 
| 53 | 53 | |
| 54 | 54 | // This is a field with one label | 
| 55 | - $label = $field_object->get_field_label( true, $field['label'] ); | |
| 55 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); | |
| 56 | 56 | |
| 57 | 57 | } | 
| 58 | 58 | |
| @@ -61,9 +61,9 @@ discard block | ||
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. | 
| 64 | -			if ( !empty( $field['custom_label'] ) ) { | |
| 64 | +			if ( ! empty( $field[ 'custom_label' ] ) ) { | |
| 65 | 65 | |
| 66 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); | |
| 66 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); | |
| 67 | 67 | |
| 68 | 68 | } | 
| 69 | 69 | |
| @@ -117,11 +117,11 @@ discard block | ||
| 117 | 117 | |
| 118 | 118 | $width = NULL; | 
| 119 | 119 | |
| 120 | -		if( !empty( $field['width'] ) ) { | |
| 121 | - $width = absint( $field['width'] ); | |
| 120 | +		if ( ! empty( $field[ 'width' ] ) ) { | |
| 121 | + $width = absint( $field[ 'width' ] ); | |
| 122 | 122 | |
| 123 | 123 | // If using percentages, limit to 100% | 
| 124 | -			if( '%d%%' === $format && $width > 100 ) { | |
| 124 | +			if ( '%d%%' === $format && $width > 100 ) { | |
| 125 | 125 | $width = 100; | 
| 126 | 126 | } | 
| 127 | 127 | |
| @@ -144,39 +144,39 @@ discard block | ||
| 144 | 144 | |
| 145 | 145 | $classes = array(); | 
| 146 | 146 | |
| 147 | -		if( !empty( $field['custom_class'] ) ) { | |
| 147 | +		if ( ! empty( $field[ 'custom_class' ] ) ) { | |
| 148 | 148 | |
| 149 | - $custom_class = $field['custom_class']; | |
| 149 | + $custom_class = $field[ 'custom_class' ]; | |
| 150 | 150 | |
| 151 | -            if( !empty( $entry ) ) { | |
| 151 | +            if ( ! empty( $entry ) ) { | |
| 152 | 152 | |
| 153 | 153 | // We want the merge tag to be formatted as a class. The merge tag may be | 
| 154 | 154 | // replaced by a multiple-word value that should be output as a single class. | 
| 155 | 155 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` | 
| 156 | -                add_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 156 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); | |
| 157 | 157 | |
| 158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); | |
| 158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); | |
| 159 | 159 | |
| 160 | 160 | // And then we want life to return to normal | 
| 161 | -                remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); | |
| 161 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); | |
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | 164 | // And now we want the spaces to be handled nicely. | 
| 165 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); | |
| 165 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); | |
| 166 | 166 | |
| 167 | 167 | } | 
| 168 | 168 | |
| 169 | -		if(!empty($field['id'])) { | |
| 170 | -			if( !empty( $form ) && !empty( $form['id'] ) ) { | |
| 171 | - $form_id = '-'.$form['id']; | |
| 169 | +		if ( ! empty( $field[ 'id' ] ) ) { | |
| 170 | +			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { | |
| 171 | + $form_id = '-' . $form[ 'id' ]; | |
| 172 | 172 |  			} else { | 
| 173 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; | |
| 173 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; | |
| 174 | 174 | } | 
| 175 | 175 | |
| 176 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; | |
| 176 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | -		return esc_attr(implode(' ', $classes)); | |
| 179 | + return esc_attr( implode( ' ', $classes ) ); | |
| 180 | 180 | } | 
| 181 | 181 | |
| 182 | 182 | /** | 
| @@ -193,16 +193,16 @@ discard block | ||
| 193 | 193 | */ | 
| 194 | 194 |  	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { | 
| 195 | 195 | $gravityview_view = GravityView_View::getInstance(); | 
| 196 | - $id = $field['id']; | |
| 196 | + $id = $field[ 'id' ]; | |
| 197 | 197 | |
| 198 | 198 |  		if ( ! empty( $id ) ) { | 
| 199 | -			if ( ! empty( $form ) && ! empty( $form['id'] ) ) { | |
| 200 | - $form_id = '-' . $form['id']; | |
| 199 | +			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { | |
| 200 | + $form_id = '-' . $form[ 'id' ]; | |
| 201 | 201 |  			} else { | 
| 202 | 202 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; | 
| 203 | 203 | } | 
| 204 | 204 | |
| 205 | - $id = 'gv-field' . $form_id . '-' . $field['id']; | |
| 205 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; | |
| 206 | 206 | } | 
| 207 | 207 | |
| 208 | 208 | return esc_attr( $id ); | 
| @@ -219,20 +219,20 @@ discard block | ||
| 219 | 219 | */ | 
| 220 | 220 |  	public static function field_value( $entry, $field_settings, $format = 'html' ) { | 
| 221 | 221 | |
| 222 | -		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { | |
| 222 | +		if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { | |
| 223 | 223 | return NULL; | 
| 224 | 224 | } | 
| 225 | 225 | |
| 226 | 226 | $gravityview_view = GravityView_View::getInstance(); | 
| 227 | 227 | |
| 228 | - $field_id = $field_settings['id']; | |
| 228 | + $field_id = $field_settings[ 'id' ]; | |
| 229 | 229 | $form = $gravityview_view->getForm(); | 
| 230 | 230 | $field = gravityview_get_field( $form, $field_id ); | 
| 231 | 231 | |
| 232 | 232 | // Prevent any PHP warnings that may be generated | 
| 233 | 233 | ob_start(); | 
| 234 | 234 | |
| 235 | -		if( $field && is_numeric( $field_id ) ) { | |
| 235 | +		if ( $field && is_numeric( $field_id ) ) { | |
| 236 | 236 | // Used as file name of field template in GV. | 
| 237 | 237 | // Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field | 
| 238 | 238 | $field_type = $field->type; | 
| @@ -243,8 +243,8 @@ discard block | ||
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | 245 | // If a Gravity Forms Field is found, get the field display | 
| 246 | -		if( $field ) { | |
| 247 | - $display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format ); | |
| 246 | +		if ( $field ) { | |
| 247 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); | |
| 248 | 248 | |
| 249 | 249 |  			if ( $errors = ob_get_clean() ) { | 
| 250 | 250 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); | 
| @@ -253,7 +253,7 @@ discard block | ||
| 253 | 253 | $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); | 
| 254 | 254 | |
| 255 | 255 | // prevent the use of merge_tags for non-admin fields | 
| 256 | -			if( !empty( $field->adminOnly ) ) { | |
| 256 | +			if ( ! empty( $field->adminOnly ) ) { | |
| 257 | 257 | $display_value = self::replace_variables( $display_value, $form, $entry ); | 
| 258 | 258 | } | 
| 259 | 259 |  		} else { | 
| @@ -263,7 +263,7 @@ discard block | ||
| 263 | 263 | |
| 264 | 264 |  		// Check whether the field exists in /includes/fields/{$field_type}.php | 
| 265 | 265 | // This can be overridden by user template files. | 
| 266 | -		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); | |
| 266 | +		$field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); | |
| 267 | 267 | |
| 268 | 268 | // Set the field data to be available in the templates | 
| 269 | 269 | $gravityview_view->setCurrentField( array( | 
| @@ -277,11 +277,11 @@ discard block | ||
| 277 | 277 | 'entry' => $entry, | 
| 278 | 278 |  			'field_type' => $field_type, /** {@since 1.6} */ | 
| 279 | 279 |  		    'field_path' => $field_path, /** {@since 1.16} */ | 
| 280 | - )); | |
| 280 | + ) ); | |
| 281 | 281 | |
| 282 | -		if( ! empty( $field_path ) ) { | |
| 282 | +		if ( ! empty( $field_path ) ) { | |
| 283 | 283 | |
| 284 | -			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); | |
| 284 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); | |
| 285 | 285 | |
| 286 | 286 | ob_start(); | 
| 287 | 287 | |
| @@ -297,7 +297,7 @@ discard block | ||
| 297 | 297 | } | 
| 298 | 298 | |
| 299 | 299 | // Get the field settings again so that the field template can override the settings | 
| 300 | -		$field_settings = $gravityview_view->getCurrentField('field_settings'); | |
| 300 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); | |
| 301 | 301 | |
| 302 | 302 | /** | 
| 303 | 303 |  		 * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link` | 
| @@ -315,9 +315,9 @@ discard block | ||
| 315 | 315 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. | 
| 316 | 316 | * | 
| 317 | 317 | */ | 
| 318 | -		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { | |
| 318 | +		if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { | |
| 319 | 319 | |
| 320 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); | |
| 320 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); | |
| 321 | 321 | |
| 322 | 322 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); | 
| 323 | 323 | |
| @@ -331,7 +331,7 @@ discard block | ||
| 331 | 331 | * @param array $field_settings Settings for the particular GV field | 
| 332 | 332 | * @param array $field Current field being displayed | 
| 333 | 333 | */ | 
| 334 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); | |
| 334 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); | |
| 335 | 335 | |
| 336 | 336 | /** | 
| 337 | 337 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types | 
| @@ -360,14 +360,14 @@ discard block | ||
| 360 | 360 | */ | 
| 361 | 361 |  	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { | 
| 362 | 362 | |
| 363 | -		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { | |
| 363 | +		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { | |
| 364 | 364 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); | 
| 365 | 365 | return NULL; | 
| 366 | 366 | } | 
| 367 | 367 | |
| 368 | 368 | $href = self::entry_link( $entry ); | 
| 369 | 369 | |
| 370 | -		if( '' === $href ) { | |
| 370 | +		if ( '' === $href ) { | |
| 371 | 371 | return NULL; | 
| 372 | 372 | } | 
| 373 | 373 | |
| @@ -390,19 +390,19 @@ discard block | ||
| 390 | 390 | * @param boolean $wpautop Apply wpautop() to the output? | 
| 391 | 391 | * @return string HTML of "no results" text | 
| 392 | 392 | */ | 
| 393 | -	public static function no_results($wpautop = true) { | |
| 393 | +	public static function no_results( $wpautop = true ) { | |
| 394 | 394 | $gravityview_view = GravityView_View::getInstance(); | 
| 395 | 395 | |
| 396 | 396 | $is_search = false; | 
| 397 | 397 | |
| 398 | -		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { | |
| 398 | +		if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { | |
| 399 | 399 | $is_search = true; | 
| 400 | 400 | } | 
| 401 | 401 | |
| 402 | -		if($is_search) { | |
| 403 | -			$output = __('This search returned no results.', 'gravityview'); | |
| 402 | +		if ( $is_search ) { | |
| 403 | + $output = __( 'This search returned no results.', 'gravityview' ); | |
| 404 | 404 |  		} else { | 
| 405 | -			$output = __('No entries match your request.', 'gravityview'); | |
| 405 | + $output = __( 'No entries match your request.', 'gravityview' ); | |
| 406 | 406 | } | 
| 407 | 407 | |
| 408 | 408 | /** | 
| @@ -410,9 +410,9 @@ discard block | ||
| 410 | 410 | * @param string $output The existing "No Entries" text | 
| 411 | 411 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? | 
| 412 | 412 | */ | 
| 413 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); | |
| 413 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); | |
| 414 | 414 | |
| 415 | - return $wpautop ? wpautop($output) : $output; | |
| 415 | + return $wpautop ? wpautop( $output ) : $output; | |
| 416 | 416 | } | 
| 417 | 417 | |
| 418 | 418 | /** | 
| @@ -429,37 +429,37 @@ discard block | ||
| 429 | 429 | |
| 430 | 430 | $gravityview_view = GravityView_View::getInstance(); | 
| 431 | 431 | |
| 432 | -		if( empty( $post_id ) ) { | |
| 432 | +		if ( empty( $post_id ) ) { | |
| 433 | 433 | |
| 434 | 434 | $post_id = false; | 
| 435 | 435 | |
| 436 | 436 | // DataTables passes the Post ID | 
| 437 | -			if( defined('DOING_AJAX') && DOING_AJAX ) { | |
| 437 | +			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { | |
| 438 | 438 | |
| 439 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; | |
| 439 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; | |
| 440 | 440 | |
| 441 | 441 |  			} else { | 
| 442 | 442 | |
| 443 | 443 | // The Post ID has been passed via the shortcode | 
| 444 | -				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { | |
| 444 | +				if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { | |
| 445 | 445 | |
| 446 | 446 | $post_id = $gravityview_view->getPostId(); | 
| 447 | 447 | |
| 448 | 448 |  				} else { | 
| 449 | 449 | |
| 450 | 450 | // This is a GravityView post type | 
| 451 | -					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { | |
| 451 | +					if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { | |
| 452 | 452 | |
| 453 | 453 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; | 
| 454 | 454 | |
| 455 | 455 |  					} else { | 
| 456 | 456 | |
| 457 | 457 | // This is an embedded GravityView; use the embedded post's ID as the base. | 
| 458 | -						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { | |
| 458 | +						if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { | |
| 459 | 459 | |
| 460 | 460 | $post_id = $post->ID; | 
| 461 | 461 | |
| 462 | -						} elseif( $gravityview_view->getViewId() ) { | |
| 462 | +						} elseif ( $gravityview_view->getViewId() ) { | |
| 463 | 463 | |
| 464 | 464 | // The GravityView has been embedded in a widget or in a template, and | 
| 465 | 465 | // is not in the current content. Thus, we defer to the View's own ID. | 
| @@ -474,36 +474,36 @@ discard block | ||
| 474 | 474 | } | 
| 475 | 475 | |
| 476 | 476 | // No post ID, get outta here. | 
| 477 | -		if( empty( $post_id ) ) { | |
| 477 | +		if ( empty( $post_id ) ) { | |
| 478 | 478 | return NULL; | 
| 479 | 479 | } | 
| 480 | 480 | |
| 481 | 481 | // If we've saved the permalink in memory, use it | 
| 482 | 482 | // @since 1.3 | 
| 483 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); | |
| 483 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); | |
| 484 | 484 | |
| 485 | -		if( empty( $link ) ) { | |
| 485 | +		if ( empty( $link ) ) { | |
| 486 | 486 | |
| 487 | 487 | $link = get_permalink( $post_id ); | 
| 488 | 488 | |
| 489 | 489 | // If not yet saved, cache the permalink. | 
| 490 | 490 | // @since 1.3 | 
| 491 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); | |
| 491 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); | |
| 492 | 492 | |
| 493 | 493 | } | 
| 494 | 494 | |
| 495 | 495 | // Deal with returning to proper pagination for embedded views | 
| 496 | -		if( $link && $add_query_args ) { | |
| 496 | +		if ( $link && $add_query_args ) { | |
| 497 | 497 | |
| 498 | 498 | $args = array(); | 
| 499 | 499 | |
| 500 | -			if( $pagenum = rgget('pagenum') ) { | |
| 501 | - $args['pagenum'] = intval( $pagenum ); | |
| 500 | +			if ( $pagenum = rgget( 'pagenum' ) ) { | |
| 501 | + $args[ 'pagenum' ] = intval( $pagenum ); | |
| 502 | 502 | } | 
| 503 | 503 | |
| 504 | -			if( $sort = rgget('sort') ) { | |
| 505 | - $args['sort'] = $sort; | |
| 506 | -				$args['dir'] = rgget('dir'); | |
| 504 | +			if ( $sort = rgget( 'sort' ) ) { | |
| 505 | + $args[ 'sort' ] = $sort; | |
| 506 | + $args[ 'dir' ] = rgget( 'dir' ); | |
| 507 | 507 | } | 
| 508 | 508 | |
| 509 | 509 | $link = add_query_arg( $args, $link ); | 
| @@ -526,7 +526,7 @@ discard block | ||
| 526 | 526 |  	private static function get_custom_entry_slug( $id, $entry = array() ) { | 
| 527 | 527 | |
| 528 | 528 | // Generate an unique hash to use as the default value | 
| 529 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); | |
| 529 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); | |
| 530 | 530 | |
| 531 | 531 | /** | 
| 532 | 532 |  		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` | 
| @@ -537,7 +537,7 @@ discard block | ||
| 537 | 537 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); | 
| 538 | 538 | |
| 539 | 539 | // Make sure we have something - use the original ID as backup. | 
| 540 | -		if( empty( $slug ) ) { | |
| 540 | +		if ( empty( $slug ) ) { | |
| 541 | 541 | $slug = $id; | 
| 542 | 542 | } | 
| 543 | 543 | |
| @@ -566,7 +566,7 @@ discard block | ||
| 566 | 566 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. | 
| 567 | 567 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) | 
| 568 | 568 | */ | 
| 569 | -		$custom = apply_filters('gravityview_custom_entry_slug', false ); | |
| 569 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); | |
| 570 | 570 | |
| 571 | 571 | // If we're using custom slug... | 
| 572 | 572 |  		if ( $custom ) { | 
| @@ -580,7 +580,7 @@ discard block | ||
| 580 | 580 | // If it does have a hash set, and the hash is expected, use it. | 
| 581 | 581 | // This check allows users to change the hash structure using the | 
| 582 | 582 | // gravityview_entry_hash filter and have the old hashes expire. | 
| 583 | -			if( empty( $value ) || $value !== $hash ) { | |
| 583 | +			if ( empty( $value ) || $value !== $hash ) { | |
| 584 | 584 | |
| 585 | 585 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); | 
| 586 | 586 | |
| @@ -608,12 +608,12 @@ discard block | ||
| 608 | 608 | * @param boolean $custom Should we process the custom entry slug? | 
| 609 | 609 | */ | 
| 610 | 610 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); | 
| 611 | -        if( $custom ) { | |
| 611 | +        if ( $custom ) { | |
| 612 | 612 | // create the gravityview_unique_id and save it | 
| 613 | 613 | |
| 614 | 614 | // Get the entry hash | 
| 615 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); | |
| 616 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); | |
| 615 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); | |
| 616 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); | |
| 617 | 617 | |
| 618 | 618 | } | 
| 619 | 619 | } | 
| @@ -630,14 +630,14 @@ discard block | ||
| 630 | 630 | */ | 
| 631 | 631 |  	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { | 
| 632 | 632 | |
| 633 | -		if( ! empty( $entry ) && ! is_array( $entry ) ) { | |
| 633 | +		if ( ! empty( $entry ) && ! is_array( $entry ) ) { | |
| 634 | 634 | $entry = GVCommon::get_entry( $entry ); | 
| 635 | -		} else if( empty( $entry ) ) { | |
| 635 | +		} else if ( empty( $entry ) ) { | |
| 636 | 636 | $entry = GravityView_frontend::getInstance()->getEntry(); | 
| 637 | 637 | } | 
| 638 | 638 | |
| 639 | 639 | // Second parameter used to be passed as $field; this makes sure it's not an array | 
| 640 | -		if( !is_numeric( $post_id ) ) { | |
| 640 | +		if ( ! is_numeric( $post_id ) ) { | |
| 641 | 641 | $post_id = NULL; | 
| 642 | 642 | } | 
| 643 | 643 | |
| @@ -645,19 +645,19 @@ discard block | ||
| 645 | 645 | $directory_link = self::directory_link( $post_id, false ); | 
| 646 | 646 | |
| 647 | 647 | // No post ID? Get outta here. | 
| 648 | -		if( empty( $directory_link ) ) { | |
| 648 | +		if ( empty( $directory_link ) ) { | |
| 649 | 649 | return ''; | 
| 650 | 650 | } | 
| 651 | 651 | |
| 652 | 652 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); | 
| 653 | 653 | |
| 654 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); | |
| 654 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); | |
| 655 | 655 | |
| 656 | -		if( get_option('permalink_structure') && !is_preview() ) { | |
| 656 | +		if ( get_option( 'permalink_structure' ) && ! is_preview() ) { | |
| 657 | 657 | |
| 658 | 658 | $args = array(); | 
| 659 | 659 | |
| 660 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; | |
| 660 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; | |
| 661 | 661 | |
| 662 | 662 |  		} else { | 
| 663 | 663 | |
| @@ -667,18 +667,18 @@ discard block | ||
| 667 | 667 | /** | 
| 668 | 668 | * @since 1.7.3 | 
| 669 | 669 | */ | 
| 670 | -		if( $add_directory_args ) { | |
| 670 | +		if ( $add_directory_args ) { | |
| 671 | 671 | |
| 672 | -			if( !empty( $_GET['pagenum'] ) ) { | |
| 673 | - $args['pagenum'] = intval( $_GET['pagenum'] ); | |
| 672 | +			if ( ! empty( $_GET[ 'pagenum' ] ) ) { | |
| 673 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); | |
| 674 | 674 | } | 
| 675 | 675 | |
| 676 | 676 | /** | 
| 677 | 677 | * @since 1.7 | 
| 678 | 678 | */ | 
| 679 | -			if( $sort = rgget('sort') ) { | |
| 680 | - $args['sort'] = $sort; | |
| 681 | -				$args['dir'] = rgget('dir'); | |
| 679 | +			if ( $sort = rgget( 'sort' ) ) { | |
| 680 | + $args[ 'sort' ] = $sort; | |
| 681 | + $args[ 'dir' ] = rgget( 'dir' ); | |
| 682 | 682 | } | 
| 683 | 683 | |
| 684 | 684 | } | 
| @@ -688,8 +688,8 @@ discard block | ||
| 688 | 688 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view | 
| 689 | 689 | * @see GravityView_frontend::get_context_view_id() | 
| 690 | 690 | */ | 
| 691 | -		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { | |
| 692 | - $args['gvid'] = gravityview_get_view_id(); | |
| 691 | +		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { | |
| 692 | + $args[ 'gvid' ] = gravityview_get_view_id(); | |
| 693 | 693 | } | 
| 694 | 694 | |
| 695 | 695 | return add_query_arg( $args, $directory_link ); | 
| @@ -707,7 +707,7 @@ discard block | ||
| 707 | 707 | } | 
| 708 | 708 | |
| 709 | 709 |  function gv_class( $field, $form = NULL, $entry = array() ) { | 
| 710 | - return GravityView_API::field_class( $field, $form, $entry ); | |
| 710 | + return GravityView_API::field_class( $field, $form, $entry ); | |
| 711 | 711 | } | 
| 712 | 712 | |
| 713 | 713 | /** | 
| @@ -729,15 +729,15 @@ discard block | ||
| 729 | 729 | |
| 730 | 730 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; | 
| 731 | 731 | |
| 732 | -	if( GravityView_View::getInstance()->isHideUntilSearched() ) { | |
| 732 | +	if ( GravityView_View::getInstance()->isHideUntilSearched() ) { | |
| 733 | 733 | $default_css_class .= ' hidden'; | 
| 734 | 734 | } | 
| 735 | 735 | |
| 736 | -	if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { | |
| 736 | +	if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { | |
| 737 | 737 | $default_css_class .= ' gv-container-no-results'; | 
| 738 | 738 | } | 
| 739 | 739 | |
| 740 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); | |
| 740 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); | |
| 741 | 741 | |
| 742 | 742 | /** | 
| 743 | 743 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View | 
| @@ -748,7 +748,7 @@ discard block | ||
| 748 | 748 | |
| 749 | 749 | $css_class = gravityview_sanitize_html_class( $css_class ); | 
| 750 | 750 | |
| 751 | -	if( $echo ) { | |
| 751 | +	if ( $echo ) { | |
| 752 | 752 | echo $css_class; | 
| 753 | 753 | } | 
| 754 | 754 | |
| @@ -759,7 +759,7 @@ discard block | ||
| 759 | 759 | |
| 760 | 760 | $value = GravityView_API::field_value( $entry, $field ); | 
| 761 | 761 | |
| 762 | -	if( $value === '' ) { | |
| 762 | +	if ( $value === '' ) { | |
| 763 | 763 | /** | 
| 764 | 764 | * @filter `gravityview_empty_value` What to display when a field is empty | 
| 765 | 765 | * @param string $value (empty string) | 
| @@ -778,7 +778,7 @@ discard block | ||
| 778 | 778 | return GravityView_API::entry_link( $entry, $post_id ); | 
| 779 | 779 | } | 
| 780 | 780 | |
| 781 | -function gv_no_results($wpautop = true) { | |
| 781 | +function gv_no_results( $wpautop = true ) { | |
| 782 | 782 | return GravityView_API::no_results( $wpautop ); | 
| 783 | 783 | } | 
| 784 | 784 | |
| @@ -791,7 +791,7 @@ discard block | ||
| 791 | 791 | |
| 792 | 792 | $href = gv_directory_link(); | 
| 793 | 793 | |
| 794 | -	if( empty( $href ) ) { return NULL; } | |
| 794 | +	if ( empty( $href ) ) { return NULL; } | |
| 795 | 795 | |
| 796 | 796 | // calculate link label | 
| 797 | 797 | $gravityview_view = GravityView_View::getInstance(); | 
| @@ -807,7 +807,7 @@ discard block | ||
| 807 | 807 | |
| 808 | 808 | $link = gravityview_get_link( $href, esc_html( $label ), array( | 
| 809 | 809 | 'data-viewid' => $gravityview_view->getViewId() | 
| 810 | - )); | |
| 810 | + ) ); | |
| 811 | 811 | |
| 812 | 812 | return $link; | 
| 813 | 813 | } | 
| @@ -826,7 +826,7 @@ discard block | ||
| 826 | 826 | */ | 
| 827 | 827 |  function gravityview_get_field_value( $entry, $field_id, $display_value ) { | 
| 828 | 828 | |
| 829 | -	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { | |
| 829 | +	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { | |
| 830 | 830 | |
| 831 | 831 | // For the complete field value as generated by Gravity Forms | 
| 832 | 832 | return $display_value; | 
| @@ -856,16 +856,16 @@ discard block | ||
| 856 | 856 | |
| 857 | 857 | $terms = explode( ', ', $value ); | 
| 858 | 858 | |
| 859 | -	foreach ($terms as $term_name ) { | |
| 859 | +	foreach ( $terms as $term_name ) { | |
| 860 | 860 | |
| 861 | 861 | // If we're processing a category, | 
| 862 | -		if( $taxonomy === 'category' ) { | |
| 862 | +		if ( $taxonomy === 'category' ) { | |
| 863 | 863 | |
| 864 | 864 | // Use rgexplode to prevent errors if : doesn't exist | 
| 865 | 865 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); | 
| 866 | 866 | |
| 867 | 867 | // The explode was succesful; we have the category ID | 
| 868 | -			if( !empty( $term_id )) { | |
| 868 | +			if ( ! empty( $term_id ) ) { | |
| 869 | 869 | $term = get_term_by( 'id', $term_id, $taxonomy ); | 
| 870 | 870 |  			} else { | 
| 871 | 871 | // We have to fall back to the name | 
| @@ -878,7 +878,7 @@ discard block | ||
| 878 | 878 | } | 
| 879 | 879 | |
| 880 | 880 | // There's still a tag/category here. | 
| 881 | -		if( $term ) { | |
| 881 | +		if ( $term ) { | |
| 882 | 882 | |
| 883 | 883 | $term_link = get_term_link( $term, $taxonomy ); | 
| 884 | 884 | |
| @@ -887,11 +887,11 @@ discard block | ||
| 887 | 887 | continue; | 
| 888 | 888 | } | 
| 889 | 889 | |
| 890 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); | |
| 890 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); | |
| 891 | 891 | } | 
| 892 | 892 | } | 
| 893 | 893 | |
| 894 | -	return implode(', ', $output ); | |
| 894 | + return implode( ', ', $output ); | |
| 895 | 895 | } | 
| 896 | 896 | |
| 897 | 897 | /** | 
| @@ -905,8 +905,8 @@ discard block | ||
| 905 | 905 | |
| 906 | 906 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); | 
| 907 | 907 | |
| 908 | -	if( empty( $link ) ) { | |
| 909 | - return strip_tags( $output); | |
| 908 | +	if ( empty( $link ) ) { | |
| 909 | + return strip_tags( $output ); | |
| 910 | 910 | } | 
| 911 | 911 | |
| 912 | 912 | return $output; | 
| @@ -925,7 +925,7 @@ discard block | ||
| 925 | 925 | $fe = GravityView_frontend::getInstance(); | 
| 926 | 926 | |
| 927 | 927 | // Solve problem when loading content via admin-ajax.php | 
| 928 | -	if( ! $fe->getGvOutputData() ) { | |
| 928 | +	if ( ! $fe->getGvOutputData() ) { | |
| 929 | 929 | |
| 930 | 930 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); | 
| 931 | 931 | |
| @@ -933,7 +933,7 @@ discard block | ||
| 933 | 933 | } | 
| 934 | 934 | |
| 935 | 935 | // Make 100% sure that we're dealing with a properly called situation | 
| 936 | -	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { | |
| 936 | +	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { | |
| 937 | 937 | |
| 938 | 938 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); | 
| 939 | 939 | |
| @@ -953,10 +953,10 @@ discard block | ||
| 953 | 953 | |
| 954 | 954 | $fe = GravityView_frontend::getInstance(); | 
| 955 | 955 | |
| 956 | -	if( ! $fe->getGvOutputData() ) { return array(); } | |
| 956 | +	if ( ! $fe->getGvOutputData() ) { return array(); } | |
| 957 | 957 | |
| 958 | 958 | // If not set, grab the current view ID | 
| 959 | -	if( empty( $view_id ) ) { | |
| 959 | +	if ( empty( $view_id ) ) { | |
| 960 | 960 | $view_id = $fe->get_context_view_id(); | 
| 961 | 961 | } | 
| 962 | 962 | |
| @@ -1021,11 +1021,11 @@ discard block | ||
| 1021 | 1021 | */ | 
| 1022 | 1022 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); | 
| 1023 | 1023 | |
| 1024 | -	if( $is_edit_entry ) { | |
| 1024 | +	if ( $is_edit_entry ) { | |
| 1025 | 1025 | $context = 'edit'; | 
| 1026 | -	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { | |
| 1026 | +	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { | |
| 1027 | 1027 | $context = 'single'; | 
| 1028 | -	} else if( class_exists( 'GravityView_View' ) ) { | |
| 1028 | +	} else if ( class_exists( 'GravityView_View' ) ) { | |
| 1029 | 1029 | $context = GravityView_View::getInstance()->getContext(); | 
| 1030 | 1030 | } | 
| 1031 | 1031 | |
| @@ -1053,12 +1053,12 @@ discard block | ||
| 1053 | 1053 |  function gravityview_get_files_array( $value, $gv_class = '' ) { | 
| 1054 | 1054 | /** @define "GRAVITYVIEW_DIR" "../" */ | 
| 1055 | 1055 | |
| 1056 | -	if( !class_exists( 'GravityView_Field' ) ) { | |
| 1057 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); | |
| 1056 | +	if ( ! class_exists( 'GravityView_Field' ) ) { | |
| 1057 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); | |
| 1058 | 1058 | } | 
| 1059 | 1059 | |
| 1060 | -	if( !class_exists( 'GravityView_Field_FileUpload' ) ) { | |
| 1061 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); | |
| 1060 | +	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { | |
| 1061 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); | |
| 1062 | 1062 | } | 
| 1063 | 1063 | |
| 1064 | 1064 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); | 
| @@ -1136,12 +1136,12 @@ discard block | ||
| 1136 | 1136 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); | 
| 1137 | 1137 | |
| 1138 | 1138 | // Required fields. | 
| 1139 | -	if ( empty( $args['field'] ) || empty( $args['form'] ) ) { | |
| 1139 | +	if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { | |
| 1140 | 1140 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); | 
| 1141 | 1141 | return ''; | 
| 1142 | 1142 | } | 
| 1143 | 1143 | |
| 1144 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; | |
| 1144 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; | |
| 1145 | 1145 | |
| 1146 | 1146 | /** | 
| 1147 | 1147 | * Create the content variables for replacing. | 
| @@ -1157,37 +1157,37 @@ discard block | ||
| 1157 | 1157 | 'field_id' => '', | 
| 1158 | 1158 | ); | 
| 1159 | 1159 | |
| 1160 | - $context['value'] = gv_value( $entry, $args['field'] ); | |
| 1160 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); | |
| 1161 | 1161 | |
| 1162 | 1162 | // If the value is empty and we're hiding empty, return empty. | 
| 1163 | -	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { | |
| 1163 | +	if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { | |
| 1164 | 1164 | return ''; | 
| 1165 | 1165 | } | 
| 1166 | 1166 | |
| 1167 | -	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { | |
| 1168 | - $context['value'] = wpautop( $context['value'] ); | |
| 1167 | +	if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { | |
| 1168 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); | |
| 1169 | 1169 | } | 
| 1170 | 1170 | |
| 1171 | 1171 | // Get width setting, if exists | 
| 1172 | - $context['width'] = GravityView_API::field_width( $args['field'] ); | |
| 1172 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); | |
| 1173 | 1173 | |
| 1174 | 1174 | // If replacing with CSS inline formatting, let's do it. | 
| 1175 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); | |
| 1175 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); | |
| 1176 | 1176 | |
| 1177 | 1177 | // Grab the Class using `gv_class` | 
| 1178 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); | |
| 1179 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); | |
| 1178 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); | |
| 1179 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); | |
| 1180 | 1180 | |
| 1181 | 1181 | // Get field label if needed | 
| 1182 | -	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { | |
| 1183 | -		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); | |
| 1182 | +	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { | |
| 1183 | +		$context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); | |
| 1184 | 1184 | } | 
| 1185 | 1185 | |
| 1186 | 1186 | // Default Label value | 
| 1187 | - $context['label_value'] = gv_label( $args['field'], $entry ); | |
| 1187 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); | |
| 1188 | 1188 | |
| 1189 | -	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ | |
| 1190 | -		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; | |
| 1189 | +	if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { | |
| 1190 | +		$context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; | |
| 1191 | 1191 | } | 
| 1192 | 1192 | |
| 1193 | 1193 | /** | 
| @@ -1196,7 +1196,7 @@ discard block | ||
| 1196 | 1196 | * @param string $markup The HTML for the markup | 
| 1197 | 1197 | * @param array $args All args for the field output | 
| 1198 | 1198 | */ | 
| 1199 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); | |
| 1199 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); | |
| 1200 | 1200 | |
| 1201 | 1201 | /** | 
| 1202 | 1202 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders | 
| @@ -1219,7 +1219,7 @@ discard block | ||
| 1219 | 1219 |  	foreach ( $context as $tag => $value ) { | 
| 1220 | 1220 | |
| 1221 | 1221 | // If the tag doesn't exist just skip it | 
| 1222 | -		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ | |
| 1222 | +		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { | |
| 1223 | 1223 | continue; | 
| 1224 | 1224 | } | 
| 1225 | 1225 | |
| @@ -1,13 +1,13 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * The GravityView New Search widget | |
| 4 | - * | |
| 5 | - * @package GravityView-DataTables-Ext | |
| 6 | - * @license GPL2+ | |
| 7 | - * @author Katz Web Services, Inc. | |
| 8 | - * @link http://gravityview.co | |
| 9 | - * @copyright Copyright 2014, Katz Web Services, Inc. | |
| 10 | - */ | |
| 3 | + * The GravityView New Search widget | |
| 4 | + * | |
| 5 | + * @package GravityView-DataTables-Ext | |
| 6 | + * @license GPL2+ | |
| 7 | + * @author Katz Web Services, Inc. | |
| 8 | + * @link http://gravityview.co | |
| 9 | + * @copyright Copyright 2014, Katz Web Services, Inc. | |
| 10 | + */ | |
| 11 | 11 | |
| 12 | 12 |  if ( ! defined( 'WPINC' ) ) { | 
| 13 | 13 | die; | 
| @@ -385,14 +385,14 @@ discard block | ||
| 385 | 385 | $curr_start = esc_attr( rgget( 'gv_start' ) ); | 
| 386 | 386 | $curr_end = esc_attr( rgget( 'gv_end' ) ); | 
| 387 | 387 | |
| 388 | - /** | |
| 389 | - * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n | |
| 390 | - * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) | |
| 391 | - * @since 1.12 | |
| 392 | - * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true | |
| 393 | - * @param[in] string $context Where the filter is being called from. `search` in this case. | |
| 394 | - */ | |
| 395 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); | |
| 388 | + /** | |
| 389 | + * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n | |
| 390 | + * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) | |
| 391 | + * @since 1.12 | |
| 392 | + * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true | |
| 393 | + * @param[in] string $context Where the filter is being called from. `search` in this case. | |
| 394 | + */ | |
| 395 | + $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); | |
| 396 | 396 | |
| 397 | 397 | |
| 398 | 398 | /** | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | 'type' => 'radio', | 
| 64 | 64 | 'full_width' => true, | 
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), | 
| 66 | -				'desc' => __('Should search results match all search fields, or any?', 'gravityview'), | |
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), | |
| 67 | 67 | 'value' => 'any', | 
| 68 | 68 | 'class' => 'hide-if-js', | 
| 69 | 69 | 'options' => array( | 
| @@ -148,7 +148,7 @@ discard block | ||
| 148 | 148 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | 
| 149 | 149 | $script_source = empty( $script_min ) ? '/source' : ''; | 
| 150 | 150 | |
| 151 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); | |
| 151 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); | |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | /** | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | * Add admin script to the whitelist | 
| 201 | 201 | */ | 
| 202 | 202 |  	public function register_no_conflict( $required ) { | 
| 203 | - $required[] = 'gravityview_searchwidget_admin'; | |
| 203 | + $required[ ] = 'gravityview_searchwidget_admin'; | |
| 204 | 204 | return $required; | 
| 205 | 205 | } | 
| 206 | 206 | |
| @@ -213,24 +213,24 @@ discard block | ||
| 213 | 213 | */ | 
| 214 | 214 |  	public static function get_searchable_fields() { | 
| 215 | 215 | |
| 216 | -		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { | |
| 216 | +		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { | |
| 217 | 217 | exit( '0' ); | 
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | 220 | $form = ''; | 
| 221 | 221 | |
| 222 | 222 | // Fetch the form for the current View | 
| 223 | -		if ( ! empty( $_POST['view_id'] ) ) { | |
| 223 | +		if ( ! empty( $_POST[ 'view_id' ] ) ) { | |
| 224 | 224 | |
| 225 | - $form = gravityview_get_form_id( $_POST['view_id'] ); | |
| 225 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); | |
| 226 | 226 | |
| 227 | -		} elseif ( ! empty( $_POST['formid'] ) ) { | |
| 227 | +		} elseif ( ! empty( $_POST[ 'formid' ] ) ) { | |
| 228 | 228 | |
| 229 | - $form = (int) $_POST['formid']; | |
| 229 | + $form = (int)$_POST[ 'formid' ]; | |
| 230 | 230 | |
| 231 | -		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { | |
| 231 | +		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { | |
| 232 | 232 | |
| 233 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); | |
| 233 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); | |
| 234 | 234 | |
| 235 | 235 | } | 
| 236 | 236 | |
| @@ -278,8 +278,8 @@ discard block | ||
| 278 | 278 | ) | 
| 279 | 279 | ); | 
| 280 | 280 | |
| 281 | -		foreach( $custom_fields as $custom_field_key => $custom_field ) { | |
| 282 | -			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); | |
| 281 | +		foreach ( $custom_fields as $custom_field_key => $custom_field ) { | |
| 282 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); | |
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | 285 |  		if ( ! empty( $fields ) ) { | 
| @@ -288,13 +288,13 @@ discard block | ||
| 288 | 288 | |
| 289 | 289 |  			foreach ( $fields as $id => $field ) { | 
| 290 | 290 | |
| 291 | -				if ( in_array( $field['type'], $blacklist_field_types ) ) { | |
| 291 | +				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { | |
| 292 | 292 | continue; | 
| 293 | 293 | } | 
| 294 | 294 | |
| 295 | - $types = self::get_search_input_types( $id, $field['type'] ); | |
| 295 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); | |
| 296 | 296 | |
| 297 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; | |
| 297 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; | |
| 298 | 298 | } | 
| 299 | 299 | } | 
| 300 | 300 | |
| @@ -316,7 +316,7 @@ discard block | ||
| 316 | 316 |  	public static function get_search_input_types( $id = '', $field_type = null ) { | 
| 317 | 317 | |
| 318 | 318 | // @todo - This needs to be improved - many fields have . including products and addresses | 
| 319 | -		if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { | |
| 319 | +		if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { | |
| 320 | 320 | $input_type = 'boolean'; // on/off checkbox | 
| 321 | 321 |  		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { | 
| 322 | 322 | $input_type = 'multi'; //multiselect | 
| @@ -358,19 +358,19 @@ discard block | ||
| 358 | 358 | $post_id = 0; | 
| 359 | 359 | |
| 360 | 360 | // We're in the WordPress Widget context, and an overriding post ID has been set. | 
| 361 | -			if ( ! empty( $widget_args['post_id'] ) ) { | |
| 362 | - $post_id = absint( $widget_args['post_id'] ); | |
| 361 | +			if ( ! empty( $widget_args[ 'post_id' ] ) ) { | |
| 362 | + $post_id = absint( $widget_args[ 'post_id' ] ); | |
| 363 | 363 | } | 
| 364 | 364 | // We're in the WordPress Widget context, and the base View ID should be used | 
| 365 | -			else if ( ! empty( $widget_args['view_id'] ) ) { | |
| 366 | - $post_id = absint( $widget_args['view_id'] ); | |
| 365 | +			else if ( ! empty( $widget_args[ 'view_id' ] ) ) { | |
| 366 | + $post_id = absint( $widget_args[ 'view_id' ] ); | |
| 367 | 367 | } | 
| 368 | 368 | |
| 369 | 369 | $args = gravityview_get_permalink_query_args( $post_id ); | 
| 370 | 370 | |
| 371 | 371 | // Add hidden fields to the search form | 
| 372 | 372 |  			foreach ( $args as $key => $value ) { | 
| 373 | - $search_fields[] = array( | |
| 373 | + $search_fields[ ] = array( | |
| 374 | 374 | 'name' => $key, | 
| 375 | 375 | 'input' => 'hidden', | 
| 376 | 376 | 'value' => $value, | 
| @@ -391,7 +391,7 @@ discard block | ||
| 391 | 391 | */ | 
| 392 | 392 |  	public function filter_entries( $search_criteria ) { | 
| 393 | 393 | |
| 394 | -		if( 'post' === $this->search_method ) { | |
| 394 | +		if ( 'post' === $this->search_method ) { | |
| 395 | 395 | $get = $_POST; | 
| 396 | 396 |  		} else { | 
| 397 | 397 | $get = $_GET; | 
| @@ -408,15 +408,15 @@ discard block | ||
| 408 | 408 | $get = gv_map_deep( $get, 'urldecode' ); | 
| 409 | 409 | |
| 410 | 410 | // add free search | 
| 411 | -		if ( ! empty( $get['gv_search'] ) ) { | |
| 411 | +		if ( ! empty( $get[ 'gv_search' ] ) ) { | |
| 412 | 412 | |
| 413 | 413 | // Search for a piece | 
| 414 | - $words = explode( ' ', $get['gv_search'] ); | |
| 414 | + $words = explode( ' ', $get[ 'gv_search' ] ); | |
| 415 | 415 | |
| 416 | 416 | $words = array_filter( $words ); | 
| 417 | 417 | |
| 418 | 418 |  			foreach ( $words as $word ) { | 
| 419 | - $search_criteria['field_filters'][] = array( | |
| 419 | + $search_criteria[ 'field_filters' ][ ] = array( | |
| 420 | 420 | 'key' => null, // The field ID to search | 
| 421 | 421 | 'value' => $word, // The value to search | 
| 422 | 422 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` | 
| @@ -425,8 +425,8 @@ discard block | ||
| 425 | 425 | } | 
| 426 | 426 | |
| 427 | 427 | //start date & end date | 
| 428 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; | |
| 429 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; | |
| 428 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; | |
| 429 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; | |
| 430 | 430 | |
| 431 | 431 | /** | 
| 432 | 432 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n | 
| @@ -441,16 +441,16 @@ discard block | ||
| 441 | 441 | /** | 
| 442 | 442 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) | 
| 443 | 443 | */ | 
| 444 | -		if( !empty( $curr_start ) ) { | |
| 445 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; | |
| 444 | +		if ( ! empty( $curr_start ) ) { | |
| 445 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; | |
| 446 | 446 | } | 
| 447 | -		if( !empty( $curr_end ) ) { | |
| 448 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; | |
| 447 | +		if ( ! empty( $curr_end ) ) { | |
| 448 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; | |
| 449 | 449 | } | 
| 450 | 450 | |
| 451 | 451 | // search for a specific entry ID | 
| 452 | 452 |  		if ( ! empty( $get[ 'gv_id' ] ) ) { | 
| 453 | - $search_criteria['field_filters'][] = array( | |
| 453 | + $search_criteria[ 'field_filters' ][ ] = array( | |
| 454 | 454 | 'key' => 'id', | 
| 455 | 455 | 'value' => absint( $get[ 'gv_id' ] ), | 
| 456 | 456 | 'operator' => '=', | 
| @@ -459,36 +459,36 @@ discard block | ||
| 459 | 459 | |
| 460 | 460 | // search for a specific Created_by ID | 
| 461 | 461 |  		if ( ! empty( $get[ 'gv_by' ] ) ) { | 
| 462 | - $search_criteria['field_filters'][] = array( | |
| 462 | + $search_criteria[ 'field_filters' ][ ] = array( | |
| 463 | 463 | 'key' => 'created_by', | 
| 464 | - 'value' => absint( $get['gv_by'] ), | |
| 464 | + 'value' => absint( $get[ 'gv_by' ] ), | |
| 465 | 465 | 'operator' => '=', | 
| 466 | 466 | ); | 
| 467 | 467 | } | 
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | // Get search mode passed in URL | 
| 471 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; | |
| 471 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; | |
| 472 | 472 | |
| 473 | 473 | // get the other search filters | 
| 474 | 474 |  		foreach ( $get as $key => $value ) { | 
| 475 | 475 | |
| 476 | -			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { | |
| 476 | +			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { | |
| 477 | 477 | continue; | 
| 478 | 478 | } | 
| 479 | 479 | |
| 480 | 480 | // could return simple filter or multiple filters | 
| 481 | 481 | $filter = $this->prepare_field_filter( $key, $value ); | 
| 482 | 482 | |
| 483 | -			if ( isset( $filter[0]['value'] ) ) { | |
| 484 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); | |
| 483 | +			if ( isset( $filter[ 0 ][ 'value' ] ) ) { | |
| 484 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); | |
| 485 | 485 | |
| 486 | 486 | // if date range type, set search mode to ALL | 
| 487 | -				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { | |
| 487 | +				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { | |
| 488 | 488 | $mode = 'all'; | 
| 489 | 489 | } | 
| 490 | -			} elseif( !empty( $filter ) ) { | |
| 491 | - $search_criteria['field_filters'][] = $filter; | |
| 490 | +			} elseif ( ! empty( $filter ) ) { | |
| 491 | + $search_criteria[ 'field_filters' ][ ] = $filter; | |
| 492 | 492 | } | 
| 493 | 493 | } | 
| 494 | 494 | |
| @@ -497,7 +497,7 @@ discard block | ||
| 497 | 497 | * @since 1.5.1 | 
| 498 | 498 | * @param[out,in] string $mode Search mode (`any` vs `all`) | 
| 499 | 499 | */ | 
| 500 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); | |
| 500 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); | |
| 501 | 501 | |
| 502 | 502 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); | 
| 503 | 503 | |
| @@ -535,11 +535,11 @@ discard block | ||
| 535 | 535 | 'value' => $value, | 
| 536 | 536 | ); | 
| 537 | 537 | |
| 538 | -		switch ( $form_field['type'] ) { | |
| 538 | +		switch ( $form_field[ 'type' ] ) { | |
| 539 | 539 | |
| 540 | 540 | case 'select': | 
| 541 | 541 | case 'radio': | 
| 542 | - $filter['operator'] = 'is'; | |
| 542 | + $filter[ 'operator' ] = 'is'; | |
| 543 | 543 | break; | 
| 544 | 544 | |
| 545 | 545 | case 'post_category': | 
| @@ -553,7 +553,7 @@ discard block | ||
| 553 | 553 | |
| 554 | 554 |  				foreach ( $value as $val ) { | 
| 555 | 555 | $cat = get_term( $val, 'category' ); | 
| 556 | - $filter[] = array( | |
| 556 | + $filter[ ] = array( | |
| 557 | 557 | 'key' => $field_id, | 
| 558 | 558 | 'value' => esc_attr( $cat->name ) . ':' . $val, | 
| 559 | 559 | 'operator' => 'is', | 
| @@ -572,18 +572,18 @@ discard block | ||
| 572 | 572 | $filter = array(); | 
| 573 | 573 | |
| 574 | 574 |  				foreach ( $value as $val ) { | 
| 575 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); | |
| 575 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); | |
| 576 | 576 | } | 
| 577 | 577 | |
| 578 | 578 | break; | 
| 579 | 579 | |
| 580 | 580 | case 'checkbox': | 
| 581 | 581 | // convert checkbox on/off into the correct search filter | 
| 582 | -				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { | |
| 583 | -					foreach ( $form_field['inputs'] as $k => $input ) { | |
| 584 | -						if ( $input['id'] == $field_id ) { | |
| 585 | - $filter['value'] = $form_field['choices'][ $k ]['value']; | |
| 586 | - $filter['operator'] = 'is'; | |
| 582 | +				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { | |
| 583 | +					foreach ( $form_field[ 'inputs' ] as $k => $input ) { | |
| 584 | +						if ( $input[ 'id' ] == $field_id ) { | |
| 585 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; | |
| 586 | + $filter[ 'operator' ] = 'is'; | |
| 587 | 587 | break; | 
| 588 | 588 | } | 
| 589 | 589 | } | 
| @@ -593,7 +593,7 @@ discard block | ||
| 593 | 593 | $filter = array(); | 
| 594 | 594 | |
| 595 | 595 |  					foreach ( $value as $val ) { | 
| 596 | - $filter[] = array( | |
| 596 | + $filter[ ] = array( | |
| 597 | 597 | 'key' => $field_id, | 
| 598 | 598 | 'value' => $val, | 
| 599 | 599 | 'operator' => 'is', | 
| @@ -614,9 +614,9 @@ discard block | ||
| 614 | 614 |  					foreach ( $words as $word ) { | 
| 615 | 615 |  						if ( ! empty( $word ) && strlen( $word ) > 1 ) { | 
| 616 | 616 | // Keep the same key for each filter | 
| 617 | - $filter['value'] = $word; | |
| 617 | + $filter[ 'value' ] = $word; | |
| 618 | 618 | // Add a search for the value | 
| 619 | - $filters[] = $filter; | |
| 619 | + $filters[ ] = $filter; | |
| 620 | 620 | } | 
| 621 | 621 | } | 
| 622 | 622 | |
| @@ -643,19 +643,19 @@ discard block | ||
| 643 | 643 | * @since 1.16.3 | 
| 644 | 644 | * Safeguard until GF implements '<=' operator | 
| 645 | 645 | */ | 
| 646 | -						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { | |
| 646 | +						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { | |
| 647 | 647 | $operator = '<'; | 
| 648 | 648 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); | 
| 649 | 649 | } | 
| 650 | 650 | |
| 651 | - $filter[] = array( | |
| 651 | + $filter[ ] = array( | |
| 652 | 652 | 'key' => $field_id, | 
| 653 | 653 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), | 
| 654 | 654 | 'operator' => $operator, | 
| 655 | 655 | ); | 
| 656 | 656 | } | 
| 657 | 657 |  				} else { | 
| 658 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); | |
| 658 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); | |
| 659 | 659 | } | 
| 660 | 660 | |
| 661 | 661 | break; | 
| @@ -686,7 +686,7 @@ discard block | ||
| 686 | 686 | 'ymd_dot' => 'Y.m.d', | 
| 687 | 687 | ); | 
| 688 | 688 | |
| 689 | -		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ | |
| 689 | +		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { | |
| 690 | 690 | $format = $datepicker[ $field->dateFormat ]; | 
| 691 | 691 | } | 
| 692 | 692 | |
| @@ -717,7 +717,7 @@ discard block | ||
| 717 | 717 |  	public function add_template_path( $file_paths ) { | 
| 718 | 718 | |
| 719 | 719 | // Index 100 is the default GravityView template path. | 
| 720 | - $file_paths[102] = self::$file . 'templates/'; | |
| 720 | + $file_paths[ 102 ] = self::$file . 'templates/'; | |
| 721 | 721 | |
| 722 | 722 | return $file_paths; | 
| 723 | 723 | } | 
| @@ -739,7 +739,7 @@ discard block | ||
| 739 | 739 | } | 
| 740 | 740 | |
| 741 | 741 | // get configured search fields | 
| 742 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; | |
| 742 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; | |
| 743 | 743 | |
| 744 | 744 |  		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { | 
| 745 | 745 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); | 
| @@ -753,24 +753,24 @@ discard block | ||
| 753 | 753 | |
| 754 | 754 | $updated_field = $field; | 
| 755 | 755 | |
| 756 | -			if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { | |
| 756 | +			if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { | |
| 757 | 757 | $has_date = true; | 
| 758 | 758 | } | 
| 759 | 759 | |
| 760 | 760 | $updated_field = $this->get_search_filter_details( $updated_field ); | 
| 761 | 761 | |
| 762 | -			switch ( $field['field'] ) { | |
| 762 | +			switch ( $field[ 'field' ] ) { | |
| 763 | 763 | |
| 764 | 764 | case 'search_all': | 
| 765 | - $updated_field['key'] = 'search_all'; | |
| 766 | - $updated_field['input'] = 'search_all'; | |
| 767 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); | |
| 765 | + $updated_field[ 'key' ] = 'search_all'; | |
| 766 | + $updated_field[ 'input' ] = 'search_all'; | |
| 767 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); | |
| 768 | 768 | break; | 
| 769 | 769 | |
| 770 | 770 | case 'entry_date': | 
| 771 | - $updated_field['key'] = 'entry_date'; | |
| 772 | - $updated_field['input'] = 'entry_date'; | |
| 773 | - $updated_field['value'] = array( | |
| 771 | + $updated_field[ 'key' ] = 'entry_date'; | |
| 772 | + $updated_field[ 'input' ] = 'entry_date'; | |
| 773 | + $updated_field[ 'value' ] = array( | |
| 774 | 774 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), | 
| 775 | 775 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), | 
| 776 | 776 | ); | 
| @@ -778,16 +778,16 @@ discard block | ||
| 778 | 778 | break; | 
| 779 | 779 | |
| 780 | 780 | case 'entry_id': | 
| 781 | - $updated_field['key'] = 'entry_id'; | |
| 782 | - $updated_field['input'] = 'entry_id'; | |
| 783 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); | |
| 781 | + $updated_field[ 'key' ] = 'entry_id'; | |
| 782 | + $updated_field[ 'input' ] = 'entry_id'; | |
| 783 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); | |
| 784 | 784 | break; | 
| 785 | 785 | |
| 786 | 786 | case 'created_by': | 
| 787 | - $updated_field['key'] = 'created_by'; | |
| 788 | - $updated_field['name'] = 'gv_by'; | |
| 789 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); | |
| 790 | - $updated_field['choices'] = self::get_created_by_choices(); | |
| 787 | + $updated_field[ 'key' ] = 'created_by'; | |
| 788 | + $updated_field[ 'name' ] = 'gv_by'; | |
| 789 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); | |
| 790 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); | |
| 791 | 791 | break; | 
| 792 | 792 | } | 
| 793 | 793 | |
| @@ -805,16 +805,16 @@ discard block | ||
| 805 | 805 | */ | 
| 806 | 806 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); | 
| 807 | 807 | |
| 808 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; | |
| 808 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; | |
| 809 | 809 | |
| 810 | 810 | /** @since 1.14 */ | 
| 811 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; | |
| 811 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; | |
| 812 | 812 | |
| 813 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; | |
| 813 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; | |
| 814 | 814 | |
| 815 | 815 | $gravityview_view->search_class = self::get_search_class( $custom_class ); | 
| 816 | 816 | |
| 817 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; | |
| 817 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; | |
| 818 | 818 | |
| 819 | 819 |  		if ( $has_date ) { | 
| 820 | 820 | // enqueue datepicker stuff only if needed! | 
| @@ -834,10 +834,10 @@ discard block | ||
| 834 | 834 |  	public static function get_search_class( $custom_class = '' ) { | 
| 835 | 835 | $gravityview_view = GravityView_View::getInstance(); | 
| 836 | 836 | |
| 837 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; | |
| 837 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; | |
| 838 | 838 | |
| 839 | -		if ( ! empty( $custom_class )  ) { | |
| 840 | - $search_class .= ' '.$custom_class; | |
| 839 | +		if ( ! empty( $custom_class ) ) { | |
| 840 | + $search_class .= ' ' . $custom_class; | |
| 841 | 841 | } | 
| 842 | 842 | |
| 843 | 843 | /** | 
| @@ -880,11 +880,11 @@ discard block | ||
| 880 | 880 | |
| 881 | 881 | $label = rgget( 'label', $field ); | 
| 882 | 882 | |
| 883 | -		if( '' === $label ) { | |
| 883 | +		if ( '' === $label ) { | |
| 884 | 884 | |
| 885 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; | |
| 885 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; | |
| 886 | 886 | |
| 887 | -			switch( $field['field'] ) { | |
| 887 | +			switch ( $field[ 'field' ] ) { | |
| 888 | 888 | case 'search_all': | 
| 889 | 889 | $label = __( 'Search Entries:', 'gravityview' ); | 
| 890 | 890 | break; | 
| @@ -902,10 +902,10 @@ discard block | ||
| 902 | 902 | break; | 
| 903 | 903 | default: | 
| 904 | 904 | // If this is a field input, not a field | 
| 905 | -					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { | |
| 905 | +					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { | |
| 906 | 906 | |
| 907 | 907 | // Get the label for the field in question, which returns an array | 
| 908 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); | |
| 908 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); | |
| 909 | 909 | |
| 910 | 910 | // Get the item with the `label` key | 
| 911 | 911 | $values = wp_list_pluck( $items, 'label' ); | 
| @@ -942,32 +942,32 @@ discard block | ||
| 942 | 942 | $form = $gravityview_view->getForm(); | 
| 943 | 943 | |
| 944 | 944 | // for advanced field ids (eg, first name / last name ) | 
| 945 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); | |
| 945 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); | |
| 946 | 946 | |
| 947 | 947 | // get searched value from $_GET/$_POST (string or array) | 
| 948 | 948 | $value = $this->rgget_or_rgpost( $name ); | 
| 949 | 949 | |
| 950 | 950 | // get form field details | 
| 951 | - $form_field = gravityview_get_field( $form, $field['field'] ); | |
| 951 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); | |
| 952 | 952 | |
| 953 | 953 | $filter = array( | 
| 954 | - 'key' => $field['field'], | |
| 954 | + 'key' => $field[ 'field' ], | |
| 955 | 955 | 'name' => $name, | 
| 956 | 956 | 'label' => self::get_field_label( $field, $form_field ), | 
| 957 | - 'input' => $field['input'], | |
| 957 | + 'input' => $field[ 'input' ], | |
| 958 | 958 | 'value' => $value, | 
| 959 | - 'type' => $form_field['type'], | |
| 959 | + 'type' => $form_field[ 'type' ], | |
| 960 | 960 | ); | 
| 961 | 961 | |
| 962 | 962 | // collect choices | 
| 963 | -		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { | |
| 964 | - $filter['choices'] = gravityview_get_terms_choices(); | |
| 965 | -		} elseif ( ! empty( $form_field['choices'] ) ) { | |
| 966 | - $filter['choices'] = $form_field['choices']; | |
| 963 | +		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { | |
| 964 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); | |
| 965 | +		} elseif ( ! empty( $form_field[ 'choices' ] ) ) { | |
| 966 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; | |
| 967 | 967 | } | 
| 968 | 968 | |
| 969 | -		if ( 'date_range' === $field['input'] && empty( $value ) ) { | |
| 970 | - $filter['value'] = array( 'start' => '', 'end' => '' ); | |
| 969 | +		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { | |
| 970 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); | |
| 971 | 971 | } | 
| 972 | 972 | |
| 973 | 973 | return $filter; | 
| @@ -991,7 +991,7 @@ discard block | ||
| 991 | 991 | |
| 992 | 992 | $choices = array(); | 
| 993 | 993 |  		foreach ( $users as $user ) { | 
| 994 | - $choices[] = array( | |
| 994 | + $choices[ ] = array( | |
| 995 | 995 | 'value' => $user->ID, | 
| 996 | 996 | 'text' => $user->display_name, | 
| 997 | 997 | ); | 
| @@ -1045,7 +1045,7 @@ discard block | ||
| 1045 | 1045 | */ | 
| 1046 | 1046 |  	public function add_datepicker_js_dependency( $js_dependencies ) { | 
| 1047 | 1047 | |
| 1048 | - $js_dependencies[] = 'jquery-ui-datepicker'; | |
| 1048 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; | |
| 1049 | 1049 | |
| 1050 | 1050 | return $js_dependencies; | 
| 1051 | 1051 | } | 
| @@ -1089,7 +1089,7 @@ discard block | ||
| 1089 | 1089 | 'isRTL' => is_rtl(), | 
| 1090 | 1090 | ), $view_data ); | 
| 1091 | 1091 | |
| 1092 | - $localizations['datepicker'] = $datepicker_settings; | |
| 1092 | + $localizations[ 'datepicker' ] = $datepicker_settings; | |
| 1093 | 1093 | |
| 1094 | 1094 | return $localizations; | 
| 1095 | 1095 | |
| @@ -1112,7 +1112,7 @@ discard block | ||
| 1112 | 1112 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); | 
| 1113 | 1113 | |
| 1114 | 1114 | $scheme = is_ssl() ? 'https://' : 'http://'; | 
| 1115 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); | |
| 1115 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); | |
| 1116 | 1116 | |
| 1117 | 1117 | /** | 
| 1118 | 1118 | * @filter `gravityview_search_datepicker_class` | 
| @@ -873,7 +873,7 @@ discard block | ||
| 873 | 873 | /** | 
| 874 | 874 | * Get the label for a search form field | 
| 875 | 875 | * @param array $field Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys | 
| 876 | - * @param array $form_field Form field data, as fetched by `gravityview_get_field()` | |
| 876 | + * @param GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()` | |
| 877 | 877 | * @return string Label for the search form | 
| 878 | 878 | */ | 
| 879 | 879 |  	private static function get_field_label( $field, $form_field = array() ) { | 
| @@ -1053,7 +1053,7 @@ discard block | ||
| 1053 | 1053 | /** | 
| 1054 | 1054 | * Modify the array passed to wp_localize_script() | 
| 1055 | 1055 | * | 
| 1056 | - * @param array $js_localization The data padded to the Javascript file | |
| 1056 | + * @param array $localizations The data padded to the Javascript file | |
| 1057 | 1057 | * @param array $view_data View data array with View settings | 
| 1058 | 1058 | * | 
| 1059 | 1059 | * @return array | 
| @@ -228,7 +228,7 @@ discard block | ||
| 228 | 228 | |
| 229 | 229 | self::getInstance()->set_entry( $entry ); | 
| 230 | 230 | |
| 231 | - $base = GravityView_API::directory_link( $post_id, true ); | |
| 231 | + $base = GravityView_API::directory_link( $post_id, true ); | |
| 232 | 232 | |
| 233 | 233 |  		if( empty( $base ) ) { | 
| 234 | 234 | do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: '.$post_id ); | 
| @@ -238,13 +238,13 @@ discard block | ||
| 238 | 238 | // Use the slug instead of the ID for consistent security | 
| 239 | 239 | $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); | 
| 240 | 240 | |
| 241 | - $view_id = empty( $view_id ) ? gravityview_get_view_id() : $view_id; | |
| 241 | + $view_id = empty( $view_id ) ? gravityview_get_view_id() : $view_id; | |
| 242 | 242 | |
| 243 | 243 | $actionurl = add_query_arg( array( | 
| 244 | 244 | 'action' => 'delete', | 
| 245 | 245 | 'entry_id' => $entry_slug, | 
| 246 | 246 | 'gvid' => $view_id, | 
| 247 | - 'view_id' => $view_id, | |
| 247 | + 'view_id' => $view_id, | |
| 248 | 248 | ), $base ); | 
| 249 | 249 | |
| 250 | 250 | $url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' ); | 
| @@ -415,7 +415,7 @@ discard block | ||
| 415 | 415 | * @action `gravityview/delete-entry/deleted` Triggered when an entry is deleted | 
| 416 | 416 | * @since 1.16.4 | 
| 417 | 417 | * @param int $entry_id ID of the Gravity Forms entry | 
| 418 | - */ | |
| 418 | + */ | |
| 419 | 419 | do_action( 'gravityview/delete-entry/deleted', $entry_id ); | 
| 420 | 420 | } | 
| 421 | 421 | |
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, | 
| 183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), | 
| 184 | 184 | 9 => sprintf( | 
| 185 | - /* translators: Date and time the View is scheduled to be published */ | |
| 185 | + /* translators: Date and time the View is scheduled to be published */ | |
| 186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), | 
| 187 | 187 | // translators: Publish box date format, see http://php.net/date | 
| 188 | 188 | date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) | 
| @@ -222,39 +222,39 @@ discard block | ||
| 222 | 222 | } | 
| 223 | 223 | |
| 224 | 224 | $wp_allowed_scripts = array( | 
| 225 | - 'common', | |
| 226 | - 'admin-bar', | |
| 227 | - 'autosave', | |
| 228 | - 'post', | |
| 225 | + 'common', | |
| 226 | + 'admin-bar', | |
| 227 | + 'autosave', | |
| 228 | + 'post', | |
| 229 | 229 | 'inline-edit-post', | 
| 230 | - 'utils', | |
| 231 | - 'svg-painter', | |
| 232 | - 'wp-auth-check', | |
| 233 | - 'heartbeat', | |
| 230 | + 'utils', | |
| 231 | + 'svg-painter', | |
| 232 | + 'wp-auth-check', | |
| 233 | + 'heartbeat', | |
| 234 | 234 | 'media-editor', | 
| 235 | 235 | 'media-upload', | 
| 236 | - 'thickbox', | |
| 236 | + 'thickbox', | |
| 237 | 237 | 'wp-color-picker', | 
| 238 | 238 | |
| 239 | - // Settings | |
| 239 | + // Settings | |
| 240 | 240 | 'gv-admin-edd-license', | 
| 241 | 241 | |
| 242 | - // Common | |
| 243 | - 'select2-js', | |
| 244 | - 'qtip-js', | |
| 242 | + // Common | |
| 243 | + 'select2-js', | |
| 244 | + 'qtip-js', | |
| 245 | 245 | |
| 246 | - // jQuery | |
| 246 | + // jQuery | |
| 247 | 247 | 'jquery', | 
| 248 | - 'jquery-ui-core', | |
| 249 | - 'jquery-ui-sortable', | |
| 250 | - 'jquery-ui-datepicker', | |
| 251 | - 'jquery-ui-dialog', | |
| 252 | - 'jquery-ui-slider', | |
| 248 | + 'jquery-ui-core', | |
| 249 | + 'jquery-ui-sortable', | |
| 250 | + 'jquery-ui-datepicker', | |
| 251 | + 'jquery-ui-dialog', | |
| 252 | + 'jquery-ui-slider', | |
| 253 | 253 | 'jquery-ui-dialog', | 
| 254 | 254 | 'jquery-ui-tabs', | 
| 255 | 255 | 'jquery-ui-draggable', | 
| 256 | 256 | 'jquery-ui-droppable', | 
| 257 | - 'jquery-ui-accordion', | |
| 257 | + 'jquery-ui-accordion', | |
| 258 | 258 | ); | 
| 259 | 259 | |
| 260 | 260 | $this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' ); | 
| @@ -288,23 +288,23 @@ discard block | ||
| 288 | 288 | return; | 
| 289 | 289 | } | 
| 290 | 290 | |
| 291 | - $wp_allowed_styles = array( | |
| 292 | - 'admin-bar', | |
| 293 | - 'colors', | |
| 294 | - 'ie', | |
| 295 | - 'wp-auth-check', | |
| 296 | - 'media-views', | |
| 291 | + $wp_allowed_styles = array( | |
| 292 | + 'admin-bar', | |
| 293 | + 'colors', | |
| 294 | + 'ie', | |
| 295 | + 'wp-auth-check', | |
| 296 | + 'media-views', | |
| 297 | 297 | 'thickbox', | 
| 298 | 298 | 'dashicons', | 
| 299 | - 'wp-jquery-ui-dialog', | |
| 300 | - 'jquery-ui-sortable', | |
| 299 | + 'wp-jquery-ui-dialog', | |
| 300 | + 'jquery-ui-sortable', | |
| 301 | 301 | |
| 302 | - // Settings | |
| 303 | - 'gravityview_settings', | |
| 302 | + // Settings | |
| 303 | + 'gravityview_settings', | |
| 304 | 304 | |
| 305 | - // @todo qTip styles not loading for some reason! | |
| 306 | - 'jquery-qtip.js', | |
| 307 | - ); | |
| 305 | + // @todo qTip styles not loading for some reason! | |
| 306 | + 'jquery-qtip.js', | |
| 307 | + ); | |
| 308 | 308 | |
| 309 | 309 | $this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' ); | 
| 310 | 310 | |
| @@ -324,32 +324,32 @@ discard block | ||
| 324 | 324 | */ | 
| 325 | 325 |  	private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) { | 
| 326 | 326 | |
| 327 | - /** | |
| 328 | -         * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n | |
| 329 | - * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` | |
| 330 | - * @param array $required_objects | |
| 331 | - */ | |
| 332 | -        $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); | |
| 333 | - | |
| 334 | - //reset queue | |
| 335 | - $queue = array(); | |
| 336 | -        foreach( $wp_objects->queue as $object ) { | |
| 337 | -	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { | |
| 338 | - $queue[] = $object; | |
| 339 | - } | |
| 340 | - } | |
| 341 | - $wp_objects->queue = $queue; | |
| 342 | - | |
| 343 | - $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); | |
| 344 | - | |
| 345 | - //unregistering scripts | |
| 346 | - $registered = array(); | |
| 347 | -        foreach( $wp_objects->registered as $handle => $script_registration ){ | |
| 348 | -            if( in_array( $handle, $required_objects ) ){ | |
| 349 | - $registered[ $handle ] = $script_registration; | |
| 350 | - } | |
| 351 | - } | |
| 352 | - $wp_objects->registered = $registered; | |
| 327 | + /** | |
| 328 | +		 * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n | |
| 329 | + * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` | |
| 330 | + * @param array $required_objects | |
| 331 | + */ | |
| 332 | +		$required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); | |
| 333 | + | |
| 334 | + //reset queue | |
| 335 | + $queue = array(); | |
| 336 | +		foreach( $wp_objects->queue as $object ) { | |
| 337 | +			if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { | |
| 338 | + $queue[] = $object; | |
| 339 | + } | |
| 340 | + } | |
| 341 | + $wp_objects->queue = $queue; | |
| 342 | + | |
| 343 | + $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); | |
| 344 | + | |
| 345 | + //unregistering scripts | |
| 346 | + $registered = array(); | |
| 347 | +		foreach( $wp_objects->registered as $handle => $script_registration ){ | |
| 348 | +			if( in_array( $handle, $required_objects ) ){ | |
| 349 | + $registered[ $handle ] = $script_registration; | |
| 350 | + } | |
| 351 | + } | |
| 352 | + $wp_objects->registered = $registered; | |
| 353 | 353 | } | 
| 354 | 354 | |
| 355 | 355 | /** | 
| @@ -412,7 +412,6 @@ discard block | ||
| 412 | 412 | * | 
| 413 | 413 | * @deprecated since 1.12 | 
| 414 | 414 | * @see GravityView_Compatibility::get_plugin_status() | 
| 415 | - | |
| 416 | 415 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive | 
| 417 | 416 | */ | 
| 418 | 417 |  	static function get_plugin_status( $location = '' ) { | 
| @@ -4,10 +4,10 @@ discard block | ||
| 4 | 4 | |
| 5 | 5 |  	function __construct() { | 
| 6 | 6 | |
| 7 | -		if( ! is_admin() ) { return; } | |
| 7 | +		if ( ! is_admin() ) { return; } | |
| 8 | 8 | |
| 9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading | 
| 10 | -		if( false === GravityView_Compatibility::is_valid() ) { | |
| 10 | +		if ( false === GravityView_Compatibility::is_valid() ) { | |
| 11 | 11 | return; | 
| 12 | 12 | } | 
| 13 | 13 | |
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); | 
| 26 | 26 | |
| 27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations | 
| 28 | -		if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { | |
| 28 | +		if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { | |
| 29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -50,18 +50,18 @@ discard block | ||
| 50 | 50 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); | 
| 51 | 51 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); | 
| 52 | 52 | |
| 53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); | |
| 53 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); | |
| 54 | 54 | |
| 55 | 55 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); | 
| 56 | 56 | |
| 57 | 57 | //Hooks for no-conflict functionality | 
| 58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); | |
| 59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); | |
| 58 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); | |
| 59 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); | |
| 60 | 60 | |
| 61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); | |
| 62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); | |
| 63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); | |
| 64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); | |
| 61 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); | |
| 62 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); | |
| 63 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); | |
| 64 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); | |
| 65 | 65 | |
| 66 | 66 | } | 
| 67 | 67 | |
| @@ -74,20 +74,20 @@ discard block | ||
| 74 | 74 |  	public function backend_actions() { | 
| 75 | 75 | |
| 76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ | 
| 77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); | |
| 78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); | |
| 79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); | |
| 80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); | |
| 81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); | |
| 82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); | |
| 83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); | |
| 77 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); | |
| 78 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); | |
| 79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); | |
| 80 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); | |
| 81 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); | |
| 82 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); | |
| 83 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); | |
| 84 | 84 | |
| 85 | 85 | /** | 
| 86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded | 
| 87 | 87 | * | 
| 88 | 88 | * Nice place to insert extensions' backend stuff | 
| 89 | 89 | */ | 
| 90 | -		do_action('gravityview_include_backend_actions'); | |
| 90 | + do_action( 'gravityview_include_backend_actions' ); | |
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | /** | 
| @@ -103,12 +103,12 @@ discard block | ||
| 103 | 103 | |
| 104 | 104 | $actions = array(); | 
| 105 | 105 | |
| 106 | -		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { | |
| 107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); | |
| 106 | +		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { | |
| 107 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); | |
| 108 | 108 | } | 
| 109 | 109 | |
| 110 | -		if( GVCommon::has_cap( 'gravityview_support_port' ) ) { | |
| 111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; | |
| 110 | +		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { | |
| 111 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; | |
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 | return array_merge( $actions, $links ); | 
| @@ -131,12 +131,12 @@ discard block | ||
| 131 | 131 |  	function post_updated_messages( $messages, $bulk_counts = NULL ) { | 
| 132 | 132 | global $post; | 
| 133 | 133 | |
| 134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); | |
| 134 | + $post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); | |
| 135 | 135 | |
| 136 | 136 | // By default, there will only be one item being modified. | 
| 137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number | 
| 138 | 138 | // of modified items that will override this array. | 
| 139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; | |
| 139 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; | |
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | // If we're starting fresh, a new form was created. | 
| @@ -145,60 +145,60 @@ discard block | ||
| 145 | 145 | |
| 146 | 146 | $new_form_text = ''; | 
| 147 | 147 | |
| 148 | -		if( !empty( $start_fresh ) ) { | |
| 148 | +		if ( ! empty( $start_fresh ) ) { | |
| 149 | 149 | |
| 150 | 150 | // Get the form that was created | 
| 151 | 151 | $connected_form = gravityview_get_form_id( $post_id ); | 
| 152 | 152 | |
| 153 | -			if( !empty( $connected_form ) ) { | |
| 153 | +			if ( ! empty( $connected_form ) ) { | |
| 154 | 154 | $form = gravityview_get_form( $connected_form ); | 
| 155 | - $form_name = esc_attr( $form['title'] ); | |
| 155 | + $form_name = esc_attr( $form[ 'title' ] ); | |
| 156 | 156 | $image = self::get_floaty(); | 
| 157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; | |
| 158 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s | |
| 157 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; | |
| 158 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s | |
| 159 | 159 | |
| 160 | 160 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. | 
| 161 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); | |
| 161 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); | |
| 162 | 162 | $new_form_text = wpautop( $new_form_text ); | 
| 163 | 163 | |
| 164 | 164 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); | 
| 165 | 165 | } | 
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | - $messages['gravityview'] = array( | |
| 168 | + $messages[ 'gravityview' ] = array( | |
| 169 | 169 | 0 => '', // Unused. Messages start at index 1. | 
| 170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 171 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), | |
| 171 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), | |
| 172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 173 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), | |
| 173 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), | |
| 174 | 174 | 3 => __( 'View deleted.', 'gravityview' ), | 
| 175 | 175 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 176 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), | |
| 176 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), | |
| 177 | 177 | /* translators: %s: date and time of the revision */ | 
| 178 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, | |
| 178 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, | |
| 179 | 179 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 180 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, | |
| 180 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, | |
| 181 | 181 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 182 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, | |
| 182 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, | |
| 183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), | 
| 184 | 184 | 9 => sprintf( | 
| 185 | 185 | /* translators: Date and time the View is scheduled to be published */ | 
| 186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), | 
| 187 | 187 | // translators: Publish box date format, see http://php.net/date | 
| 188 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) | |
| 188 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) | |
| 189 | 189 | ) . $new_form_text, | 
| 190 | 190 | /* translators: %s and %s are HTML tags linking to the View on the website */ | 
| 191 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), | |
| 191 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), | |
| 192 | 192 | |
| 193 | 193 | /** | 
| 194 | 194 | * These apply to `bulk_post_updated_messages` | 
| 195 | 195 | * @file wp-admin/edit.php | 
| 196 | 196 | */ | 
| 197 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), | |
| 198 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), | |
| 199 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), | |
| 200 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), | |
| 201 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), | |
| 197 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), | |
| 198 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), | |
| 199 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), | |
| 200 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), | |
| 201 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), | |
| 202 | 202 | ); | 
| 203 | 203 | |
| 204 | 204 | return $messages; | 
| @@ -211,13 +211,13 @@ discard block | ||
| 211 | 211 |  	function no_conflict_scripts() { | 
| 212 | 212 | global $wp_scripts; | 
| 213 | 213 | |
| 214 | -		if( ! gravityview_is_admin_page() ) { | |
| 214 | +		if ( ! gravityview_is_admin_page() ) { | |
| 215 | 215 | return; | 
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | -		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); | |
| 218 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); | |
| 219 | 219 | |
| 220 | -		if( empty( $no_conflict_mode ) ) { | |
| 220 | +		if ( empty( $no_conflict_mode ) ) { | |
| 221 | 221 | return; | 
| 222 | 222 | } | 
| 223 | 223 | |
| @@ -267,24 +267,24 @@ discard block | ||
| 267 | 267 |  	function no_conflict_styles() { | 
| 268 | 268 | global $wp_styles; | 
| 269 | 269 | |
| 270 | -		if( ! gravityview_is_admin_page() ) { | |
| 270 | +		if ( ! gravityview_is_admin_page() ) { | |
| 271 | 271 | return; | 
| 272 | 272 | } | 
| 273 | 273 | |
| 274 | 274 | // Dequeue other jQuery styles even if no-conflict is off. | 
| 275 | 275 | // Terrible-looking tabs help no one. | 
| 276 | -		if( !empty( $wp_styles->registered ) )  { | |
| 277 | -			foreach ($wp_styles->registered as $key => $style) { | |
| 278 | -				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { | |
| 276 | +		if ( ! empty( $wp_styles->registered ) ) { | |
| 277 | +			foreach ( $wp_styles->registered as $key => $style ) { | |
| 278 | +				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { | |
| 279 | 279 | wp_dequeue_style( $key ); | 
| 280 | 280 | } | 
| 281 | 281 | } | 
| 282 | 282 | } | 
| 283 | 283 | |
| 284 | -		$no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); | |
| 284 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); | |
| 285 | 285 | |
| 286 | 286 | // If no conflict is off, jQuery will suffice. | 
| 287 | -		if( empty( $no_conflict_mode ) ) { | |
| 287 | +		if ( empty( $no_conflict_mode ) ) { | |
| 288 | 288 | return; | 
| 289 | 289 | } | 
| 290 | 290 | |
| @@ -311,7 +311,7 @@ discard block | ||
| 311 | 311 | /** | 
| 312 | 312 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. | 
| 313 | 313 | */ | 
| 314 | -		do_action('gravityview_remove_conflicts_after'); | |
| 314 | + do_action( 'gravityview_remove_conflicts_after' ); | |
| 315 | 315 | } | 
| 316 | 316 | |
| 317 | 317 | /** | 
| @@ -333,9 +333,9 @@ discard block | ||
| 333 | 333 | |
| 334 | 334 | //reset queue | 
| 335 | 335 | $queue = array(); | 
| 336 | -        foreach( $wp_objects->queue as $object ) { | |
| 337 | -	        if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { | |
| 338 | - $queue[] = $object; | |
| 336 | +        foreach ( $wp_objects->queue as $object ) { | |
| 337 | +	        if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { | |
| 338 | + $queue[ ] = $object; | |
| 339 | 339 | } | 
| 340 | 340 | } | 
| 341 | 341 | $wp_objects->queue = $queue; | 
| @@ -344,8 +344,8 @@ discard block | ||
| 344 | 344 | |
| 345 | 345 | //unregistering scripts | 
| 346 | 346 | $registered = array(); | 
| 347 | -        foreach( $wp_objects->registered as $handle => $script_registration ){ | |
| 348 | -            if( in_array( $handle, $required_objects ) ){ | |
| 347 | +        foreach ( $wp_objects->registered as $handle => $script_registration ) { | |
| 348 | +            if ( in_array( $handle, $required_objects ) ) { | |
| 349 | 349 | $registered[ $handle ] = $script_registration; | 
| 350 | 350 | } | 
| 351 | 351 | } | 
| @@ -358,7 +358,7 @@ discard block | ||
| 358 | 358 | * @param [type] $registered [description] | 
| 359 | 359 | * @param [type] $scripts [description] | 
| 360 | 360 | */ | 
| 361 | -	private function add_script_dependencies($registered, $scripts) { | |
| 361 | +	private function add_script_dependencies( $registered, $scripts ) { | |
| 362 | 362 | |
| 363 | 363 | //gets all dependent scripts linked to the $scripts array passed | 
| 364 | 364 |  		do { | 
| @@ -367,7 +367,7 @@ discard block | ||
| 367 | 367 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); | 
| 368 | 368 |  				foreach ( $deps as $dep ) { | 
| 369 | 369 |  					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { | 
| 370 | - $dependents[] = $dep; | |
| 370 | + $dependents[ ] = $dep; | |
| 371 | 371 | } | 
| 372 | 372 | } | 
| 373 | 373 | } | 
| @@ -431,29 +431,29 @@ discard block | ||
| 431 | 431 |  	static function is_admin_page( $hook = '', $page = NULL ) { | 
| 432 | 432 | global $current_screen, $plugin_page, $pagenow, $post; | 
| 433 | 433 | |
| 434 | -		if( ! is_admin() ) { return false; } | |
| 434 | +		if ( ! is_admin() ) { return false; } | |
| 435 | 435 | |
| 436 | 436 | $is_page = false; | 
| 437 | 437 | |
| 438 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); | |
| 438 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); | |
| 439 | 439 | |
| 440 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); | |
| 440 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); | |
| 441 | 441 | |
| 442 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; | |
| 442 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; | |
| 443 | 443 | |
| 444 | -		if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { | |
| 445 | - $gv_post = get_post( intval( $_GET['post'] ) ); | |
| 446 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); | |
| 444 | +		if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { | |
| 445 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); | |
| 446 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); | |
| 447 | 447 |  		} else { | 
| 448 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); | |
| 448 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); | |
| 449 | 449 | } | 
| 450 | 450 | |
| 451 | -		if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { | |
| 451 | +		if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { | |
| 452 | 452 | |
| 453 | 453 | // $_GET `post_type` variable | 
| 454 | -			if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { | |
| 454 | +			if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { | |
| 455 | 455 | $is_page = 'single'; | 
| 456 | -			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { | |
| 456 | +			} else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { | |
| 457 | 457 | $is_page = 'settings'; | 
| 458 | 458 |  			} else { | 
| 459 | 459 | $is_page = 'views'; | 
| @@ -468,7 +468,7 @@ discard block | ||
| 468 | 468 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); | 
| 469 | 469 | |
| 470 | 470 | // If the current page is the same as the compared page | 
| 471 | -		if( !empty( $page ) ) { | |
| 471 | +		if ( ! empty( $page ) ) { | |
| 472 | 472 | return $is_page === $page; | 
| 473 | 473 | } | 
| 474 | 474 | |
| @@ -489,6 +489,6 @@ discard block | ||
| 489 | 489 | * | 
| 490 | 490 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) | 
| 491 | 491 | */ | 
| 492 | -function gravityview_is_admin_page($hook = '', $page = NULL) { | |
| 492 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { | |
| 493 | 493 | return GravityView_Admin::is_admin_page( $hook, $page ); | 
| 494 | 494 | } | 
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | */ | 
| 86 | 86 |  	public static function get_instance() { | 
| 87 | 87 | |
| 88 | -		if( empty( self::$instance ) ) { | |
| 88 | +		if ( empty( self::$instance ) ) { | |
| 89 | 89 | self::$instance = new self; | 
| 90 | 90 | } | 
| 91 | 91 | |
| @@ -118,9 +118,9 @@ discard block | ||
| 118 | 118 | |
| 119 | 119 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); | 
| 120 | 120 | |
| 121 | -		if( $with_values ) { | |
| 121 | +		if ( $with_values ) { | |
| 122 | 122 | $operators_with_values = array(); | 
| 123 | -			foreach( $operators as $key ) { | |
| 123 | +			foreach ( $operators as $key ) { | |
| 124 | 124 | $operators_with_values[ $key ] = ''; | 
| 125 | 125 | } | 
| 126 | 126 | return $operators_with_values; | 
| @@ -137,14 +137,14 @@ discard block | ||
| 137 | 137 | */ | 
| 138 | 138 |  	function set_operation( $operation = '' ) { | 
| 139 | 139 | |
| 140 | -		if( empty( $operation ) ) { | |
| 140 | +		if ( empty( $operation ) ) { | |
| 141 | 141 | return false; | 
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | $operators = $this->get_operators( false ); | 
| 145 | 145 | |
| 146 | -		if( !in_array( $operation, $operators ) ) { | |
| 147 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); | |
| 146 | +		if ( ! in_array( $operation, $operators ) ) { | |
| 147 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); | |
| 148 | 148 | return false; | 
| 149 | 149 | } | 
| 150 | 150 | |
| @@ -164,11 +164,11 @@ discard block | ||
| 164 | 164 | */ | 
| 165 | 165 |  	private function setup_operation_and_comparison() { | 
| 166 | 166 | |
| 167 | -		foreach( $this->atts as $key => $value ) { | |
| 167 | +		foreach ( $this->atts as $key => $value ) { | |
| 168 | 168 | |
| 169 | 169 | $valid = $this->set_operation( $key ); | 
| 170 | 170 | |
| 171 | -			if( $valid ) { | |
| 171 | +			if ( $valid ) { | |
| 172 | 172 | $this->comparison = $value; | 
| 173 | 173 | return true; | 
| 174 | 174 | } | 
| @@ -198,16 +198,16 @@ discard block | ||
| 198 | 198 | $this->parse_atts(); | 
| 199 | 199 | |
| 200 | 200 | // We need an "if" | 
| 201 | -		if( false === $this->if ) { | |
| 202 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); | |
| 201 | +		if ( false === $this->if ) { | |
| 202 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); | |
| 203 | 203 | return null; | 
| 204 | 204 | } | 
| 205 | 205 | |
| 206 | 206 | $setup = $this->setup_operation_and_comparison(); | 
| 207 | 207 | |
| 208 | 208 | // We need an operation and comparison value | 
| 209 | -		if( ! $setup ) { | |
| 210 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); | |
| 209 | +		if ( ! $setup ) { | |
| 210 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); | |
| 211 | 211 | return null; | 
| 212 | 212 | } | 
| 213 | 213 | |
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 | */ | 
| 241 | 241 |  	private function get_output() { | 
| 242 | 242 | |
| 243 | -		if( $this->is_match ) { | |
| 243 | +		if ( $this->is_match ) { | |
| 244 | 244 | $output = $this->content; | 
| 245 | 245 |  		} else { | 
| 246 | 246 | $output = $this->else_content; | 
| @@ -254,9 +254,9 @@ discard block | ||
| 254 | 254 | * @param string $output HTML/text output | 
| 255 | 255 | * @param GVLogic_Shortcode $this This class | 
| 256 | 256 | */ | 
| 257 | -		$output = apply_filters('gravityview/gvlogic/output', $output, $this ); | |
| 257 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); | |
| 258 | 258 | |
| 259 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); | |
| 259 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); | |
| 260 | 260 | |
| 261 | 261 | return $output; | 
| 262 | 262 | } | 
| @@ -272,11 +272,11 @@ discard block | ||
| 272 | 272 | |
| 273 | 273 | $content = explode( '[else]', $this->passed_content ); | 
| 274 | 274 | |
| 275 | - $this->content = $content[0]; | |
| 275 | + $this->content = $content[ 0 ]; | |
| 276 | 276 | |
| 277 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; | |
| 277 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; | |
| 278 | 278 | |
| 279 | - $this->else_content = isset( $content[1] ) ? $content[1] : $else_attr; | |
| 279 | + $this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr; | |
| 280 | 280 | } | 
| 281 | 281 | |
| 282 | 282 | /** | 
| @@ -299,10 +299,10 @@ discard block | ||
| 299 | 299 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; | 
| 300 | 300 | |
| 301 | 301 | // Strip whitespace if it's not default false | 
| 302 | - $this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false; | |
| 302 | + $this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false; | |
| 303 | 303 | |
| 304 | 304 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() | 
| 305 | - unset( $this->atts['if'] ); | |
| 305 | + unset( $this->atts[ 'if' ] ); | |
| 306 | 306 | } | 
| 307 | 307 | } | 
| 308 | 308 | |
| @@ -124,7 +124,7 @@ discard block | ||
| 124 | 124 | |
| 125 | 125 | $entry = self::get_entry( $entry_slug, true ); | 
| 126 | 126 | |
| 127 | - $form = self::get_form( $entry['form_id'] ); | |
| 127 | + $form = self::get_form( $entry[ 'form_id' ] ); | |
| 128 | 128 | |
| 129 | 129 | return $form; | 
| 130 | 130 | } | 
| @@ -175,7 +175,7 @@ discard block | ||
| 175 | 175 | |
| 176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); | 
| 177 | 177 | |
| 178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; | |
| 178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; | |
| 179 | 179 | |
| 180 | 180 | return $result; | 
| 181 | 181 | } | 
| @@ -193,9 +193,9 @@ discard block | ||
| 193 | 193 |  		if ( class_exists( 'GFAPI' ) ) { | 
| 194 | 194 | $gf_forms = GFAPI::get_forms(); | 
| 195 | 195 |  			foreach ( $gf_forms as $form ) { | 
| 196 | - $forms[] = array( | |
| 197 | - 'id' => $form['id'], | |
| 198 | - 'title' => $form['title'], | |
| 196 | + $forms[ ] = array( | |
| 197 | + 'id' => $form[ 'id' ], | |
| 198 | + 'title' => $form[ 'title' ], | |
| 199 | 199 | ); | 
| 200 | 200 | } | 
| 201 | 201 | } | 
| @@ -227,9 +227,9 @@ discard block | ||
| 227 | 227 | } | 
| 228 | 228 | |
| 229 | 229 |  		if ( $form ) { | 
| 230 | -			foreach ( $form['fields'] as $field ) { | |
| 231 | -				if ( $include_parent_field || empty( $field['inputs'] ) ) { | |
| 232 | - $fields[ $field['id'] ] = array( | |
| 230 | +			foreach ( $form[ 'fields' ] as $field ) { | |
| 231 | +				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { | |
| 232 | + $fields[ $field[ 'id' ] ] = array( | |
| 233 | 233 | 'label' => rgar( $field, 'label' ), | 
| 234 | 234 | 'parent' => null, | 
| 235 | 235 | 'type' => rgar( $field, 'type' ), | 
| @@ -238,16 +238,16 @@ discard block | ||
| 238 | 238 | ); | 
| 239 | 239 | } | 
| 240 | 240 | |
| 241 | -				if ( $add_default_properties && ! empty( $field['inputs'] ) ) { | |
| 242 | -					foreach ( $field['inputs'] as $input ) { | |
| 241 | +				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { | |
| 242 | +					foreach ( $field[ 'inputs' ] as $input ) { | |
| 243 | 243 | /** | 
| 244 | 244 | * @hack | 
| 245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field | 
| 246 | 246 | */ | 
| 247 | -                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { | |
| 247 | +                        if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { | |
| 248 | 248 | continue; | 
| 249 | 249 | } | 
| 250 | - $fields[ (string)$input['id'] ] = array( | |
| 250 | + $fields[ (string)$input[ 'id' ] ] = array( | |
| 251 | 251 | 'label' => rgar( $input, 'label' ), | 
| 252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), | 
| 253 | 253 | 'parent' => $field, | 
| @@ -259,11 +259,11 @@ discard block | ||
| 259 | 259 | } | 
| 260 | 260 | |
| 261 | 261 | /** @since 1.14 */ | 
| 262 | -				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { | |
| 262 | +				if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { | |
| 263 | 263 | |
| 264 | -					foreach ( (array)$field['choices'] as $key => $input ) { | |
| 264 | +					foreach ( (array)$field[ 'choices' ] as $key => $input ) { | |
| 265 | 265 | |
| 266 | -						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} | |
| 266 | +						$input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} | |
| 267 | 267 | |
| 268 | 268 | $fields[ $input_id ] = array( | 
| 269 | 269 | 'label' => rgar( $input, 'text' ), | 
| @@ -279,25 +279,25 @@ discard block | ||
| 279 | 279 | /** | 
| 280 | 280 | * @since 1.8 | 
| 281 | 281 | */ | 
| 282 | -				if( 'quiz' === $field['type'] ) { | |
| 282 | +				if ( 'quiz' === $field[ 'type' ] ) { | |
| 283 | 283 | $has_quiz_fields = true; | 
| 284 | 284 | } | 
| 285 | 285 | |
| 286 | 286 | /** | 
| 287 | 287 | * @since 1.8 | 
| 288 | 288 | */ | 
| 289 | -				if( 'poll' === $field['type'] ) { | |
| 289 | +				if ( 'poll' === $field[ 'type' ] ) { | |
| 290 | 290 | $has_poll_fields = true; | 
| 291 | 291 | } | 
| 292 | 292 | |
| 293 | -				if( GFCommon::is_product_field( $field['type'] ) ){ | |
| 293 | +				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { | |
| 294 | 294 | $has_product_fields = true; | 
| 295 | 295 | } | 
| 296 | 296 | |
| 297 | 297 | /** | 
| 298 | 298 | * @hack Version 1.9 | 
| 299 | 299 | */ | 
| 300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; | |
| 300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; | |
| 301 | 301 | |
| 302 | 302 |  				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { | 
| 303 | 303 | $has_post_fields = true; | 
| @@ -309,7 +309,7 @@ discard block | ||
| 309 | 309 | * @since 1.7 | 
| 310 | 310 | */ | 
| 311 | 311 |  		if ( $has_post_fields ) { | 
| 312 | - $fields['post_id'] = array( | |
| 312 | + $fields[ 'post_id' ] = array( | |
| 313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), | 
| 314 | 314 | 'type' => 'post_id', | 
| 315 | 315 | ); | 
| @@ -320,10 +320,10 @@ discard block | ||
| 320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); | 
| 321 | 321 | |
| 322 | 322 |  			foreach ( $payment_fields as $payment_field ) { | 
| 323 | -				if( isset( $fields["{$payment_field->name}"] ) ) { | |
| 323 | +				if ( isset( $fields[ "{$payment_field->name}" ] ) ) { | |
| 324 | 324 | continue; | 
| 325 | 325 | } | 
| 326 | -				$fields["{$payment_field->name}"] = array( | |
| 326 | +				$fields[ "{$payment_field->name}" ] = array( | |
| 327 | 327 | 'label' => $payment_field->label, | 
| 328 | 328 | 'desc' => $payment_field->description, | 
| 329 | 329 | 'type' => $payment_field->name, | 
| @@ -334,25 +334,25 @@ discard block | ||
| 334 | 334 | /** | 
| 335 | 335 | * @since 1.8 | 
| 336 | 336 | */ | 
| 337 | -		if( $has_quiz_fields ) { | |
| 337 | +		if ( $has_quiz_fields ) { | |
| 338 | 338 | |
| 339 | - $fields['gquiz_score'] = array( | |
| 339 | + $fields[ 'gquiz_score' ] = array( | |
| 340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), | 
| 341 | 341 | 'type' => 'quiz_score', | 
| 342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), | 
| 343 | 343 | ); | 
| 344 | - $fields['gquiz_percent'] = array( | |
| 344 | + $fields[ 'gquiz_percent' ] = array( | |
| 345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), | 
| 346 | 346 | 'type' => 'quiz_percent', | 
| 347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), | 
| 348 | 348 | ); | 
| 349 | - $fields['gquiz_grade'] = array( | |
| 349 | + $fields[ 'gquiz_grade' ] = array( | |
| 350 | 350 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ | 
| 351 | 351 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), | 
| 352 | 352 | 'type' => 'quiz_grade', | 
| 353 | 353 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), | 
| 354 | 354 | ); | 
| 355 | - $fields['gquiz_is_pass'] = array( | |
| 355 | + $fields[ 'gquiz_is_pass' ] = array( | |
| 356 | 356 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), | 
| 357 | 357 | 'type' => 'quiz_is_pass', | 
| 358 | 358 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), | 
| @@ -374,9 +374,9 @@ discard block | ||
| 374 | 374 | |
| 375 | 375 | $fields = array(); | 
| 376 | 376 | |
| 377 | -		foreach ( $extra_fields as $key => $field ){ | |
| 378 | -			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { | |
| 379 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); | |
| 377 | +		foreach ( $extra_fields as $key => $field ) { | |
| 378 | +			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { | |
| 379 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); | |
| 380 | 380 | } | 
| 381 | 381 | } | 
| 382 | 382 | |
| @@ -416,32 +416,32 @@ discard block | ||
| 416 | 416 | 'search_criteria' => null, | 
| 417 | 417 | 'sorting' => null, | 
| 418 | 418 | 'paging' => null, | 
| 419 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), | |
| 419 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), | |
| 420 | 420 | ); | 
| 421 | 421 | |
| 422 | 422 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); | 
| 423 | 423 | |
| 424 | -		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { | |
| 425 | -			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { | |
| 424 | +		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { | |
| 425 | +			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { | |
| 426 | 426 | |
| 427 | 427 |  				if ( ! is_array( $filter ) ) { | 
| 428 | 428 | continue; | 
| 429 | 429 | } | 
| 430 | 430 | |
| 431 | 431 | // By default, we want searches to be wildcard for each field. | 
| 432 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; | |
| 432 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; | |
| 433 | 433 | |
| 434 | 434 | /** | 
| 435 | 435 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) | 
| 436 | 436 | * @param string $operator Existing search operator | 
| 437 | 437 | * @param array $filter array with `key`, `value`, `operator`, `type` keys | 
| 438 | 438 | */ | 
| 439 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); | |
| 439 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); | |
| 440 | 440 | } | 
| 441 | 441 | |
| 442 | 442 | // don't send just the [mode] without any field filter. | 
| 443 | -			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { | |
| 444 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); | |
| 443 | +			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { | |
| 444 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); | |
| 445 | 445 | } | 
| 446 | 446 | |
| 447 | 447 | } | 
| @@ -452,21 +452,21 @@ discard block | ||
| 452 | 452 | * Prepare date formats to be in Gravity Forms DB format; | 
| 453 | 453 | * $passed_criteria may include date formats incompatible with Gravity Forms. | 
| 454 | 454 | */ | 
| 455 | -		foreach ( array('start_date', 'end_date' ) as $key ) { | |
| 455 | +		foreach ( array( 'start_date', 'end_date' ) as $key ) { | |
| 456 | 456 | |
| 457 | -			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { | |
| 457 | +			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { | |
| 458 | 458 | |
| 459 | 459 | // Use date_create instead of new DateTime so it returns false if invalid date format. | 
| 460 | - $date = date_create( $criteria['search_criteria'][ $key ] ); | |
| 460 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); | |
| 461 | 461 | |
| 462 | 462 |  				if ( $date ) { | 
| 463 | 463 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. | 
| 464 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); | |
| 464 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); | |
| 465 | 465 |  				} else { | 
| 466 | 466 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. | 
| 467 | - unset( $criteria['search_criteria'][ $key ] ); | |
| 467 | + unset( $criteria[ 'search_criteria' ][ $key ] ); | |
| 468 | 468 | |
| 469 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); | |
| 469 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); | |
| 470 | 470 | } | 
| 471 | 471 | } | 
| 472 | 472 | } | 
| @@ -474,12 +474,12 @@ discard block | ||
| 474 | 474 | |
| 475 | 475 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter | 
| 476 | 476 |  		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { | 
| 477 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); | |
| 477 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); | |
| 478 | 478 |  		} elseif ( 'delete' === RGForms::get( 'action' ) ) { | 
| 479 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; | |
| 480 | -		} elseif( !isset( $criteria['context_view_id'] ) ) { | |
| 479 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; | |
| 480 | +		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { | |
| 481 | 481 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) | 
| 482 | - $criteria['context_view_id'] = null; | |
| 482 | + $criteria[ 'context_view_id' ] = null; | |
| 483 | 483 | } | 
| 484 | 484 | |
| 485 | 485 | /** | 
| @@ -488,7 +488,7 @@ discard block | ||
| 488 | 488 | * @param array $form_ids Forms to search | 
| 489 | 489 | * @param int $view_id ID of the view being used to search | 
| 490 | 490 | */ | 
| 491 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); | |
| 491 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); | |
| 492 | 492 | |
| 493 | 493 | return (array)$criteria; | 
| 494 | 494 | |
| @@ -519,7 +519,7 @@ discard block | ||
| 519 | 519 | /** Reduce # of database calls */ | 
| 520 | 520 | add_filter( 'gform_is_encrypted_field', '__return_false' ); | 
| 521 | 521 | |
| 522 | -		if ( ! empty( $criteria['cache'] ) ) { | |
| 522 | +		if ( ! empty( $criteria[ 'cache' ] ) ) { | |
| 523 | 523 | |
| 524 | 524 | $Cache = new GravityView_Cache( $form_ids, $criteria ); | 
| 525 | 525 | |
| @@ -527,7 +527,7 @@ discard block | ||
| 527 | 527 | |
| 528 | 528 | // Still update the total count when using cached results | 
| 529 | 529 |  				if ( ! is_null( $total ) ) { | 
| 530 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); | |
| 530 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); | |
| 531 | 531 | } | 
| 532 | 532 | |
| 533 | 533 | $return = $entries; | 
| @@ -547,9 +547,9 @@ discard block | ||
| 547 | 547 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); | 
| 548 | 548 | |
| 549 | 549 | // No entries returned from gravityview_before_get_entries | 
| 550 | -			if( is_null( $entries ) ) { | |
| 550 | +			if ( is_null( $entries ) ) { | |
| 551 | 551 | |
| 552 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); | |
| 552 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); | |
| 553 | 553 | |
| 554 | 554 |  				if ( is_wp_error( $entries ) ) { | 
| 555 | 555 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); | 
| @@ -558,7 +558,7 @@ discard block | ||
| 558 | 558 | } | 
| 559 | 559 | } | 
| 560 | 560 | |
| 561 | -			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { | |
| 561 | +			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { | |
| 562 | 562 | |
| 563 | 563 | // Cache results | 
| 564 | 564 | $Cache->set( $entries, 'entries' ); | 
| @@ -645,7 +645,7 @@ discard block | ||
| 645 | 645 | */ | 
| 646 | 646 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); | 
| 647 | 647 | |
| 648 | -			if( $check_entry_display ) { | |
| 648 | +			if ( $check_entry_display ) { | |
| 649 | 649 | // Is the entry allowed | 
| 650 | 650 | $entry = self::check_entry_display( $entry ); | 
| 651 | 651 | } | 
| @@ -678,12 +678,12 @@ discard block | ||
| 678 | 678 | |
| 679 | 679 | $value = false; | 
| 680 | 680 | |
| 681 | -		if( 'context' === $val1 ) { | |
| 681 | +		if ( 'context' === $val1 ) { | |
| 682 | 682 | |
| 683 | 683 | $matching_contexts = array( $val2 ); | 
| 684 | 684 | |
| 685 | 685 | // We allow for non-standard contexts. | 
| 686 | -			switch( $val2 ) { | |
| 686 | +			switch ( $val2 ) { | |
| 687 | 687 | // Check for either single or edit | 
| 688 | 688 | case 'singular': | 
| 689 | 689 | $matching_contexts = array( 'single', 'edit' ); | 
| @@ -743,7 +743,7 @@ discard block | ||
| 743 | 743 | return false; | 
| 744 | 744 | } | 
| 745 | 745 | |
| 746 | -		if ( empty( $entry['form_id'] ) ) { | |
| 746 | +		if ( empty( $entry[ 'form_id' ] ) ) { | |
| 747 | 747 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); | 
| 748 | 748 | return false; | 
| 749 | 749 | } | 
| @@ -751,26 +751,26 @@ discard block | ||
| 751 | 751 | $criteria = self::calculate_get_entries_criteria(); | 
| 752 | 752 | |
| 753 | 753 | // Make sure the current View is connected to the same form as the Entry | 
| 754 | -		if( ! empty( $criteria['context_view_id'] ) ) { | |
| 755 | - $context_view_id = intval( $criteria['context_view_id'] ); | |
| 754 | +		if ( ! empty( $criteria[ 'context_view_id' ] ) ) { | |
| 755 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); | |
| 756 | 756 | $context_form_id = gravityview_get_form_id( $context_view_id ); | 
| 757 | -			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { | |
| 758 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); | |
| 757 | +			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { | |
| 758 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); | |
| 759 | 759 | return false; | 
| 760 | 760 | } | 
| 761 | 761 | } | 
| 762 | 762 | |
| 763 | -		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { | |
| 763 | +		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { | |
| 764 | 764 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); | 
| 765 | 765 | return $entry; | 
| 766 | 766 | } | 
| 767 | 767 | |
| 768 | - $search_criteria = $criteria['search_criteria']; | |
| 768 | + $search_criteria = $criteria[ 'search_criteria' ]; | |
| 769 | 769 | unset( $criteria ); | 
| 770 | 770 | |
| 771 | 771 | // check entry status | 
| 772 | -		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { | |
| 773 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); | |
| 772 | +		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { | |
| 773 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); | |
| 774 | 774 | return false; | 
| 775 | 775 | } | 
| 776 | 776 | |
| @@ -778,37 +778,37 @@ discard block | ||
| 778 | 778 | // @todo: Does it make sense to apply the Date create filters to the single entry? | 
| 779 | 779 | |
| 780 | 780 | // field_filters | 
| 781 | -		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { | |
| 781 | +		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { | |
| 782 | 782 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); | 
| 783 | 783 | return $entry; | 
| 784 | 784 | } | 
| 785 | 785 | |
| 786 | - $filters = $search_criteria['field_filters']; | |
| 786 | + $filters = $search_criteria[ 'field_filters' ]; | |
| 787 | 787 | unset( $search_criteria ); | 
| 788 | 788 | |
| 789 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; | |
| 790 | - unset( $filters['mode'] ); | |
| 789 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; | |
| 790 | + unset( $filters[ 'mode' ] ); | |
| 791 | 791 | |
| 792 | - $form = self::get_form( $entry['form_id'] ); | |
| 792 | + $form = self::get_form( $entry[ 'form_id' ] ); | |
| 793 | 793 | |
| 794 | 794 |  		foreach ( $filters as $filter ) { | 
| 795 | 795 | |
| 796 | -			if ( ! isset( $filter['key'] ) ) { | |
| 796 | +			if ( ! isset( $filter[ 'key' ] ) ) { | |
| 797 | 797 | continue; | 
| 798 | 798 | } | 
| 799 | 799 | |
| 800 | - $k = $filter['key']; | |
| 800 | + $k = $filter[ 'key' ]; | |
| 801 | 801 | |
| 802 | 802 |  			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { | 
| 803 | 803 | $field_value = $entry[ $k ]; | 
| 804 | 804 | $field = null; | 
| 805 | 805 |  			} else { | 
| 806 | 806 | $field = self::get_field( $form, $k ); | 
| 807 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); | |
| 807 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); | |
| 808 | 808 | } | 
| 809 | 809 | |
| 810 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; | |
| 811 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); | |
| 810 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; | |
| 811 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); | |
| 812 | 812 | |
| 813 | 813 | // verify if we are already free to go! | 
| 814 | 814 |  			if ( ! $is_value_match && 'all' === $mode ) { | 
| @@ -866,18 +866,18 @@ discard block | ||
| 866 | 866 | * Gravity Forms code to adjust date to locally-configured Time Zone | 
| 867 | 867 | * @see GFCommon::format_date() for original code | 
| 868 | 868 | */ | 
| 869 | - $date_gmt_time = mysql2date( 'G', $date_string ); | |
| 869 | + $date_gmt_time = mysql2date( 'G', $date_string ); | |
| 870 | 870 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); | 
| 871 | 871 | |
| 872 | - $format = rgar( $atts, 'format' ); | |
| 873 | - $is_human = ! empty( $atts['human'] ); | |
| 874 | - $is_diff = ! empty( $atts['diff'] ); | |
| 875 | - $is_raw = ! empty( $atts['raw'] ); | |
| 876 | - $is_timestamp = ! empty( $atts['timestamp'] ); | |
| 877 | - $include_time = ! empty( $atts['time'] ); | |
| 872 | + $format = rgar( $atts, 'format' ); | |
| 873 | + $is_human = ! empty( $atts[ 'human' ] ); | |
| 874 | + $is_diff = ! empty( $atts[ 'diff' ] ); | |
| 875 | + $is_raw = ! empty( $atts[ 'raw' ] ); | |
| 876 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); | |
| 877 | + $include_time = ! empty( $atts[ 'time' ] ); | |
| 878 | 878 | |
| 879 | 879 | // If we're using time diff, we want to have a different default format | 
| 880 | -		if( empty( $format ) ) { | |
| 880 | +		if ( empty( $format ) ) { | |
| 881 | 881 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ | 
| 882 | 882 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); | 
| 883 | 883 | } | 
| @@ -885,7 +885,7 @@ discard block | ||
| 885 | 885 | // If raw was specified, don't modify the stored value | 
| 886 | 886 |  		if ( $is_raw ) { | 
| 887 | 887 | $formatted_date = $date_string; | 
| 888 | -		} elseif( $is_timestamp ) { | |
| 888 | +		} elseif ( $is_timestamp ) { | |
| 889 | 889 | $formatted_date = $date_local_timestamp; | 
| 890 | 890 |  		} elseif ( $is_diff ) { | 
| 891 | 891 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); | 
| @@ -913,7 +913,7 @@ discard block | ||
| 913 | 913 | } | 
| 914 | 914 | |
| 915 | 915 | $field = self::get_field( $form, $field_id ); | 
| 916 | - return isset( $field['label'] ) ? $field['label'] : ''; | |
| 916 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; | |
| 917 | 917 | |
| 918 | 918 | } | 
| 919 | 919 | |
| @@ -931,7 +931,7 @@ discard block | ||
| 931 | 931 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist | 
| 932 | 932 | */ | 
| 933 | 933 |  	public static function get_field( $form, $field_id ) { | 
| 934 | -		if ( class_exists( 'GFFormsModel' ) ){ | |
| 934 | +		if ( class_exists( 'GFFormsModel' ) ) { | |
| 935 | 935 | return GFFormsModel::get_field( $form, $field_id ); | 
| 936 | 936 |  		} else { | 
| 937 | 937 | return null; | 
| @@ -978,19 +978,19 @@ discard block | ||
| 978 | 978 | $shortcodes = array(); | 
| 979 | 979 | |
| 980 | 980 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); | 
| 981 | -			if ( empty( $matches ) ){ | |
| 981 | +			if ( empty( $matches ) ) { | |
| 982 | 982 | return false; | 
| 983 | 983 | } | 
| 984 | 984 | |
| 985 | 985 |  			foreach ( $matches as $shortcode ) { | 
| 986 | -				if ( $tag === $shortcode[2] ) { | |
| 986 | +				if ( $tag === $shortcode[ 2 ] ) { | |
| 987 | 987 | |
| 988 | 988 | // Changed this to $shortcode instead of true so we get the parsed atts. | 
| 989 | - $shortcodes[] = $shortcode; | |
| 989 | + $shortcodes[ ] = $shortcode; | |
| 990 | 990 | |
| 991 | -				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { | |
| 992 | -					foreach( $results as $result ) { | |
| 993 | - $shortcodes[] = $result; | |
| 991 | +				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { | |
| 992 | +					foreach ( $results as $result ) { | |
| 993 | + $shortcodes[ ] = $result; | |
| 994 | 994 | } | 
| 995 | 995 | } | 
| 996 | 996 | } | 
| @@ -1141,7 +1141,7 @@ discard block | ||
| 1141 | 1141 | * @return string html | 
| 1142 | 1142 | */ | 
| 1143 | 1143 |  	public static function get_sortable_fields( $formid, $current = '' ) { | 
| 1144 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; | |
| 1144 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; | |
| 1145 | 1145 | |
| 1146 | 1146 |  		if ( empty( $formid ) ) { | 
| 1147 | 1147 | return $output; | 
| @@ -1154,11 +1154,11 @@ discard block | ||
| 1154 | 1154 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); | 
| 1155 | 1155 | |
| 1156 | 1156 |  			foreach ( $fields as $id => $field ) { | 
| 1157 | -				if ( in_array( $field['type'], $blacklist_field_types ) ) { | |
| 1157 | +				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { | |
| 1158 | 1158 | continue; | 
| 1159 | 1159 | } | 
| 1160 | 1160 | |
| 1161 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; | |
| 1161 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; | |
| 1162 | 1162 | } | 
| 1163 | 1163 | } | 
| 1164 | 1164 | |
| @@ -1193,9 +1193,9 @@ discard block | ||
| 1193 | 1193 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); | 
| 1194 | 1194 | |
| 1195 | 1195 | // TODO: Convert to using array_filter | 
| 1196 | -		foreach( $fields as $id => $field ) { | |
| 1196 | +		foreach ( $fields as $id => $field ) { | |
| 1197 | 1197 | |
| 1198 | -			if( in_array( $field['type'], $blacklist_field_types ) ) { | |
| 1198 | +			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { | |
| 1199 | 1199 | unset( $fields[ $id ] ); | 
| 1200 | 1200 | } | 
| 1201 | 1201 | } | 
| @@ -1236,14 +1236,14 @@ discard block | ||
| 1236 | 1236 | * @param int|array $field field key or field array | 
| 1237 | 1237 | * @return boolean | 
| 1238 | 1238 | */ | 
| 1239 | -	public static function is_field_numeric(  $form = null, $field = '' ) { | |
| 1239 | +	public static function is_field_numeric( $form = null, $field = '' ) { | |
| 1240 | 1240 | |
| 1241 | 1241 |  		if ( ! is_array( $form ) && ! is_array( $field ) ) { | 
| 1242 | 1242 | $form = self::get_form( $form ); | 
| 1243 | 1243 | } | 
| 1244 | 1244 | |
| 1245 | 1245 | // If entry meta, it's a string. Otherwise, numeric | 
| 1246 | -		if( ! is_numeric( $field ) && is_string( $field ) ) { | |
| 1246 | +		if ( ! is_numeric( $field ) && is_string( $field ) ) { | |
| 1247 | 1247 | $type = $field; | 
| 1248 | 1248 |  		} else { | 
| 1249 | 1249 | $type = self::get_field_type( $form, $field ); | 
| @@ -1257,9 +1257,9 @@ discard block | ||
| 1257 | 1257 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); | 
| 1258 | 1258 | |
| 1259 | 1259 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true | 
| 1260 | -		if( $gv_field = GravityView_Fields::get( $type ) ) { | |
| 1261 | -			if( true === $gv_field->is_numeric ) { | |
| 1262 | - $numeric_types[] = $gv_field->is_numeric; | |
| 1260 | +		if ( $gv_field = GravityView_Fields::get( $type ) ) { | |
| 1261 | +			if ( true === $gv_field->is_numeric ) { | |
| 1262 | + $numeric_types[ ] = $gv_field->is_numeric; | |
| 1263 | 1263 | } | 
| 1264 | 1264 | } | 
| 1265 | 1265 | |
| @@ -1409,11 +1409,11 @@ discard block | ||
| 1409 | 1409 | $final_atts = array_filter( $final_atts ); | 
| 1410 | 1410 | |
| 1411 | 1411 | // If the href wasn't passed as an attribute, use the value passed to the function | 
| 1412 | -		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { | |
| 1413 | - $final_atts['href'] = $href; | |
| 1412 | +		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { | |
| 1413 | + $final_atts[ 'href' ] = $href; | |
| 1414 | 1414 | } | 
| 1415 | 1415 | |
| 1416 | - $final_atts['href'] = esc_url_raw( $href ); | |
| 1416 | + $final_atts[ 'href' ] = esc_url_raw( $href ); | |
| 1417 | 1417 | |
| 1418 | 1418 | // Sort the attributes alphabetically, to help testing | 
| 1419 | 1419 | ksort( $final_atts ); | 
| @@ -1424,7 +1424,7 @@ discard block | ||
| 1424 | 1424 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); | 
| 1425 | 1425 | } | 
| 1426 | 1426 | |
| 1427 | -		if( '' !== $output ) { | |
| 1427 | +		if ( '' !== $output ) { | |
| 1428 | 1428 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; | 
| 1429 | 1429 | } | 
| 1430 | 1430 | |
| @@ -1448,7 +1448,7 @@ discard block | ||
| 1448 | 1448 |  	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { | 
| 1449 | 1449 | $merged = $array1; | 
| 1450 | 1450 | |
| 1451 | -		foreach ( $array2 as $key => &$value )  { | |
| 1451 | +		foreach ( $array2 as $key => &$value ) { | |
| 1452 | 1452 |  			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { | 
| 1453 | 1453 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); | 
| 1454 | 1454 |  			} else { | 
| @@ -1483,7 +1483,7 @@ discard block | ||
| 1483 | 1483 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) | 
| 1484 | 1484 | * @param array $settings Settings array, with `number` key defining the # of users to display | 
| 1485 | 1485 | */ | 
| 1486 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); | |
| 1486 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); | |
| 1487 | 1487 | |
| 1488 | 1488 | return get_users( $get_users_settings ); | 
| 1489 | 1489 | } | 
| @@ -1498,7 +1498,7 @@ discard block | ||
| 1498 | 1498 | * @return string | 
| 1499 | 1499 | */ | 
| 1500 | 1500 |      public static function generate_notice( $notice, $class = '' ) { | 
| 1501 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; | |
| 1501 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; | |
| 1502 | 1502 | } | 
| 1503 | 1503 | |
| 1504 | 1504 | |
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | die; | 
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { | |
| 19 | +if ( ! class_exists( 'Gamajo_Template_Loader' ) ) { | |
| 20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); | 
| 21 | 21 | } | 
| 22 | 22 | |
| @@ -157,8 +157,8 @@ discard block | ||
| 157 | 157 | 'atts' => NULL, | 
| 158 | 158 | ) ); | 
| 159 | 159 | |
| 160 | -		foreach ($atts as $key => $value) { | |
| 161 | -			if( is_null( $value ) ) { | |
| 160 | +		foreach ( $atts as $key => $value ) { | |
| 161 | +			if ( is_null( $value ) ) { | |
| 162 | 162 | continue; | 
| 163 | 163 | } | 
| 164 | 164 |  			$this->{$key} = $value; | 
| @@ -189,7 +189,7 @@ discard block | ||
| 189 | 189 | */ | 
| 190 | 190 |  	static function getInstance( $passed_post = NULL ) { | 
| 191 | 191 | |
| 192 | -		if( empty( self::$instance ) ) { | |
| 192 | +		if ( empty( self::$instance ) ) { | |
| 193 | 193 | self::$instance = new self( $passed_post ); | 
| 194 | 194 | } | 
| 195 | 195 | |
| @@ -202,8 +202,8 @@ discard block | ||
| 202 | 202 | */ | 
| 203 | 203 |  	public function getCurrentField( $key = NULL ) { | 
| 204 | 204 | |
| 205 | -		if( !empty( $key ) ) { | |
| 206 | -			if( isset( $this->_current_field[ $key ] ) ) { | |
| 205 | +		if ( ! empty( $key ) ) { | |
| 206 | +			if ( isset( $this->_current_field[ $key ] ) ) { | |
| 207 | 207 | return $this->_current_field[ $key ]; | 
| 208 | 208 | } | 
| 209 | 209 | return NULL; | 
| @@ -214,16 +214,16 @@ discard block | ||
| 214 | 214 | |
| 215 | 215 |  	public function setCurrentFieldSetting( $key, $value ) { | 
| 216 | 216 | |
| 217 | -		if( !empty( $this->_current_field ) ) { | |
| 218 | - $this->_current_field['field_settings'][ $key ] = $value; | |
| 217 | +		if ( ! empty( $this->_current_field ) ) { | |
| 218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; | |
| 219 | 219 | } | 
| 220 | 220 | |
| 221 | 221 | } | 
| 222 | 222 | |
| 223 | 223 |  	public function getCurrentFieldSetting( $key ) { | 
| 224 | -		$settings = $this->getCurrentField('field_settings'); | |
| 224 | + $settings = $this->getCurrentField( 'field_settings' ); | |
| 225 | 225 | |
| 226 | -		if( $settings && !empty( $settings[ $key ] ) ) { | |
| 226 | +		if ( $settings && ! empty( $settings[ $key ] ) ) { | |
| 227 | 227 | return $settings[ $key ]; | 
| 228 | 228 | } | 
| 229 | 229 | |
| @@ -254,8 +254,8 @@ discard block | ||
| 254 | 254 | */ | 
| 255 | 255 |  	public function getAtts( $key = NULL ) { | 
| 256 | 256 | |
| 257 | -		if( !empty( $key ) ) { | |
| 258 | -			if( isset( $this->atts[ $key ] ) ) { | |
| 257 | +		if ( ! empty( $key ) ) { | |
| 258 | +			if ( isset( $this->atts[ $key ] ) ) { | |
| 259 | 259 | return $this->atts[ $key ]; | 
| 260 | 260 | } | 
| 261 | 261 | return NULL; | 
| @@ -321,7 +321,7 @@ discard block | ||
| 321 | 321 | |
| 322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; | 
| 323 | 323 | |
| 324 | -		if( $fields && !empty( $key ) ) { | |
| 324 | +		if ( $fields && ! empty( $key ) ) { | |
| 325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; | 
| 326 | 326 | } | 
| 327 | 327 | |
| @@ -341,8 +341,8 @@ discard block | ||
| 341 | 341 | */ | 
| 342 | 342 |  	public function getField( $key ) { | 
| 343 | 343 | |
| 344 | -		if( !empty( $key ) ) { | |
| 345 | -			if( isset( $this->fields[ $key ] ) ) { | |
| 344 | +		if ( ! empty( $key ) ) { | |
| 345 | +			if ( isset( $this->fields[ $key ] ) ) { | |
| 346 | 346 | return $this->fields[ $key ]; | 
| 347 | 347 | } | 
| 348 | 348 | } | 
| @@ -442,8 +442,8 @@ discard block | ||
| 442 | 442 |  	public function getPaginationCounts() { | 
| 443 | 443 | |
| 444 | 444 | $paging = $this->getPaging(); | 
| 445 | - $offset = $paging['offset']; | |
| 446 | - $page_size = $paging['page_size']; | |
| 445 | + $offset = $paging[ 'offset' ]; | |
| 446 | + $page_size = $paging[ 'page_size' ]; | |
| 447 | 447 | $total = $this->getTotalEntries(); | 
| 448 | 448 | |
| 449 | 449 |  		if ( empty( $total ) ) { | 
| @@ -464,7 +464,7 @@ discard block | ||
| 464 | 464 | */ | 
| 465 | 465 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); | 
| 466 | 466 | |
| 467 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); | |
| 467 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); | |
| 468 | 468 | } | 
| 469 | 469 | |
| 470 | 470 | /** | 
| @@ -548,16 +548,16 @@ discard block | ||
| 548 | 548 | */ | 
| 549 | 549 |  	public function getCurrentEntry() { | 
| 550 | 550 | |
| 551 | -		if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { | |
| 551 | +		if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { | |
| 552 | 552 | $entries = $this->getEntries(); | 
| 553 | - $entry = $entries[0]; | |
| 553 | + $entry = $entries[ 0 ]; | |
| 554 | 554 |  		} else { | 
| 555 | 555 | $entry = $this->_current_entry; | 
| 556 | 556 | } | 
| 557 | 557 | |
| 558 | 558 | /** @since 1.16 Fixes DataTables empty entry issue */ | 
| 559 | -		if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { | |
| 560 | - $entry = $this->_current_field['entry']; | |
| 559 | +		if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { | |
| 560 | + $entry = $this->_current_field[ 'entry' ]; | |
| 561 | 561 | } | 
| 562 | 562 | |
| 563 | 563 | return $entry; | 
| @@ -594,8 +594,8 @@ discard block | ||
| 594 | 594 | */ | 
| 595 | 595 |  	public function renderZone( $zone = '', $atts = array(), $echo = true ) { | 
| 596 | 596 | |
| 597 | -		if( empty( $zone ) ) { | |
| 598 | -			do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); | |
| 597 | +		if ( empty( $zone ) ) { | |
| 598 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); | |
| 599 | 599 | return NULL; | 
| 600 | 600 | } | 
| 601 | 601 | |
| @@ -604,33 +604,33 @@ discard block | ||
| 604 | 604 | 'context' => $this->getContext(), | 
| 605 | 605 | 'entry' => $this->getCurrentEntry(), | 
| 606 | 606 | 'form' => $this->getForm(), | 
| 607 | -			'hide_empty' => $this->getAtts('hide_empty'), | |
| 607 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), | |
| 608 | 608 | ); | 
| 609 | 609 | |
| 610 | 610 | $final_atts = wp_parse_args( $atts, $defaults ); | 
| 611 | 611 | |
| 612 | 612 | $output = ''; | 
| 613 | 613 | |
| 614 | -		$final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; | |
| 614 | +		$final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; | |
| 615 | 615 | |
| 616 | - $fields = $this->getField( $final_atts['zone_id'] ); | |
| 616 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); | |
| 617 | 617 | |
| 618 | 618 | // Backward compatibility | 
| 619 | -		if( 'table' === $this->getTemplatePartSlug() ) { | |
| 619 | +		if ( 'table' === $this->getTemplatePartSlug() ) { | |
| 620 | 620 | /** | 
| 621 | 621 | * Modify the fields displayed in the table | 
| 622 | 622 | * @var array | 
| 623 | 623 | */ | 
| 624 | -			$fields = apply_filters("gravityview_table_cells", $fields, $this ); | |
| 624 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); | |
| 625 | 625 | } | 
| 626 | 626 | |
| 627 | -		if( empty( $fields ) ) { | |
| 627 | +		if ( empty( $fields ) ) { | |
| 628 | 628 | return NULL; | 
| 629 | 629 | } | 
| 630 | 630 | |
| 631 | 631 | $field_output = ''; | 
| 632 | 632 |  		foreach ( $fields as $field ) { | 
| 633 | - $final_atts['field'] = $field; | |
| 633 | + $final_atts[ 'field' ] = $field; | |
| 634 | 634 | |
| 635 | 635 | $field_output .= gravityview_field_output( $final_atts ); | 
| 636 | 636 | } | 
| @@ -641,21 +641,21 @@ discard block | ||
| 641 | 641 | * @since 1.7.6 | 
| 642 | 642 | * @param boolean $hide_empty_zone Default: false | 
| 643 | 643 | */ | 
| 644 | -		if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { | |
| 644 | +		if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { | |
| 645 | 645 | return NULL; | 
| 646 | 646 | } | 
| 647 | 647 | |
| 648 | -		if( !empty( $final_atts['wrapper_class'] ) ) { | |
| 649 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; | |
| 648 | +		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { | |
| 649 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; | |
| 650 | 650 | } | 
| 651 | 651 | |
| 652 | 652 | $output .= $field_output; | 
| 653 | 653 | |
| 654 | -		if( !empty( $final_atts['wrapper_class'] ) ) { | |
| 654 | +		if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { | |
| 655 | 655 | $output .= '</div>'; | 
| 656 | 656 | } | 
| 657 | 657 | |
| 658 | -		if( $echo ) { | |
| 658 | +		if ( $echo ) { | |
| 659 | 659 | echo $output; | 
| 660 | 660 | } | 
| 661 | 661 | |
| @@ -673,7 +673,7 @@ discard block | ||
| 673 | 673 | */ | 
| 674 | 674 |  	function locate_template( $template_names, $load = false, $require_once = true ) { | 
| 675 | 675 | |
| 676 | -		if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { | |
| 676 | +		if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { | |
| 677 | 677 | |
| 678 | 678 | $located = $this->located_templates[ $template_names ]; | 
| 679 | 679 | |
| @@ -682,7 +682,7 @@ discard block | ||
| 682 | 682 | // Set $load to always false so we handle it here. | 
| 683 | 683 | $located = parent::locate_template( $template_names, false, $require_once ); | 
| 684 | 684 | |
| 685 | -			if( is_string( $template_names ) ) { | |
| 685 | +			if ( is_string( $template_names ) ) { | |
| 686 | 686 | $this->located_templates[ $template_names ] = $located; | 
| 687 | 687 | } | 
| 688 | 688 | } | 
| @@ -700,7 +700,7 @@ discard block | ||
| 700 | 700 | * @return mixed|null The stored data. | 
| 701 | 701 | */ | 
| 702 | 702 |  	public function __get( $name ) { | 
| 703 | -		if( isset( $this->{$name} ) ) { | |
| 703 | +		if ( isset( $this->{$name} ) ) { | |
| 704 | 704 |  			return $this->{$name}; | 
| 705 | 705 |  		} else { | 
| 706 | 706 | return NULL; | 
| @@ -729,15 +729,15 @@ discard block | ||
| 729 | 729 | $additional = array(); | 
| 730 | 730 | |
| 731 | 731 | // form-19-table-body.php | 
| 732 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); | |
| 732 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); | |
| 733 | 733 | |
| 734 | 734 | // view-3-table-body.php | 
| 735 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); | |
| 735 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); | |
| 736 | 736 | |
| 737 | -		if( $this->getPostId() ) { | |
| 737 | +		if ( $this->getPostId() ) { | |
| 738 | 738 | |
| 739 | 739 | // page-19-table-body.php | 
| 740 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); | |
| 740 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); | |
| 741 | 741 | } | 
| 742 | 742 | |
| 743 | 743 | // Combine with existing table-body.php and table.php | 
| @@ -759,7 +759,7 @@ discard block | ||
| 759 | 759 | |
| 760 | 760 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); | 
| 761 | 761 | |
| 762 | -		if( !empty( $template_file) ) { | |
| 762 | +		if ( ! empty( $template_file ) ) { | |
| 763 | 763 | |
| 764 | 764 |  			if ( $require_once ) { | 
| 765 | 765 | require_once( $template_file ); | 
| @@ -776,7 +776,7 @@ discard block | ||
| 776 | 776 | */ | 
| 777 | 777 |  	public function render_widget_hooks( $view_id ) { | 
| 778 | 778 | |
| 779 | -		if( empty( $view_id ) || 'single' == gravityview_get_context() ) { | |
| 779 | +		if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { | |
| 780 | 780 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); | 
| 781 | 781 | return; | 
| 782 | 782 | } | 
| @@ -784,9 +784,9 @@ discard block | ||
| 784 | 784 | $view_data = gravityview_get_current_view_data( $view_id ); | 
| 785 | 785 | |
| 786 | 786 | // get View widget configuration | 
| 787 | - $widgets = (array)$view_data['widgets']; | |
| 787 | + $widgets = (array)$view_data[ 'widgets' ]; | |
| 788 | 788 | |
| 789 | -		switch( current_filter() ) { | |
| 789 | +		switch ( current_filter() ) { | |
| 790 | 790 | default: | 
| 791 | 791 | case 'gravityview_before': | 
| 792 | 792 | $zone = 'header'; | 
| @@ -800,9 +800,9 @@ discard block | ||
| 800 | 800 | * Filter widgets not in the current zone | 
| 801 | 801 | * @since 1.16 | 
| 802 | 802 | */ | 
| 803 | -		foreach( $widgets as $key => $widget ) { | |
| 803 | +		foreach ( $widgets as $key => $widget ) { | |
| 804 | 804 | // The widget isn't in the current zone | 
| 805 | -			if( false === strpos( $key, $zone ) ) { | |
| 805 | +			if ( false === strpos( $key, $zone ) ) { | |
| 806 | 806 | unset( $widgets[ $key ] ); | 
| 807 | 807 | } | 
| 808 | 808 | } | 
| @@ -817,8 +817,8 @@ discard block | ||
| 817 | 817 | } | 
| 818 | 818 | |
| 819 | 819 | // Prevent being called twice | 
| 820 | -		if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { | |
| 821 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); | |
| 820 | +		if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { | |
| 821 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); | |
| 822 | 822 | return; | 
| 823 | 823 | } | 
| 824 | 824 | |
| @@ -829,7 +829,7 @@ discard block | ||
| 829 | 829 | |
| 830 | 830 | $default_css_class = 'gv-grid gv-widgets-' . $zone; | 
| 831 | 831 | |
| 832 | -		if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { | |
| 832 | +		if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { | |
| 833 | 833 | $default_css_class .= ' gv-widgets-no-results'; | 
| 834 | 834 | } | 
| 835 | 835 | |
| @@ -840,7 +840,7 @@ discard block | ||
| 840 | 840 | * @param string $zone Current widget zone, either `header` or `footer` | 
| 841 | 841 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` | 
| 842 | 842 | */ | 
| 843 | -		$css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); | |
| 843 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); | |
| 844 | 844 | |
| 845 | 845 | $css_class = gravityview_sanitize_html_class( $css_class ); | 
| 846 | 846 | |
| @@ -848,17 +848,17 @@ discard block | ||
| 848 | 848 | ?> | 
| 849 | 849 | <div class="<?php echo $css_class; ?>"> | 
| 850 | 850 | <?php | 
| 851 | -			foreach( $rows as $row ) { | |
| 852 | -				foreach( $row as $col => $areas ) { | |
| 853 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; | |
| 851 | +			foreach ( $rows as $row ) { | |
| 852 | +				foreach ( $row as $col => $areas ) { | |
| 853 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; | |
| 854 | 854 | ?> | 
| 855 | 855 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> | 
| 856 | 856 | <?php | 
| 857 | -						if( !empty( $areas ) ) { | |
| 858 | -							foreach( $areas as $area ) { | |
| 859 | -								if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { | |
| 860 | -									foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { | |
| 861 | -										do_action( "gravityview_render_widget_{$widget['id']}", $widget ); | |
| 857 | +						if ( ! empty( $areas ) ) { | |
| 858 | +							foreach ( $areas as $area ) { | |
| 859 | +								if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { | |
| 860 | +									foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { | |
| 861 | +										do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); | |
| 862 | 862 | } | 
| 863 | 863 | } | 
| 864 | 864 | } | 
| @@ -874,8 +874,8 @@ discard block | ||
| 874 | 874 | * Prevent widgets from being called twice. | 
| 875 | 875 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin | 
| 876 | 876 | */ | 
| 877 | -		if( did_action( 'loop_start' ) ) { | |
| 878 | - do_action( $zone.'_'.$view_id.'_widgets' ); | |
| 877 | +		if ( did_action( 'loop_start' ) ) { | |
| 878 | + do_action( $zone . '_' . $view_id . '_widgets' ); | |
| 879 | 879 | } | 
| 880 | 880 | } | 
| 881 | 881 | |
| @@ -85,8 +85,8 @@ discard block | ||
| 85 | 85 |  	private function __construct() {} | 
| 86 | 86 | |
| 87 | 87 |  	private function initialize() { | 
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); | |
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); | |
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); | |
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); | |
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() | 
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); | 
| @@ -233,15 +233,15 @@ discard block | ||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; | 
| 235 | 235 | |
| 236 | -		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { | |
| 236 | +		} elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { | |
| 237 | 237 | /** | 
| 238 | 238 | * used on a has_multiple_views context | 
| 239 | 239 | * @see GravityView_API::entry_link | 
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() | 
| 241 | 241 | */ | 
| 242 | - $this->context_view_id = $_GET['gvid']; | |
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; | |
| 243 | 243 | |
| 244 | -		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  { | |
| 244 | +		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { | |
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); | 
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); | 
| 247 | 247 | unset( $array_keys ); | 
| @@ -269,7 +269,7 @@ discard block | ||
| 269 | 269 | global $post; | 
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. | 
| 272 | -		if ( GravityView_Plugin::is_admin() )  { | |
| 272 | +		if ( GravityView_Plugin::is_admin() ) { | |
| 273 | 273 | return; | 
| 274 | 274 | } | 
| 275 | 275 | |
| @@ -281,7 +281,7 @@ discard block | ||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); | 
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); | |
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); | |
| 285 | 285 | $this->setPostId( $post_id ); | 
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; | 
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); | 
| @@ -317,7 +317,7 @@ discard block | ||
| 317 | 317 | |
| 318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); | 
| 319 | 319 | |
| 320 | -		if( 'post' === $search_method ) { | |
| 320 | +		if ( 'post' === $search_method ) { | |
| 321 | 321 | $get = $_POST; | 
| 322 | 322 |  		} else { | 
| 323 | 323 | $get = $_GET; | 
| @@ -373,20 +373,20 @@ discard block | ||
| 373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop | 
| 374 | 374 | * @param array $entry Current entry | 
| 375 | 375 | */ | 
| 376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); | |
| 376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); | |
| 377 | 377 | |
| 378 | 378 |  		if ( ! $apply_outside_loop ) { | 
| 379 | 379 | return $title; | 
| 380 | 380 | } | 
| 381 | 381 | |
| 382 | 382 | // User reported WooCommerce doesn't pass two args. | 
| 383 | -		if ( empty( $passed_post_id ) )  { | |
| 383 | +		if ( empty( $passed_post_id ) ) { | |
| 384 | 384 | return $title; | 
| 385 | 385 | } | 
| 386 | 386 | |
| 387 | 387 | // Don't modify the title for anything other than the current view/post. | 
| 388 | 388 | // This is true for embedded shortcodes and Views. | 
| 389 | -		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { | |
| 389 | +		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { | |
| 390 | 390 | return $title; | 
| 391 | 391 | } | 
| 392 | 392 | |
| @@ -396,19 +396,19 @@ discard block | ||
| 396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); | 
| 397 | 397 |  		} else { | 
| 398 | 398 |  			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { | 
| 399 | -				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { | |
| 399 | +				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { | |
| 400 | 400 | $view_meta = $view_data; | 
| 401 | 401 | break; | 
| 402 | 402 | } | 
| 403 | 403 | } | 
| 404 | 404 | } | 
| 405 | 405 | |
| 406 | -		if ( ! empty( $view_meta['atts']['single_title'] ) ) { | |
| 406 | +		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { | |
| 407 | 407 | |
| 408 | - $title = $view_meta['atts']['single_title']; | |
| 408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; | |
| 409 | 409 | |
| 410 | 410 | // We are allowing HTML in the fields, so no escaping the output | 
| 411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); | |
| 411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); | |
| 412 | 412 | |
| 413 | 413 | $title = do_shortcode( $title ); | 
| 414 | 414 | } | 
| @@ -509,7 +509,7 @@ discard block | ||
| 509 | 509 |  	public function render_view( $passed_args ) { | 
| 510 | 510 | |
| 511 | 511 | // validate attributes | 
| 512 | -		if ( empty( $passed_args['id'] ) ) { | |
| 512 | +		if ( empty( $passed_args[ 'id' ] ) ) { | |
| 513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); | 
| 514 | 514 | return null; | 
| 515 | 515 | } | 
| @@ -531,7 +531,7 @@ discard block | ||
| 531 | 531 | return null; | 
| 532 | 532 | } | 
| 533 | 533 | |
| 534 | - $view_id = $passed_args['id']; | |
| 534 | + $view_id = $passed_args[ 'id' ]; | |
| 535 | 535 | |
| 536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); | 
| 537 | 537 | |
| @@ -544,7 +544,7 @@ discard block | ||
| 544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); | 
| 545 | 545 | |
| 546 | 546 | //Override shortcode args over View template settings | 
| 547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); | |
| 547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); | |
| 548 | 548 | |
| 549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); | 
| 550 | 550 | |
| @@ -566,11 +566,11 @@ discard block | ||
| 566 | 566 | * Don't render View if user isn't allowed to see it | 
| 567 | 567 | * @since 1.15 | 
| 568 | 568 | */ | 
| 569 | -		if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { | |
| 569 | +		if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { | |
| 570 | 570 | return null; | 
| 571 | 571 | } | 
| 572 | 572 | |
| 573 | -		if( $this->isGravityviewPostType() ) { | |
| 573 | +		if ( $this->isGravityviewPostType() ) { | |
| 574 | 574 | |
| 575 | 575 | /** | 
| 576 | 576 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? | 
| @@ -582,9 +582,9 @@ discard block | ||
| 582 | 582 | */ | 
| 583 | 583 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); | 
| 584 | 584 | |
| 585 | - $embed_only = ! empty( $atts['embed_only'] ); | |
| 585 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); | |
| 586 | 586 | |
| 587 | -			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { | |
| 587 | +			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { | |
| 588 | 588 | return __( 'You are not allowed to view this content.', 'gravityview' ); | 
| 589 | 589 | } | 
| 590 | 590 | } | 
| @@ -599,7 +599,7 @@ discard block | ||
| 599 | 599 | |
| 600 | 600 | $gravityview_view = new GravityView_View( $view_data ); | 
| 601 | 601 | |
| 602 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); | |
| 602 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); | |
| 603 | 603 | |
| 604 | 604 | $gravityview_view->setPostId( $post_id ); | 
| 605 | 605 | |
| @@ -609,20 +609,20 @@ discard block | ||
| 609 | 609 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); | 
| 610 | 610 | |
| 611 | 611 | //fetch template and slug | 
| 612 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); | |
| 612 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); | |
| 613 | 613 | |
| 614 | 614 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); | 
| 615 | 615 | |
| 616 | 616 | /** | 
| 617 | 617 | * Disable fetching initial entries for views that don't need it (DataTables) | 
| 618 | 618 | */ | 
| 619 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); | |
| 619 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); | |
| 620 | 620 | |
| 621 | 621 | /** | 
| 622 | 622 | * Hide View data until search is performed | 
| 623 | 623 | * @since 1.5.4 | 
| 624 | 624 | */ | 
| 625 | -			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { | |
| 625 | +			if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { | |
| 626 | 626 | $gravityview_view->setHideUntilSearched( true ); | 
| 627 | 627 | $get_entries = false; | 
| 628 | 628 | } | 
| @@ -630,23 +630,23 @@ discard block | ||
| 630 | 630 | |
| 631 | 631 |  			if ( $get_entries ) { | 
| 632 | 632 | |
| 633 | -				if ( ! empty( $atts['sort_columns'] ) ) { | |
| 633 | +				if ( ! empty( $atts[ 'sort_columns' ] ) ) { | |
| 634 | 634 | // add filter to enable column sorting | 
| 635 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); | |
| 635 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); | |
| 636 | 636 | } | 
| 637 | 637 | |
| 638 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); | |
| 638 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); | |
| 639 | 639 | |
| 640 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); | |
| 640 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); | |
| 641 | 641 | |
| 642 | 642 |  			} else { | 
| 643 | 643 | |
| 644 | 644 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); | 
| 645 | 645 | |
| 646 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); | |
| 646 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); | |
| 647 | 647 | } | 
| 648 | 648 | |
| 649 | - $gravityview_view->setPaging( $view_entries['paging'] ); | |
| 649 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); | |
| 650 | 650 | $gravityview_view->setContext( 'directory' ); | 
| 651 | 651 | $sections = array( 'header', 'body', 'footer' ); | 
| 652 | 652 | |
| @@ -655,7 +655,7 @@ discard block | ||
| 655 | 655 | // user requested Single Entry View | 
| 656 | 656 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); | 
| 657 | 657 | |
| 658 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); | |
| 658 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); | |
| 659 | 659 | |
| 660 | 660 | $entry = $this->getEntry(); | 
| 661 | 661 | |
| @@ -682,20 +682,20 @@ discard block | ||
| 682 | 682 | // We're in single view, but the view being processed is not the same view the single entry belongs to. | 
| 683 | 683 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms | 
| 684 | 684 |  			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { | 
| 685 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); | |
| 685 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); | |
| 686 | 686 | return null; | 
| 687 | 687 | } | 
| 688 | 688 | |
| 689 | 689 | //fetch template and slug | 
| 690 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); | |
| 690 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); | |
| 691 | 691 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); | 
| 692 | 692 | |
| 693 | 693 | //fetch entry detail | 
| 694 | - $view_entries['count'] = 1; | |
| 695 | - $view_entries['entries'][] = $entry; | |
| 696 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); | |
| 694 | + $view_entries[ 'count' ] = 1; | |
| 695 | + $view_entries[ 'entries' ][ ] = $entry; | |
| 696 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); | |
| 697 | 697 | |
| 698 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; | |
| 698 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; | |
| 699 | 699 | |
| 700 | 700 | // set back link label | 
| 701 | 701 | $gravityview_view->setBackLinkLabel( $back_link_label ); | 
| @@ -705,11 +705,11 @@ discard block | ||
| 705 | 705 | } | 
| 706 | 706 | |
| 707 | 707 | // add template style | 
| 708 | - self::add_style( $view_data['template_id'] ); | |
| 708 | + self::add_style( $view_data[ 'template_id' ] ); | |
| 709 | 709 | |
| 710 | 710 | // Prepare to render view and set vars | 
| 711 | - $gravityview_view->setEntries( $view_entries['entries'] ); | |
| 712 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); | |
| 711 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); | |
| 712 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); | |
| 713 | 713 | |
| 714 | 714 | // If Edit | 
| 715 | 715 |  		if ( 'edit' === gravityview_get_context() ) { | 
| @@ -722,11 +722,11 @@ discard block | ||
| 722 | 722 | |
| 723 | 723 |  		} else { | 
| 724 | 724 | // finaly we'll render some html | 
| 725 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); | |
| 725 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); | |
| 726 | 726 | |
| 727 | 727 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); | 
| 728 | 728 |  			foreach ( $sections as $section ) { | 
| 729 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); | |
| 729 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); | |
| 730 | 730 | $gravityview_view->render( $view_slug, $section, false ); | 
| 731 | 731 | } | 
| 732 | 732 | } | 
| @@ -780,7 +780,7 @@ discard block | ||
| 780 | 780 | $datetime_format = 'Y-m-d H:i:s'; | 
| 781 | 781 | $search_is_outside_view_bounds = false; | 
| 782 | 782 | |
| 783 | -				if( ! empty( $search_criteria[ $key ] ) ) { | |
| 783 | +				if ( ! empty( $search_criteria[ $key ] ) ) { | |
| 784 | 784 | |
| 785 | 785 | $search_date = strtotime( $search_criteria[ $key ] ); | 
| 786 | 786 | |
| @@ -808,14 +808,14 @@ discard block | ||
| 808 | 808 |  				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { | 
| 809 | 809 | |
| 810 | 810 | // Then we override the search and re-set the start date | 
| 811 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); | |
| 811 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); | |
| 812 | 812 | } | 
| 813 | 813 | } | 
| 814 | 814 | } | 
| 815 | 815 | |
| 816 | -		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { | |
| 816 | +		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { | |
| 817 | 817 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. | 
| 818 | -			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { | |
| 818 | +			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { | |
| 819 | 819 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); | 
| 820 | 820 | } | 
| 821 | 821 | } | 
| @@ -833,9 +833,9 @@ discard block | ||
| 833 | 833 | */ | 
| 834 | 834 |  	public static function process_search_only_approved( $args, $search_criteria ) { | 
| 835 | 835 | |
| 836 | -		if ( ! empty( $args['show_only_approved'] ) ) { | |
| 837 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); | |
| 838 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met | |
| 836 | +		if ( ! empty( $args[ 'show_only_approved' ] ) ) { | |
| 837 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); | |
| 838 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met | |
| 839 | 839 | |
| 840 | 840 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); | 
| 841 | 841 | } | 
| @@ -859,12 +859,12 @@ discard block | ||
| 859 | 859 | */ | 
| 860 | 860 |  	public static function is_entry_approved( $entry, $args = array() ) { | 
| 861 | 861 | |
| 862 | -		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { | |
| 862 | +		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { | |
| 863 | 863 | // is implicitly approved if entry is null or View settings doesn't require to check for approval | 
| 864 | 864 | return true; | 
| 865 | 865 | } | 
| 866 | 866 | |
| 867 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); | |
| 867 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); | |
| 868 | 868 | |
| 869 | 869 |  		if ( $is_approved ) { | 
| 870 | 870 | return true; | 
| @@ -897,26 +897,26 @@ discard block | ||
| 897 | 897 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); | 
| 898 | 898 | |
| 899 | 899 | // implicity search | 
| 900 | -		if ( ! empty( $args['search_value'] ) ) { | |
| 900 | +		if ( ! empty( $args[ 'search_value' ] ) ) { | |
| 901 | 901 | |
| 902 | 902 | // Search operator options. Options: `is` or `contains` | 
| 903 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; | |
| 903 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; | |
| 904 | 904 | |
| 905 | - $search_criteria['field_filters'][] = array( | |
| 905 | + $search_criteria[ 'field_filters' ][ ] = array( | |
| 906 | 906 | 'key' => rgget( 'search_field', $args ), // The field ID to search | 
| 907 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. | |
| 907 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. | |
| 908 | 908 | 'operator' => $operator, | 
| 909 | 909 | ); | 
| 910 | 910 | } | 
| 911 | 911 | |
| 912 | -		if( $search_criteria !== $original_search_criteria ) { | |
| 912 | +		if ( $search_criteria !== $original_search_criteria ) { | |
| 913 | 913 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); | 
| 914 | 914 | } | 
| 915 | 915 | |
| 916 | 916 | // Handle setting date range | 
| 917 | 917 | $search_criteria = self::process_search_dates( $args, $search_criteria ); | 
| 918 | 918 | |
| 919 | -		if( $search_criteria !== $original_search_criteria ) { | |
| 919 | +		if ( $search_criteria !== $original_search_criteria ) { | |
| 920 | 920 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); | 
| 921 | 921 | } | 
| 922 | 922 | |
| @@ -927,7 +927,7 @@ discard block | ||
| 927 | 927 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. | 
| 928 | 928 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` | 
| 929 | 929 | */ | 
| 930 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); | |
| 930 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); | |
| 931 | 931 | |
| 932 | 932 | return $search_criteria; | 
| 933 | 933 | } | 
| @@ -973,16 +973,16 @@ discard block | ||
| 973 | 973 | $search_criteria = self::get_search_criteria( $args, $form_id ); | 
| 974 | 974 | |
| 975 | 975 | // Paging & offset | 
| 976 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); | |
| 976 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); | |
| 977 | 977 | |
| 978 | 978 |  		if ( -1 === $page_size ) { | 
| 979 | 979 | $page_size = PHP_INT_MAX; | 
| 980 | 980 | } | 
| 981 | 981 | |
| 982 | -		if ( isset( $args['offset'] ) ) { | |
| 983 | - $offset = intval( $args['offset'] ); | |
| 982 | +		if ( isset( $args[ 'offset' ] ) ) { | |
| 983 | + $offset = intval( $args[ 'offset' ] ); | |
| 984 | 984 |  		} else { | 
| 985 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); | |
| 985 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); | |
| 986 | 986 | $offset = ( $curr_page - 1 ) * $page_size; | 
| 987 | 987 | } | 
| 988 | 988 | |
| @@ -1000,7 +1000,7 @@ discard block | ||
| 1000 | 1000 | 'search_criteria' => $search_criteria, | 
| 1001 | 1001 | 'sorting' => $sorting, | 
| 1002 | 1002 | 'paging' => $paging, | 
| 1003 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, | |
| 1003 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, | |
| 1004 | 1004 | ); | 
| 1005 | 1005 | |
| 1006 | 1006 | /** | 
| @@ -1025,7 +1025,7 @@ discard block | ||
| 1025 | 1025 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. | 
| 1026 | 1026 | * @param array $args View configuration args. | 
| 1027 | 1027 | */ | 
| 1028 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); | |
| 1028 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); | |
| 1029 | 1029 | |
| 1030 | 1030 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); | 
| 1031 | 1031 | |
| @@ -1065,8 +1065,8 @@ discard block | ||
| 1065 | 1065 | */ | 
| 1066 | 1066 |  	public static function updateViewSorting( $args, $form_id ) { | 
| 1067 | 1067 | $sorting = array(); | 
| 1068 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); | |
| 1069 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); | |
| 1068 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); | |
| 1069 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); | |
| 1070 | 1070 | |
| 1071 | 1071 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); | 
| 1072 | 1072 | |
| @@ -1106,7 +1106,7 @@ discard block | ||
| 1106 | 1106 | |
| 1107 | 1107 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); | 
| 1108 | 1108 | |
| 1109 | -		switch ( $sort_field['type'] ) { | |
| 1109 | +		switch ( $sort_field[ 'type' ] ) { | |
| 1110 | 1110 | |
| 1111 | 1111 | case 'address': | 
| 1112 | 1112 | // Sorting by full address | 
| @@ -1123,7 +1123,7 @@ discard block | ||
| 1123 | 1123 | */ | 
| 1124 | 1124 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); | 
| 1125 | 1125 | |
| 1126 | -					switch( strtolower( $address_part ) ){ | |
| 1126 | +					switch ( strtolower( $address_part ) ) { | |
| 1127 | 1127 | case 'street': | 
| 1128 | 1128 | $sort_field_id .= '.1'; | 
| 1129 | 1129 | break; | 
| @@ -1203,7 +1203,7 @@ discard block | ||
| 1203 | 1203 | */ | 
| 1204 | 1204 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); | 
| 1205 | 1205 | |
| 1206 | -		if ( empty( $single_entry ) ){ | |
| 1206 | +		if ( empty( $single_entry ) ) { | |
| 1207 | 1207 | return false; | 
| 1208 | 1208 |  		} else { | 
| 1209 | 1209 | return $single_entry; | 
| @@ -1230,7 +1230,7 @@ discard block | ||
| 1230 | 1230 | * Don't enqueue the scripts or styles if it's not going to be displayed. | 
| 1231 | 1231 | * @since 1.15 | 
| 1232 | 1232 | */ | 
| 1233 | -				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { | |
| 1233 | +				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { | |
| 1234 | 1234 | continue; | 
| 1235 | 1235 | } | 
| 1236 | 1236 | |
| @@ -1239,19 +1239,19 @@ discard block | ||
| 1239 | 1239 | $css_dependencies = array(); | 
| 1240 | 1240 | |
| 1241 | 1241 | // If the thickbox is enqueued, add dependencies | 
| 1242 | -				if ( ! empty( $data['atts']['lightbox'] ) ) { | |
| 1242 | +				if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { | |
| 1243 | 1243 | |
| 1244 | 1244 | /** | 
| 1245 | 1245 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` | 
| 1246 | 1246 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. | 
| 1247 | 1247 | */ | 
| 1248 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); | |
| 1248 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); | |
| 1249 | 1249 | |
| 1250 | 1250 | /** | 
| 1251 | 1251 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` | 
| 1252 | 1252 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. | 
| 1253 | 1253 | */ | 
| 1254 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); | |
| 1254 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); | |
| 1255 | 1255 | } | 
| 1256 | 1256 | |
| 1257 | 1257 | /** | 
| @@ -1259,25 +1259,25 @@ discard block | ||
| 1259 | 1259 | * @see https://github.com/katzwebservices/GravityView/issues/536 | 
| 1260 | 1260 | * @since 1.15 | 
| 1261 | 1261 | */ | 
| 1262 | -				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { | |
| 1263 | - $css_dependencies[] = 'dashicons'; | |
| 1262 | +				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { | |
| 1263 | + $css_dependencies[ ] = 'dashicons'; | |
| 1264 | 1264 | } | 
| 1265 | 1265 | |
| 1266 | 1266 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); | 
| 1267 | 1267 | |
| 1268 | 1268 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; | 
| 1269 | 1269 | |
| 1270 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); | |
| 1270 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); | |
| 1271 | 1271 | |
| 1272 | 1272 | wp_enqueue_script( 'gravityview-fe-view' ); | 
| 1273 | 1273 | |
| 1274 | -				if ( ! empty( $data['atts']['sort_columns'] ) ) { | |
| 1274 | +				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { | |
| 1275 | 1275 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); | 
| 1276 | 1276 | } | 
| 1277 | 1277 | |
| 1278 | 1278 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); | 
| 1279 | 1279 | |
| 1280 | - self::add_style( $data['template_id'] ); | |
| 1280 | + self::add_style( $data[ 'template_id' ] ); | |
| 1281 | 1281 | |
| 1282 | 1282 | } | 
| 1283 | 1283 | |
| @@ -1313,7 +1313,7 @@ discard block | ||
| 1313 | 1313 |  		} elseif ( empty( $template_id ) ) { | 
| 1314 | 1314 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); | 
| 1315 | 1315 |  		} else { | 
| 1316 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); | |
| 1316 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); | |
| 1317 | 1317 | } | 
| 1318 | 1318 | |
| 1319 | 1319 | } | 
| @@ -1338,11 +1338,11 @@ discard block | ||
| 1338 | 1338 | * Not a table-based template; don't add sort icons | 
| 1339 | 1339 | * @since 1.12 | 
| 1340 | 1340 | */ | 
| 1341 | -		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { | |
| 1341 | +		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { | |
| 1342 | 1342 | return $label; | 
| 1343 | 1343 | } | 
| 1344 | 1344 | |
| 1345 | -		if ( ! $this->is_field_sortable( $field['id'], $form ) ) { | |
| 1345 | +		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { | |
| 1346 | 1346 | return $label; | 
| 1347 | 1347 | } | 
| 1348 | 1348 | |
| @@ -1350,29 +1350,29 @@ discard block | ||
| 1350 | 1350 | |
| 1351 | 1351 | $class = 'gv-sort'; | 
| 1352 | 1352 | |
| 1353 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); | |
| 1353 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); | |
| 1354 | 1354 | |
| 1355 | 1355 | $sort_args = array( | 
| 1356 | - 'sort' => $field['id'], | |
| 1356 | + 'sort' => $field[ 'id' ], | |
| 1357 | 1357 | 'dir' => 'asc', | 
| 1358 | 1358 | ); | 
| 1359 | 1359 | |
| 1360 | -		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { | |
| 1360 | +		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { | |
| 1361 | 1361 | //toggle sorting direction. | 
| 1362 | -			if ( 'asc' === $sorting['direction'] ) { | |
| 1363 | - $sort_args['dir'] = 'desc'; | |
| 1362 | +			if ( 'asc' === $sorting[ 'direction' ] ) { | |
| 1363 | + $sort_args[ 'dir' ] = 'desc'; | |
| 1364 | 1364 | $class .= ' gv-icon-sort-desc'; | 
| 1365 | 1365 |  			} else { | 
| 1366 | - $sort_args['dir'] = 'asc'; | |
| 1366 | + $sort_args[ 'dir' ] = 'asc'; | |
| 1367 | 1367 | $class .= ' gv-icon-sort-asc'; | 
| 1368 | 1368 | } | 
| 1369 | 1369 |  		} else { | 
| 1370 | 1370 | $class .= ' gv-icon-caret-up-down'; | 
| 1371 | 1371 | } | 
| 1372 | 1372 | |
| 1373 | -		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); | |
| 1373 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); | |
| 1374 | 1374 | |
| 1375 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; | |
| 1375 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; | |
| 1376 | 1376 | |
| 1377 | 1377 | } | 
| 1378 | 1378 | |
| @@ -1390,7 +1390,7 @@ discard block | ||
| 1390 | 1390 | |
| 1391 | 1391 | $field_type = $field_id; | 
| 1392 | 1392 | |
| 1393 | -		if( is_numeric( $field_id ) ) { | |
| 1393 | +		if ( is_numeric( $field_id ) ) { | |
| 1394 | 1394 | $field = GFFormsModel::get_field( $form, $field_id ); | 
| 1395 | 1395 | $field_type = $field->type; | 
| 1396 | 1396 | } | 
| @@ -1413,7 +1413,7 @@ discard block | ||
| 1413 | 1413 | return false; | 
| 1414 | 1414 | } | 
| 1415 | 1415 | |
| 1416 | -		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); | |
| 1416 | +		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); | |
| 1417 | 1417 | |
| 1418 | 1418 | } | 
| 1419 | 1419 | |