@@ -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 | |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @file class-admin-approve-entries.php |
|
| 4 | - * @package GravityView |
|
| 5 | - * @license GPL2+ |
|
| 6 | - * @author Katz Web Services, Inc. |
|
| 7 | - * @link http://gravityview.co |
|
| 8 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 9 | - * |
|
| 10 | - * @since 1.0.0 |
|
| 11 | - */ |
|
| 3 | + * @file class-admin-approve-entries.php |
|
| 4 | + * @package GravityView |
|
| 5 | + * @license GPL2+ |
|
| 6 | + * @author Katz Web Services, Inc. |
|
| 7 | + * @link http://gravityview.co |
|
| 8 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 9 | + * |
|
| 10 | + * @since 1.0.0 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | |
@@ -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; |
@@ -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 | |
@@ -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 ) ); |
@@ -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,13 +219,13 @@ 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 | - if( class_exists( 'GFCache' ) ) { |
|
| 228 | + if ( class_exists( 'GFCache' ) ) { |
|
| 229 | 229 | /** |
| 230 | 230 | * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run. |
| 231 | 231 | * |
@@ -240,46 +240,46 @@ discard block |
||
| 240 | 240 | * @param boolean false Tell Gravity Forms not to store this as a transient |
| 241 | 241 | * @param int 0 Time to store the value. 0 is maximum amount of time possible. |
| 242 | 242 | */ |
| 243 | - GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 ); |
|
| 243 | + GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry[ "id" ] . "_" . $field_settings[ "id" ], false, false, 0 ); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $field_id = $field_settings['id']; |
|
| 246 | + $field_id = $field_settings[ 'id' ]; |
|
| 247 | 247 | |
| 248 | 248 | $form = $gravityview_view->getForm(); |
| 249 | 249 | |
| 250 | 250 | $field = gravityview_get_field( $form, $field_id ); |
| 251 | 251 | |
| 252 | - $field_type = RGFormsModel::get_input_type($field); |
|
| 252 | + $field_type = RGFormsModel::get_input_type( $field ); |
|
| 253 | 253 | |
| 254 | - if( $field_type ) { |
|
| 255 | - $field_type = $field['type']; |
|
| 256 | - $value = RGFormsModel::get_lead_field_value($entry, $field); |
|
| 254 | + if ( $field_type ) { |
|
| 255 | + $field_type = $field[ 'type' ]; |
|
| 256 | + $value = RGFormsModel::get_lead_field_value( $entry, $field ); |
|
| 257 | 257 | } else { |
| 258 | 258 | // For non-integer field types (`id`, `date_created`, etc.) |
| 259 | 259 | $field_type = $field_id; |
| 260 | - $field['type'] = $field_id; |
|
| 261 | - $value = isset($entry[$field_type]) ? $entry[$field_type] : NULL; |
|
| 260 | + $field[ 'type' ] = $field_id; |
|
| 261 | + $value = isset( $entry[ $field_type ] ) ? $entry[ $field_type ] : NULL; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // Prevent any PHP warnings that may be generated |
| 265 | 265 | ob_start(); |
| 266 | 266 | |
| 267 | - $display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format); |
|
| 267 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
| 268 | 268 | |
| 269 | - if( $errors = ob_get_clean() ) { |
|
| 269 | + if ( $errors = ob_get_clean() ) { |
|
| 270 | 270 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - $display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form); |
|
| 273 | + $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
|
| 274 | 274 | |
| 275 | 275 | // prevent the use of merge_tags for non-admin fields |
| 276 | - if( !empty( $field['adminOnly'] ) ) { |
|
| 276 | + if ( ! empty( $field[ 'adminOnly' ] ) ) { |
|
| 277 | 277 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // Check whether the field exists in /includes/fields/{$field_type}.php |
| 281 | 281 | // This can be overridden by user template files. |
| 282 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
| 282 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
| 283 | 283 | |
| 284 | 284 | // Set the field data to be available in the templates |
| 285 | 285 | $gravityview_view->setCurrentField( array( |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | 'entry' => $entry, |
| 294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
| 295 | 295 | 'field_path' => $field_path, /** {@since 1.16} */ |
| 296 | - )); |
|
| 296 | + ) ); |
|
| 297 | 297 | |
| 298 | - if( ! empty( $field_path ) ) { |
|
| 298 | + if ( ! empty( $field_path ) ) { |
|
| 299 | 299 | |
| 300 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
| 300 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
| 301 | 301 | |
| 302 | 302 | ob_start(); |
| 303 | 303 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
| 315 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | 318 | * @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` |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
| 331 | 331 | * |
| 332 | 332 | */ |
| 333 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
| 333 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
| 334 | 334 | |
| 335 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
| 335 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
| 336 | 336 | |
| 337 | 337 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
| 338 | 338 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * @param array $field_settings Settings for the particular GV field |
| 347 | 347 | * @param array $field Current field being displayed |
| 348 | 348 | */ |
| 349 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
| 349 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
| 377 | 377 | |
| 378 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 378 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 379 | 379 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
| 380 | 380 | return NULL; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $href = self::entry_link( $entry ); |
| 384 | 384 | |
| 385 | - if( '' === $href ) { |
|
| 385 | + if ( '' === $href ) { |
|
| 386 | 386 | return NULL; |
| 387 | 387 | } |
| 388 | 388 | |
@@ -405,19 +405,19 @@ discard block |
||
| 405 | 405 | * @param boolean $wpautop Apply wpautop() to the output? |
| 406 | 406 | * @return string HTML of "no results" text |
| 407 | 407 | */ |
| 408 | - public static function no_results($wpautop = true) { |
|
| 408 | + public static function no_results( $wpautop = true ) { |
|
| 409 | 409 | $gravityview_view = GravityView_View::getInstance(); |
| 410 | 410 | |
| 411 | 411 | $is_search = false; |
| 412 | 412 | |
| 413 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 413 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 414 | 414 | $is_search = true; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - if($is_search) { |
|
| 418 | - $output = __('This search returned no results.', 'gravityview'); |
|
| 417 | + if ( $is_search ) { |
|
| 418 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
| 419 | 419 | } else { |
| 420 | - $output = __('No entries match your request.', 'gravityview'); |
|
| 420 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | * @param string $output The existing "No Entries" text |
| 426 | 426 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
| 427 | 427 | */ |
| 428 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
| 428 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
| 429 | 429 | |
| 430 | - return $wpautop ? wpautop($output) : $output; |
|
| 430 | + return $wpautop ? wpautop( $output ) : $output; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -444,37 +444,37 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | $gravityview_view = GravityView_View::getInstance(); |
| 446 | 446 | |
| 447 | - if( empty( $post_id ) ) { |
|
| 447 | + if ( empty( $post_id ) ) { |
|
| 448 | 448 | |
| 449 | 449 | $post_id = false; |
| 450 | 450 | |
| 451 | 451 | // DataTables passes the Post ID |
| 452 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
| 452 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 453 | 453 | |
| 454 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
| 454 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
| 455 | 455 | |
| 456 | 456 | } else { |
| 457 | 457 | |
| 458 | 458 | // The Post ID has been passed via the shortcode |
| 459 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
| 459 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
| 460 | 460 | |
| 461 | 461 | $post_id = $gravityview_view->getPostId(); |
| 462 | 462 | |
| 463 | 463 | } else { |
| 464 | 464 | |
| 465 | 465 | // This is a GravityView post type |
| 466 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
| 466 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
| 467 | 467 | |
| 468 | 468 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
| 469 | 469 | |
| 470 | 470 | } else { |
| 471 | 471 | |
| 472 | 472 | // This is an embedded GravityView; use the embedded post's ID as the base. |
| 473 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
| 473 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
| 474 | 474 | |
| 475 | 475 | $post_id = $post->ID; |
| 476 | 476 | |
| 477 | - } elseif( $gravityview_view->getViewId() ) { |
|
| 477 | + } elseif ( $gravityview_view->getViewId() ) { |
|
| 478 | 478 | |
| 479 | 479 | // The GravityView has been embedded in a widget or in a template, and |
| 480 | 480 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -489,36 +489,36 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // No post ID, get outta here. |
| 492 | - if( empty( $post_id ) ) { |
|
| 492 | + if ( empty( $post_id ) ) { |
|
| 493 | 493 | return NULL; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | // If we've saved the permalink in memory, use it |
| 497 | 497 | // @since 1.3 |
| 498 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 498 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 499 | 499 | |
| 500 | - if( empty( $link ) ) { |
|
| 500 | + if ( empty( $link ) ) { |
|
| 501 | 501 | |
| 502 | 502 | $link = get_permalink( $post_id ); |
| 503 | 503 | |
| 504 | 504 | // If not yet saved, cache the permalink. |
| 505 | 505 | // @since 1.3 |
| 506 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 506 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 507 | 507 | |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | // Deal with returning to proper pagination for embedded views |
| 511 | - if( $link && $add_query_args ) { |
|
| 511 | + if ( $link && $add_query_args ) { |
|
| 512 | 512 | |
| 513 | 513 | $args = array(); |
| 514 | 514 | |
| 515 | - if( $pagenum = rgget('pagenum') ) { |
|
| 516 | - $args['pagenum'] = intval( $pagenum ); |
|
| 515 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
| 516 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if( $sort = rgget('sort') ) { |
|
| 520 | - $args['sort'] = $sort; |
|
| 521 | - $args['dir'] = rgget('dir'); |
|
| 519 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 520 | + $args[ 'sort' ] = $sort; |
|
| 521 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | $link = add_query_arg( $args, $link ); |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 542 | 542 | |
| 543 | 543 | // Generate an unique hash to use as the default value |
| 544 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 544 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 545 | 545 | |
| 546 | 546 | /** |
| 547 | 547 | * @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}` |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 553 | 553 | |
| 554 | 554 | // Make sure we have something - use the original ID as backup. |
| 555 | - if( empty( $slug ) ) { |
|
| 555 | + if ( empty( $slug ) ) { |
|
| 556 | 556 | $slug = $id; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
| 582 | 582 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
| 583 | 583 | */ |
| 584 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
| 584 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 585 | 585 | |
| 586 | 586 | // If we're using custom slug... |
| 587 | 587 | if ( $custom ) { |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | // If it does have a hash set, and the hash is expected, use it. |
| 596 | 596 | // This check allows users to change the hash structure using the |
| 597 | 597 | // gravityview_entry_hash filter and have the old hashes expire. |
| 598 | - if( empty( $value ) || $value !== $hash ) { |
|
| 598 | + if ( empty( $value ) || $value !== $hash ) { |
|
| 599 | 599 | |
| 600 | 600 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
| 601 | 601 | |
@@ -623,12 +623,12 @@ discard block |
||
| 623 | 623 | * @param boolean $custom Should we process the custom entry slug? |
| 624 | 624 | */ |
| 625 | 625 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 626 | - if( $custom ) { |
|
| 626 | + if ( $custom ) { |
|
| 627 | 627 | // create the gravityview_unique_id and save it |
| 628 | 628 | |
| 629 | 629 | // Get the entry hash |
| 630 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 631 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
| 630 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 631 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
| 632 | 632 | |
| 633 | 633 | } |
| 634 | 634 | } |
@@ -645,14 +645,14 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
| 647 | 647 | |
| 648 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 648 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 649 | 649 | $entry = GVCommon::get_entry( $entry ); |
| 650 | - } else if( empty( $entry ) ) { |
|
| 650 | + } else if ( empty( $entry ) ) { |
|
| 651 | 651 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | // Second parameter used to be passed as $field; this makes sure it's not an array |
| 655 | - if( !is_numeric( $post_id ) ) { |
|
| 655 | + if ( ! is_numeric( $post_id ) ) { |
|
| 656 | 656 | $post_id = NULL; |
| 657 | 657 | } |
| 658 | 658 | |
@@ -660,19 +660,19 @@ discard block |
||
| 660 | 660 | $directory_link = self::directory_link( $post_id, false ); |
| 661 | 661 | |
| 662 | 662 | // No post ID? Get outta here. |
| 663 | - if( empty( $directory_link ) ) { |
|
| 663 | + if ( empty( $directory_link ) ) { |
|
| 664 | 664 | return ''; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
| 668 | 668 | |
| 669 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 669 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 670 | 670 | |
| 671 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
| 671 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 672 | 672 | |
| 673 | 673 | $args = array(); |
| 674 | 674 | |
| 675 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
| 675 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
| 676 | 676 | |
| 677 | 677 | } else { |
| 678 | 678 | |
@@ -682,18 +682,18 @@ discard block |
||
| 682 | 682 | /** |
| 683 | 683 | * @since 1.7.3 |
| 684 | 684 | */ |
| 685 | - if( $add_directory_args ) { |
|
| 685 | + if ( $add_directory_args ) { |
|
| 686 | 686 | |
| 687 | - if( !empty( $_GET['pagenum'] ) ) { |
|
| 688 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 687 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 688 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /** |
| 692 | 692 | * @since 1.7 |
| 693 | 693 | */ |
| 694 | - if( $sort = rgget('sort') ) { |
|
| 695 | - $args['sort'] = $sort; |
|
| 696 | - $args['dir'] = rgget('dir'); |
|
| 694 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 695 | + $args[ 'sort' ] = $sort; |
|
| 696 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | } |
@@ -703,8 +703,8 @@ discard block |
||
| 703 | 703 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
| 704 | 704 | * @see GravityView_frontend::get_context_view_id() |
| 705 | 705 | */ |
| 706 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 707 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 706 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 707 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | return add_query_arg( $args, $directory_link ); |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 725 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 725 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | /** |
@@ -744,15 +744,15 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
| 746 | 746 | |
| 747 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 747 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 748 | 748 | $default_css_class .= ' hidden'; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 751 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 752 | 752 | $default_css_class .= ' gv-container-no-results'; |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 755 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 756 | 756 | |
| 757 | 757 | /** |
| 758 | 758 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | |
| 764 | 764 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 765 | 765 | |
| 766 | - if( $echo ) { |
|
| 766 | + if ( $echo ) { |
|
| 767 | 767 | echo $css_class; |
| 768 | 768 | } |
| 769 | 769 | |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | $value = GravityView_API::field_value( $entry, $field ); |
| 776 | 776 | |
| 777 | - if( $value === '') { |
|
| 777 | + if ( $value === '' ) { |
|
| 778 | 778 | /** |
| 779 | 779 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 780 | 780 | * @param string $value (empty string) |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | return GravityView_API::entry_link( $entry, $post_id ); |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | -function gv_no_results($wpautop = true) { |
|
| 796 | +function gv_no_results( $wpautop = true ) { |
|
| 797 | 797 | return GravityView_API::no_results( $wpautop ); |
| 798 | 798 | } |
| 799 | 799 | |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | $href = gv_directory_link(); |
| 808 | 808 | |
| 809 | - if( empty( $href ) ) { return NULL; } |
|
| 809 | + if ( empty( $href ) ) { return NULL; } |
|
| 810 | 810 | |
| 811 | 811 | // calculate link label |
| 812 | 812 | $gravityview_view = GravityView_View::getInstance(); |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
| 824 | 824 | 'data-viewid' => $gravityview_view->getViewId() |
| 825 | - )); |
|
| 825 | + ) ); |
|
| 826 | 826 | |
| 827 | 827 | return $link; |
| 828 | 828 | } |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | */ |
| 842 | 842 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 843 | 843 | |
| 844 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 844 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 845 | 845 | |
| 846 | 846 | // For the complete field value as generated by Gravity Forms |
| 847 | 847 | return $display_value; |
@@ -871,16 +871,16 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | $terms = explode( ', ', $value ); |
| 873 | 873 | |
| 874 | - foreach ($terms as $term_name ) { |
|
| 874 | + foreach ( $terms as $term_name ) { |
|
| 875 | 875 | |
| 876 | 876 | // If we're processing a category, |
| 877 | - if( $taxonomy === 'category' ) { |
|
| 877 | + if ( $taxonomy === 'category' ) { |
|
| 878 | 878 | |
| 879 | 879 | // Use rgexplode to prevent errors if : doesn't exist |
| 880 | 880 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
| 881 | 881 | |
| 882 | 882 | // The explode was succesful; we have the category ID |
| 883 | - if( !empty( $term_id )) { |
|
| 883 | + if ( ! empty( $term_id ) ) { |
|
| 884 | 884 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 885 | 885 | } else { |
| 886 | 886 | // We have to fall back to the name |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | // There's still a tag/category here. |
| 896 | - if( $term ) { |
|
| 896 | + if ( $term ) { |
|
| 897 | 897 | |
| 898 | 898 | $term_link = get_term_link( $term, $taxonomy ); |
| 899 | 899 | |
@@ -902,11 +902,11 @@ discard block |
||
| 902 | 902 | continue; |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 905 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | - return implode(', ', $output ); |
|
| 909 | + return implode( ', ', $output ); |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | /** |
@@ -920,8 +920,8 @@ discard block |
||
| 920 | 920 | |
| 921 | 921 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 922 | 922 | |
| 923 | - if( empty( $link ) ) { |
|
| 924 | - return strip_tags( $output); |
|
| 923 | + if ( empty( $link ) ) { |
|
| 924 | + return strip_tags( $output ); |
|
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | return $output; |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | $fe = GravityView_frontend::getInstance(); |
| 941 | 941 | |
| 942 | 942 | // Solve problem when loading content via admin-ajax.php |
| 943 | - if( ! $fe->getGvOutputData() ) { |
|
| 943 | + if ( ! $fe->getGvOutputData() ) { |
|
| 944 | 944 | |
| 945 | 945 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
| 946 | 946 | |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | // Make 100% sure that we're dealing with a properly called situation |
| 951 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 951 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 952 | 952 | |
| 953 | 953 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
| 954 | 954 | |
@@ -968,10 +968,10 @@ discard block |
||
| 968 | 968 | |
| 969 | 969 | $fe = GravityView_frontend::getInstance(); |
| 970 | 970 | |
| 971 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
| 971 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
| 972 | 972 | |
| 973 | 973 | // If not set, grab the current view ID |
| 974 | - if( empty( $view_id ) ) { |
|
| 974 | + if ( empty( $view_id ) ) { |
|
| 975 | 975 | $view_id = $fe->get_context_view_id(); |
| 976 | 976 | } |
| 977 | 977 | |
@@ -1036,11 +1036,11 @@ discard block |
||
| 1036 | 1036 | */ |
| 1037 | 1037 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
| 1038 | 1038 | |
| 1039 | - if( $is_edit_entry ) { |
|
| 1039 | + if ( $is_edit_entry ) { |
|
| 1040 | 1040 | $context = 'edit'; |
| 1041 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1041 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1042 | 1042 | $context = 'single'; |
| 1043 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
| 1043 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
| 1044 | 1044 | $context = GravityView_View::getInstance()->getContext(); |
| 1045 | 1045 | } |
| 1046 | 1046 | |
@@ -1068,12 +1068,12 @@ discard block |
||
| 1068 | 1068 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
| 1069 | 1069 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1070 | 1070 | |
| 1071 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1072 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1071 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1072 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1076 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
| 1075 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1076 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1151,12 +1151,12 @@ discard block |
||
| 1151 | 1151 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
| 1152 | 1152 | |
| 1153 | 1153 | // Required fields. |
| 1154 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1154 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1155 | 1155 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
| 1156 | 1156 | return ''; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1159 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1160 | 1160 | |
| 1161 | 1161 | /** |
| 1162 | 1162 | * Create the content variables for replacing. |
@@ -1172,37 +1172,37 @@ discard block |
||
| 1172 | 1172 | 'field_id' => '', |
| 1173 | 1173 | ); |
| 1174 | 1174 | |
| 1175 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
| 1175 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
| 1176 | 1176 | |
| 1177 | 1177 | // If the value is empty and we're hiding empty, return empty. |
| 1178 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1178 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1179 | 1179 | return ''; |
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1183 | - $context['value'] = wpautop( $context['value'] ); |
|
| 1182 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1183 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | // Get width setting, if exists |
| 1187 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
| 1187 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
| 1188 | 1188 | |
| 1189 | 1189 | // If replacing with CSS inline formatting, let's do it. |
| 1190 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
| 1190 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
| 1191 | 1191 | |
| 1192 | 1192 | // Grab the Class using `gv_class` |
| 1193 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
| 1194 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
| 1193 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1194 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1195 | 1195 | |
| 1196 | 1196 | // Get field label if needed |
| 1197 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
| 1198 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
| 1197 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
| 1198 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | // Default Label value |
| 1202 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
| 1202 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
| 1203 | 1203 | |
| 1204 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
| 1205 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1204 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
| 1205 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | /** |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | * @param string $markup The HTML for the markup |
| 1212 | 1212 | * @param array $args All args for the field output |
| 1213 | 1213 | */ |
| 1214 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
| 1214 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
| 1215 | 1215 | |
| 1216 | 1216 | /** |
| 1217 | 1217 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | foreach ( $context as $tag => $value ) { |
| 1235 | 1235 | |
| 1236 | 1236 | // If the tag doesn't exist just skip it |
| 1237 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1237 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1238 | 1238 | continue; |
| 1239 | 1239 | } |
| 1240 | 1240 | |
@@ -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 | } |
@@ -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; |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | public function renderZone( $zone = '', $atts = array() ) { |
| 593 | 593 | |
| 594 | - if( empty( $zone ) ) { |
|
| 595 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
| 594 | + if ( empty( $zone ) ) { |
|
| 595 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
| 596 | 596 | return NULL; |
| 597 | 597 | } |
| 598 | 598 | |
@@ -601,33 +601,33 @@ discard block |
||
| 601 | 601 | 'context' => $this->getContext(), |
| 602 | 602 | 'entry' => $this->getCurrentEntry(), |
| 603 | 603 | 'form' => $this->getForm(), |
| 604 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 604 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 605 | 605 | ); |
| 606 | 606 | |
| 607 | 607 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 608 | 608 | |
| 609 | 609 | $output = ''; |
| 610 | 610 | |
| 611 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 611 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 612 | 612 | |
| 613 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 613 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 614 | 614 | |
| 615 | 615 | // Backward compatibility |
| 616 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
| 616 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
| 617 | 617 | /** |
| 618 | 618 | * Modify the fields displayed in the table |
| 619 | 619 | * @var array |
| 620 | 620 | */ |
| 621 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 621 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - if( empty( $fields ) ) { |
|
| 624 | + if ( empty( $fields ) ) { |
|
| 625 | 625 | return NULL; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | $field_output = ''; |
| 629 | 629 | foreach ( $fields as $field ) { |
| 630 | - $final_atts['field'] = $field; |
|
| 630 | + $final_atts[ 'field' ] = $field; |
|
| 631 | 631 | |
| 632 | 632 | $field_output .= gravityview_field_output( $final_atts ); |
| 633 | 633 | } |
@@ -638,17 +638,17 @@ discard block |
||
| 638 | 638 | * @since 1.7.6 |
| 639 | 639 | * @param boolean $hide_empty_zone Default: false |
| 640 | 640 | */ |
| 641 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 641 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 642 | 642 | return NULL; |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 646 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 645 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 646 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | $output .= $field_output; |
| 650 | 650 | |
| 651 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 651 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 652 | 652 | $output .= '</div>'; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | */ |
| 669 | 669 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 670 | 670 | |
| 671 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 671 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 672 | 672 | |
| 673 | 673 | $located = $this->located_templates[ $template_names ]; |
| 674 | 674 | |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | // Set $load to always false so we handle it here. |
| 678 | 678 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 679 | 679 | |
| 680 | - if( is_string( $template_names ) ) { |
|
| 680 | + if ( is_string( $template_names ) ) { |
|
| 681 | 681 | $this->located_templates[ $template_names ] = $located; |
| 682 | 682 | } |
| 683 | 683 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | * @return mixed|null The stored data. |
| 696 | 696 | */ |
| 697 | 697 | public function __get( $name ) { |
| 698 | - if( isset( $this->{$name} ) ) { |
|
| 698 | + if ( isset( $this->{$name} ) ) { |
|
| 699 | 699 | return $this->{$name}; |
| 700 | 700 | } else { |
| 701 | 701 | return NULL; |
@@ -724,15 +724,15 @@ discard block |
||
| 724 | 724 | $additional = array(); |
| 725 | 725 | |
| 726 | 726 | // form-19-table-body.php |
| 727 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 727 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 728 | 728 | |
| 729 | 729 | // view-3-table-body.php |
| 730 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 730 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 731 | 731 | |
| 732 | - if( $this->getPostId() ) { |
|
| 732 | + if ( $this->getPostId() ) { |
|
| 733 | 733 | |
| 734 | 734 | // page-19-table-body.php |
| 735 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 735 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | // Combine with existing table-body.php and table.php |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
| 756 | 756 | |
| 757 | - if( !empty( $template_file) ) { |
|
| 757 | + if ( ! empty( $template_file ) ) { |
|
| 758 | 758 | |
| 759 | 759 | if ( $require_once ) { |
| 760 | 760 | require_once( $template_file ); |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | */ |
| 772 | 772 | public function render_widget_hooks( $view_id ) { |
| 773 | 773 | |
| 774 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 774 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 775 | 775 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
| 776 | 776 | return; |
| 777 | 777 | } |
@@ -779,9 +779,9 @@ discard block |
||
| 779 | 779 | $view_data = gravityview_get_current_view_data( $view_id ); |
| 780 | 780 | |
| 781 | 781 | // get View widget configuration |
| 782 | - $widgets = (array)$view_data['widgets']; |
|
| 782 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
| 783 | 783 | |
| 784 | - switch( current_filter() ) { |
|
| 784 | + switch ( current_filter() ) { |
|
| 785 | 785 | default: |
| 786 | 786 | case 'gravityview_before': |
| 787 | 787 | $zone = 'header'; |
@@ -795,9 +795,9 @@ discard block |
||
| 795 | 795 | * Filter widgets not in the current zone |
| 796 | 796 | * @since 1.16 |
| 797 | 797 | */ |
| 798 | - foreach( $widgets as $key => $widget ) { |
|
| 798 | + foreach ( $widgets as $key => $widget ) { |
|
| 799 | 799 | // The widget isn't in the current zone |
| 800 | - if( false === strpos( $key, $zone ) ) { |
|
| 800 | + if ( false === strpos( $key, $zone ) ) { |
|
| 801 | 801 | unset( $widgets[ $key ] ); |
| 802 | 802 | } |
| 803 | 803 | } |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // Prevent being called twice |
| 815 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
| 816 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
| 815 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
| 816 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
| 817 | 817 | return; |
| 818 | 818 | } |
| 819 | 819 | |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | $default_css_class = 'gv-grid gv-widgets-' . $zone; |
| 826 | 826 | |
| 827 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 827 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 828 | 828 | $default_css_class .= ' gv-widgets-no-results'; |
| 829 | 829 | } |
| 830 | 830 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | * @param string $zone Current widget zone, either `header` or `footer` |
| 836 | 836 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 837 | 837 | */ |
| 838 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 838 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 839 | 839 | |
| 840 | 840 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 841 | 841 | |
@@ -843,17 +843,17 @@ discard block |
||
| 843 | 843 | ?> |
| 844 | 844 | <div class="<?php echo $css_class; ?>"> |
| 845 | 845 | <?php |
| 846 | - foreach( $rows as $row ) { |
|
| 847 | - foreach( $row as $col => $areas ) { |
|
| 848 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
| 846 | + foreach ( $rows as $row ) { |
|
| 847 | + foreach ( $row as $col => $areas ) { |
|
| 848 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
| 849 | 849 | ?> |
| 850 | 850 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 851 | 851 | <?php |
| 852 | - if( !empty( $areas ) ) { |
|
| 853 | - foreach( $areas as $area ) { |
|
| 854 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 855 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
| 856 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
| 852 | + if ( ! empty( $areas ) ) { |
|
| 853 | + foreach ( $areas as $area ) { |
|
| 854 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 855 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
| 856 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | } |
@@ -869,8 +869,8 @@ discard block |
||
| 869 | 869 | * Prevent widgets from being called twice. |
| 870 | 870 | * 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 |
| 871 | 871 | */ |
| 872 | - if( did_action( 'loop_start' ) ) { |
|
| 873 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
| 872 | + if ( did_action( 'loop_start' ) ) { |
|
| 873 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
@@ -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 | |