@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
| 10 | 10 | |
| 11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
| 12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
| 12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
| 13 | 13 | |
| 14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
| 26 | 26 | |
| 27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
| 28 | -$notes = (array) GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
| 28 | +$notes = (array)GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
| 29 | 29 | $strings = GravityView_Field_Notes::strings(); |
| 30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 31 | 31 | |
| 32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
| 33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
| 33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 35 | 35 | |
| 36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
| 37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
| 38 | 38 | ?> |
| 39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
| 40 | 40 | <?php |
| 41 | - if( $show_notes ) { |
|
| 41 | + if ( $show_notes ) { |
|
| 42 | 42 | ?> |
| 43 | 43 | <form method="post" class="gv-notes-list"> |
| 44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
| 47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
| 48 | 48 | <table> |
| 49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
| 49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
| 50 | 50 | <?php |
| 51 | 51 | if ( $show_delete ) { |
| 52 | 52 | ?> |
| 53 | 53 | <thead> |
| 54 | 54 | <tr> |
| 55 | 55 | <th colspan="2"> |
| 56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
| 57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
| 56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
| 57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
| 58 | 58 | </th> |
| 59 | 59 | </tr> |
| 60 | 60 | </thead> |
| 61 | 61 | <?php } ?> |
| 62 | 62 | <tbody> |
| 63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
| 63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
| 64 | 64 | <?php |
| 65 | 65 | foreach ( $notes as $note ) { |
| 66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | } // End if can view notes |
| 75 | 75 | |
| 76 | - if( $show_add ) { |
|
| 76 | + if ( $show_add ) { |
|
| 77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
| 78 | 78 | } |
| 79 | 79 | ?> |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public static function get_duplicate_link( $entry, $view_id, $post_id = null ) { |
| 248 | 248 | |
| 249 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
| 249 | + $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
| 250 | 250 | |
| 251 | 251 | if ( empty( $base ) ) { |
| 252 | 252 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | 'action' => 'duplicate', |
| 258 | 258 | 'entry_id' => $entry['id'], |
| 259 | 259 | 'gvid' => $view_id, |
| 260 | - 'view_id' => $view_id, |
|
| 260 | + 'view_id' => $view_id, |
|
| 261 | 261 | ), $base ); |
| 262 | 262 | |
| 263 | 263 | return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl ); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @since 2.5 |
| 461 | 461 | * @param array $duplicated_entry The duplicated entry |
| 462 | 462 | * @param array $entry The original entry |
| 463 | - */ |
|
| 463 | + */ |
|
| 464 | 464 | do_action( 'gravityview/duplicate-entry/duplicated', $duplicated_entry, $entry ); |
| 465 | 465 | |
| 466 | 466 | gravityview()->log->debug( 'Duplicate response: {duplicate_response}', array( 'duplicate_response' => $duplicate_response ) ); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function add_reserved_arg( $args ) { |
| 85 | 85 | |
| 86 | - $args[] = 'duplicate'; |
|
| 86 | + $args[ ] = 'duplicate'; |
|
| 87 | 87 | |
| 88 | 88 | return $args; |
| 89 | 89 | } |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function _filter_sortable_fields( $fields ) { |
| 157 | 157 | |
| 158 | - $fields = (array) $fields; |
|
| 158 | + $fields = (array)$fields; |
|
| 159 | 159 | |
| 160 | - $fields[] = 'duplicate_link'; |
|
| 160 | + $fields[ ] = 'duplicate_link'; |
|
| 161 | 161 | |
| 162 | 162 | return $fields; |
| 163 | 163 | } |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 197 | 197 | |
| 198 | 198 | // Always a link, never a filter, always same window |
| 199 | - unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] ); |
|
| 199 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] ); |
|
| 200 | 200 | |
| 201 | 201 | // Duplicate Entry link should only appear to visitors capable of editing entries |
| 202 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
| 202 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
| 203 | 203 | |
| 204 | - $add_option['duplicate_link'] = array( |
|
| 204 | + $add_option[ 'duplicate_link' ] = array( |
|
| 205 | 205 | 'type' => 'text', |
| 206 | 206 | 'label' => __( 'Duplicate Link Text', 'gk-gravityview' ), |
| 207 | 207 | 'desc' => NULL, |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | 'merge_tags' => true, |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - $field_options['allow_duplicate_cap'] = array( |
|
| 212 | + $field_options[ 'allow_duplicate_cap' ] = array( |
|
| 213 | 213 | 'type' => 'select', |
| 214 | 214 | 'label' => __( 'Allow the following users to duplicate the entry:', 'gk-gravityview' ), |
| 215 | 215 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
| 237 | 237 | |
| 238 | 238 | if ( 'edit' !== $zone ) { |
| 239 | - $entry_default_fields['duplicate_link'] = array( |
|
| 239 | + $entry_default_fields[ 'duplicate_link' ] = array( |
|
| 240 | 240 | 'label' => __( 'Duplicate Entry', 'gk-gravityview' ), |
| 241 | 241 | 'type' => 'duplicate_link', |
| 242 | 242 | 'desc' => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gk-gravityview' ), |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function add_available_field( $available_fields = array() ) { |
| 260 | 260 | |
| 261 | - $available_fields['duplicate_link'] = array( |
|
| 261 | + $available_fields[ 'duplicate_link' ] = array( |
|
| 262 | 262 | 'label_text' => __( 'Duplicate Entry', 'gk-gravityview' ), |
| 263 | 263 | 'field_id' => 'duplicate_link', |
| 264 | 264 | 'label_type' => 'field', |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | if ( 'duplicate_link' === $field_id ) { |
| 292 | 292 | |
| 293 | 293 | // Remove other built-in caps. |
| 294 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] ); |
|
| 294 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] ); |
|
| 295 | 295 | |
| 296 | - $caps['read'] = _x( 'Entry Creator', 'User capability', 'gk-gravityview' ); |
|
| 296 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gk-gravityview' ); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | return $caps; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public static function get_duplicate_link( $entry, $view_id, $post_id = null ) { |
| 330 | 330 | |
| 331 | - $base = GravityView_API::directory_link( $post_id ? : $view_id, true ); |
|
| 331 | + $base = GravityView_API::directory_link( $post_id ?: $view_id, true ); |
|
| 332 | 332 | |
| 333 | 333 | if ( empty( $base ) ) { |
| 334 | 334 | gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) ); |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | $actionurl = add_query_arg( array( |
| 339 | 339 | 'action' => 'duplicate', |
| 340 | - 'entry_id' => $entry['id'], |
|
| 340 | + 'entry_id' => $entry[ 'id' ], |
|
| 341 | 341 | 'gvid' => $view_id, |
| 342 | 342 | 'view_id' => $view_id, |
| 343 | 343 | ), $base ); |
| 344 | 344 | |
| 345 | - return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl ); |
|
| 345 | + return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl ); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | public function process_duplicate() { |
| 364 | 364 | |
| 365 | 365 | // If the form is submitted |
| 366 | - if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) { |
|
| 366 | + if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) { |
|
| 367 | 367 | return; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | // Make sure it's a GravityView request |
| 371 | - $valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) ); |
|
| 371 | + $valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) ); |
|
| 372 | 372 | |
| 373 | 373 | if ( ! $valid_nonce_key ) { |
| 374 | 374 | gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' ); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | // Get the entry slug |
| 379 | - $entry_slug = esc_attr( $_GET['entry_id'] ); |
|
| 379 | + $entry_slug = esc_attr( $_GET[ 'entry_id' ] ); |
|
| 380 | 380 | |
| 381 | 381 | // See if there's an entry there |
| 382 | 382 | $entry = gravityview_get_entry( $entry_slug, true, false ); |
@@ -470,17 +470,17 @@ discard block |
||
| 470 | 470 | return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gk-gravityview' ) ); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
| 473 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
| 474 | 474 | |
| 475 | - $row['id'] = null; |
|
| 476 | - $row['date_created'] = date( 'Y-m-d H:i:s', time() ); |
|
| 477 | - $row['date_updated'] = $row['date_created']; |
|
| 478 | - $row['is_starred'] = false; |
|
| 479 | - $row['is_read'] = false; |
|
| 480 | - $row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip(); |
|
| 481 | - $row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) ); |
|
| 482 | - $row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' ); |
|
| 483 | - $row['created_by'] = wp_get_current_user()->ID; |
|
| 475 | + $row[ 'id' ] = null; |
|
| 476 | + $row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() ); |
|
| 477 | + $row[ 'date_updated' ] = $row[ 'date_created' ]; |
|
| 478 | + $row[ 'is_starred' ] = false; |
|
| 479 | + $row[ 'is_read' ] = false; |
|
| 480 | + $row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip(); |
|
| 481 | + $row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) ); |
|
| 482 | + $row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' ); |
|
| 483 | + $row[ 'created_by' ] = wp_get_current_user()->ID; |
|
| 484 | 484 | |
| 485 | 485 | /** |
| 486 | 486 | * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created. |
@@ -508,15 +508,15 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | $save_this_meta = array(); |
| 510 | 510 | foreach ( $duplicate_meta->get_output() as $m ) { |
| 511 | - $save_this_meta[] = array( |
|
| 512 | - 'meta_key' => $m['meta_key'], |
|
| 513 | - 'meta_value' => $m['meta_value'], |
|
| 514 | - 'item_index' => $m['item_index'], |
|
| 511 | + $save_this_meta[ ] = array( |
|
| 512 | + 'meta_key' => $m[ 'meta_key' ], |
|
| 513 | + 'meta_value' => $m[ 'meta_value' ], |
|
| 514 | + 'item_index' => $m[ 'item_index' ], |
|
| 515 | 515 | ); |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | // Update the row ID for later usage |
| 519 | - $row['id'] = $duplicated_id; |
|
| 519 | + $row[ 'id' ] = $duplicated_id; |
|
| 520 | 520 | |
| 521 | 521 | /** |
| 522 | 522 | * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details. |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | $save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry ); |
| 528 | 528 | |
| 529 | 529 | foreach ( $save_this_meta as $data ) { |
| 530 | - $data['form_id'] = $entry['form_id']; |
|
| 531 | - $data['entry_id'] = $duplicated_id; |
|
| 530 | + $data[ 'form_id' ] = $entry[ 'form_id' ]; |
|
| 531 | + $data[ 'entry_id' ] = $duplicated_id; |
|
| 532 | 532 | |
| 533 | 533 | if ( ! $wpdb->insert( $entry_meta_table, $data ) ) { |
| 534 | 534 | return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gk-gravityview' ) ); |
@@ -562,13 +562,13 @@ discard block |
||
| 562 | 562 | public function verify_nonce() { |
| 563 | 563 | |
| 564 | 564 | // No duplicate entry request was made |
| 565 | - if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) { |
|
| 565 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) { |
|
| 566 | 566 | return false; |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
| 569 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
| 570 | 570 | |
| 571 | - $valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key ); |
|
| 571 | + $valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key ); |
|
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | 574 | * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid. |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | return ''; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | - return 'return window.confirm(\''. esc_js( $confirm ) .'\');'; |
|
| 607 | + return 'return window.confirm(\'' . esc_js( $confirm ) . '\');'; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /** |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) { |
| 659 | 659 | $current_user = wp_get_current_user(); |
| 660 | 660 | |
| 661 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : null; |
|
| 661 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null; |
|
| 662 | 662 | |
| 663 | 663 | // Or if they can duplicate any entries (as defined in Gravity Forms), we're good. |
| 664 | 664 | if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) { |
@@ -673,17 +673,17 @@ discard block |
||
| 673 | 673 | if ( ! empty( $field ) ) { |
| 674 | 674 | |
| 675 | 675 | // If capability is not defined, something is not right! |
| 676 | - if ( empty( $field['allow_duplicate_cap'] ) ) { |
|
| 676 | + if ( empty( $field[ 'allow_duplicate_cap' ] ) ) { |
|
| 677 | 677 | |
| 678 | 678 | gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) ); |
| 679 | 679 | |
| 680 | 680 | return false; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) { |
|
| 683 | + if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) { |
|
| 684 | 684 | |
| 685 | 685 | // Do not return true if cap is read, as we need to check if the current user created the entry |
| 686 | - if ( 'read' !== $field['allow_duplicate_cap'] ) { |
|
| 686 | + if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) { |
|
| 687 | 687 | return true; |
| 688 | 688 | } |
| 689 | 689 | |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - if ( ! isset( $entry['created_by'] ) ) { |
|
| 699 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 700 | 700 | |
| 701 | 701 | gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' ); |
| 702 | 702 | |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | // If the logged-in user is the same as the user who created the entry, we're good. |
| 724 | - if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 724 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 725 | 725 | |
| 726 | 726 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) ); |
| 727 | 727 | |
@@ -745,12 +745,12 @@ discard block |
||
| 745 | 745 | * @return void |
| 746 | 746 | */ |
| 747 | 747 | public function maybe_display_message( $current_view_id = 0 ) { |
| 748 | - if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
| 748 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
| 749 | 749 | return; |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // Entry wasn't duplicated from current View |
| 753 | - if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) { |
|
| 753 | + if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) { |
|
| 754 | 754 | return; |
| 755 | 755 | } |
| 756 | 756 | |
@@ -758,11 +758,11 @@ discard block |
||
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | public function display_message() { |
| 761 | - if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) { |
|
| 761 | + if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) { |
|
| 762 | 762 | return; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | - $status = esc_attr( $_GET['status'] ); |
|
| 765 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
| 766 | 766 | $message_from_url = \GV\Utils::_GET( 'message', '' ); |
| 767 | 767 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
| 768 | 768 | $class = ''; |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | $message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url ); |
| 789 | 789 | |
| 790 | 790 | // DISPLAY ERROR/SUCCESS MESSAGE |
| 791 | - echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>'; |
|
| 791 | + echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>'; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | ?> |
| 819 | 819 | <span class="gv-duplicate"> |
| 820 | 820 | | |
| 821 | - <a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gk-gravityview' ); ?></a> |
|
| 821 | + <a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gk-gravityview' ); ?></a> |
|
| 822 | 822 | </span> |
| 823 | 823 | <?php |
| 824 | 824 | } |
@@ -840,9 +840,9 @@ discard block |
||
| 840 | 840 | |
| 841 | 841 | if ( 'success' === \GV\Utils::_GET( 'result' ) ) { |
| 842 | 842 | add_filter( 'gform_admin_messages', function( $messages ) { |
| 843 | - $messages = (array) $messages; |
|
| 843 | + $messages = (array)$messages; |
|
| 844 | 844 | |
| 845 | - $messages[] = esc_html__( 'Entry duplicated.', 'gk-gravityview' ); |
|
| 845 | + $messages[ ] = esc_html__( 'Entry duplicated.', 'gk-gravityview' ); |
|
| 846 | 846 | return $messages; |
| 847 | 847 | } ); |
| 848 | 848 | } |
@@ -854,9 +854,9 @@ discard block |
||
| 854 | 854 | ); |
| 855 | 855 | |
| 856 | 856 | add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) { |
| 857 | - $messages = (array) $messages; |
|
| 857 | + $messages = (array)$messages; |
|
| 858 | 858 | |
| 859 | - $messages[] = esc_html__( 'There was an error duplicating the entry.', 'gk-gravityview' ) . $check_logs_message; |
|
| 859 | + $messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gk-gravityview' ) . $check_logs_message; |
|
| 860 | 860 | |
| 861 | 861 | return $messages; |
| 862 | 862 | } ); |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <?php |
| 33 | 33 | |
| 34 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 34 | + do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 35 | 35 | |
| 36 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 36 | + do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 37 | 37 | |
| 38 | - ?> |
|
| 38 | + ?> |
|
| 39 | 39 | |
| 40 | 40 | <?php // list of available widgets to be shown in the popup ?> |
| 41 | 41 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | <div id="single-active-fields" class="gv-grid"> |
| 62 | 62 | <?php |
| 63 | - if(!empty( $curr_template ) ) { |
|
| 64 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 65 | - } |
|
| 66 | - ?> |
|
| 63 | + if(!empty( $curr_template ) ) { |
|
| 64 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 65 | + } |
|
| 66 | + ?> |
|
| 67 | 67 | </div> |
| 68 | 68 | <?php |
| 69 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 69 | + do_action('gravityview_render_field_pickers', 'single' ); |
|
| 70 | 70 | ?> |
| 71 | 71 | </div> |
| 72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | </div> |
| 86 | 86 | |
| 87 | 87 | <?php |
| 88 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 88 | + do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 89 | 89 | ?> |
| 90 | 90 | |
| 91 | 91 | </div> |
@@ -15,25 +15,25 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | <div id="directory-fields" class="gv-section"> |
| 17 | 17 | |
| 18 | - <h4><?php esc_html_e( 'Top Widgets', 'gk-gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gk-gravityview'); ?></span></h4> |
|
| 18 | + <h4><?php esc_html_e( 'Top Widgets', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gk-gravityview' ); ?></span></h4> |
|
| 19 | 19 | |
| 20 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 20 | + <?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 21 | 21 | |
| 22 | - <h4><?php esc_html_e( 'Entries Fields', 'gk-gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gk-gravityview'); ?></span></h4> |
|
| 22 | + <h4><?php esc_html_e( 'Entries Fields', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gk-gravityview' ); ?></span></h4> |
|
| 23 | 23 | |
| 24 | 24 | <div id="directory-active-fields" class="gv-grid"> |
| 25 | - <?php if(!empty( $curr_template ) ) { |
|
| 26 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 25 | + <?php if ( ! empty( $curr_template ) ) { |
|
| 26 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 27 | 27 | } ?> |
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | - <h4><?php esc_html_e( 'Bottom Widgets', 'gk-gravityview'); ?> <i class="gf_tooltip gv_tooltip" title="<?php esc_attr_e( 'These widgets will be shown below entries.', 'gk-gravityview'); ?>"></i></h4> |
|
| 30 | + <h4><?php esc_html_e( 'Bottom Widgets', 'gk-gravityview' ); ?> <i class="gf_tooltip gv_tooltip" title="<?php esc_attr_e( 'These widgets will be shown below entries.', 'gk-gravityview' ); ?>"></i></h4> |
|
| 31 | 31 | |
| 32 | 32 | <?php |
| 33 | 33 | |
| 34 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 34 | + do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 35 | 35 | |
| 36 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 36 | + do_action( 'gravityview_render_field_pickers', 'directory' ); |
|
| 37 | 37 | |
| 38 | 38 | ?> |
| 39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
| 42 | 42 | <div aria-live="polite" role="listbox" class="gv-items-picker-container gv-widget-picker-container" data-layout="grid" data-cols="2"> |
| 43 | 43 | <button class="close" role="button" aria-label="<?php esc_html_e( 'Close', 'gk-gravityview' ); ?>"><i class="dashicons dashicons-dismiss"></i></button> |
| 44 | - <?php do_action('gravityview_render_available_widgets' ); ?> |
|
| 44 | + <?php do_action( 'gravityview_render_available_widgets' ); ?> |
|
| 45 | 45 | </div> |
| 46 | 46 | </div> |
| 47 | 47 | |
@@ -59,21 +59,21 @@ discard block |
||
| 59 | 59 | <div id="single-fields" class="gv-section"> |
| 60 | 60 | |
| 61 | 61 | <div class="notice notice-warning inline is-dismissible"> |
| 62 | - <h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview'), esc_html__( 'Single Entry', 'gk-gravityview' ) ) ); ?></h3> |
|
| 62 | + <h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview' ), esc_html__( 'Single Entry', 'gk-gravityview' ) ) ); ?></h3> |
|
| 63 | 63 | <p><a data-beacon-article-modal="54c67bbae4b0512429885516" href="https://docs.gravityview.co/article/70-linking-to-a-single-entry"><?php printf( esc_html__( 'Learn how to link to %s', 'gk-gravityview' ), esc_html__( 'Single Entry', 'gk-gravityview' ) ); ?></a></p> |
| 64 | 64 | </div> |
| 65 | 65 | |
| 66 | - <h4><?php esc_html_e( 'These fields will be shown in Single Entry layout.', 'gk-gravityview'); ?></h4> |
|
| 66 | + <h4><?php esc_html_e( 'These fields will be shown in Single Entry layout.', 'gk-gravityview' ); ?></h4> |
|
| 67 | 67 | |
| 68 | 68 | <div id="single-active-fields" class="gv-grid"> |
| 69 | 69 | <?php |
| 70 | - if(!empty( $curr_template ) ) { |
|
| 71 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 70 | + if ( ! empty( $curr_template ) ) { |
|
| 71 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 72 | 72 | } |
| 73 | 73 | ?> |
| 74 | 74 | </div> |
| 75 | 75 | <?php |
| 76 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 76 | + do_action( 'gravityview_render_field_pickers', 'single' ); |
|
| 77 | 77 | ?> |
| 78 | 78 | </div> |
| 79 | 79 | |
@@ -84,20 +84,20 @@ discard block |
||
| 84 | 84 | <div id="edit-fields" class="gv-section"> |
| 85 | 85 | |
| 86 | 86 | <div class="notice notice-warning inline is-dismissible"> |
| 87 | - <h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview'), esc_html__( 'Edit Entry', 'gk-gravityview' ) ) ); ?></h3> |
|
| 87 | + <h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) ) ); ?></h3> |
|
| 88 | 88 | <p><a data-beacon-article-modal="54c67bb9e4b0512429885513" href="https://docs.gravityview.co/article/67-configuring-the-edit-entry-screen"><?php printf( esc_html__( 'Learn how to link to %s', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) ); ?></a></p> |
| 89 | 89 | </div> |
| 90 | 90 | |
| 91 | - <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gk-gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gk-gravityview'); ?></span></h4> |
|
| 91 | + <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gk-gravityview' ); ?></span></h4> |
|
| 92 | 92 | |
| 93 | 93 | <div id="edit-active-fields" class="gv-grid"> |
| 94 | 94 | <?php |
| 95 | - do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 95 | + do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 96 | 96 | ?> |
| 97 | 97 | </div> |
| 98 | 98 | |
| 99 | 99 | <?php |
| 100 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 100 | + do_action( 'gravityview_render_field_pickers', 'edit' ); |
|
| 101 | 101 | ?> |
| 102 | 102 | |
| 103 | 103 | </div> |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | |
| 70 | 70 | $url = add_query_arg( array( |
| 71 | 71 | 'utm_source' => 'powered_by', |
| 72 | - 'utm_term' => get_bloginfo('name' ), |
|
| 72 | + 'utm_term' => get_bloginfo('name' ), |
|
| 73 | 73 | ), $url ); |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $powered_by = gravityview()->plugin->settings->get_gravitykit_setting( 'powered_by', 0 ); |
| 34 | 34 | |
| 35 | - if( empty( $powered_by ) ) { |
|
| 35 | + if ( empty( $powered_by ) ) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected function get_url() { |
| 61 | 61 | |
| 62 | - $url = sprintf( self::url, get_bloginfo('name' ) ); |
|
| 62 | + $url = sprintf( self::url, get_bloginfo( 'name' ) ); |
|
| 63 | 63 | |
| 64 | 64 | $affiliate_id = gravityview()->plugin->settings->get_gravitykit_setting( 'affiliate_id', '' ); |
| 65 | 65 | |
| 66 | - if( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
| 66 | + if ( $affiliate_id && is_numeric( $affiliate_id ) ) { |
|
| 67 | 67 | $url = add_query_arg( array( 'ref' => $affiliate_id ), $url ); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $url = add_query_arg( array( |
| 71 | 71 | 'utm_source' => 'powered_by', |
| 72 | - 'utm_term' => get_bloginfo('name' ), |
|
| 72 | + 'utm_term' => get_bloginfo( 'name' ), |
|
| 73 | 73 | ), $url ); |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $args = array(); |
| 115 | 115 | |
| 116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
| 116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
| 117 | 117 | |
| 118 | 118 | $permalink = null; |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $view_collection = View_Collection::from_post( $post ); |
| 128 | 128 | |
| 129 | - if( 1 < $view_collection->count() ) { |
|
| 130 | - $args['gvid'] = $view_id; |
|
| 129 | + if ( 1 < $view_collection->count() ) { |
|
| 130 | + $args[ 'gvid' ] = $view_id; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -157,21 +157,21 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | $link_parts = explode( '?', $permalink ); |
| 159 | 159 | |
| 160 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
| 160 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 161 | 161 | |
| 162 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
| 162 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
| 163 | 163 | } else { |
| 164 | 164 | $args[ $entry_endpoint_name ] = $entry_slug; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if ( $track_directory ) { |
| 168 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 169 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 168 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 169 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if ( $sort = Utils::_GET( 'sort' ) ) { |
| 173 | - $args['sort'] = $sort; |
|
| 174 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
| 173 | + $args[ 'sort' ] = $sort; |
|
| 174 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $entry_slug = \GravityView_API::get_entry_slug( $this->ID, $this->as_entry() ); |
| 211 | 211 | |
| 212 | - if( ! $apply_filter ) { |
|
| 212 | + if ( ! $apply_filter ) { |
|
| 213 | 213 | return $entry_slug; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | public function get_output() { |
| 191 | 191 | |
| 192 | 192 | // No Entries |
| 193 | - if( empty( $this->entries ) ) { |
|
| 194 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
| 193 | + if ( empty( $this->entries ) ) { |
|
| 194 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $output = ''; |
@@ -202,22 +202,22 @@ discard block |
||
| 202 | 202 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
| 205 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
| 206 | 206 | |
| 207 | - foreach( $this->entries as $entry ) { |
|
| 207 | + foreach ( $this->entries as $entry ) { |
|
| 208 | 208 | |
| 209 | 209 | if ( $entry instanceof \GV\Entry ) { |
| 210 | 210 | $entry = $entry->as_entry(); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 213 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $output .= $this->get_item_output( $entry ); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
| 220 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -240,15 +240,15 @@ discard block |
||
| 240 | 240 | private function skip_entry( $entry, $current_entry ) { |
| 241 | 241 | |
| 242 | 242 | // If skip entry is off, or there's no current entry, return false |
| 243 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 243 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If in Single or Edit mode, $current_entry will be an array. |
| 248 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
| 248 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
| 249 | 249 | |
| 250 | 250 | // If the entry ID matches the current entry, yes: skip |
| 251 | - if( $entry['id'] === $current_entry_id ) { |
|
| 251 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
| 252 | 252 | return true; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $item_output = gravityview_get_link( $link, $this->link_format ); |
| 285 | 285 | |
| 286 | - if( !empty( $this->after_link ) ) { |
|
| 286 | + if ( ! empty( $this->after_link ) ) { |
|
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | 289 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -292,14 +292,14 @@ discard block |
||
| 292 | 292 | * @param array $entry Gravity Forms entry array |
| 293 | 293 | * @param GravityView_Entry_List $this The current class instance |
| 294 | 294 | */ |
| 295 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
| 295 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
| 296 | 296 | |
| 297 | 297 | $item_output .= $after_link; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
| 301 | 301 | |
| 302 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
| 302 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -88,15 +88,15 @@ |
||
| 88 | 88 | */ |
| 89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
| 90 | 90 | |
| 91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
| 91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
| 92 | 92 | return $label; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
| 95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
| 96 | 96 | return $label; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
| 99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
| 100 | 100 | return $label; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | $defaults = self::get_field_defaults(); |
| 34 | 34 | |
| 35 | 35 | // Backward compatibility |
| 36 | - if( !empty( $field['choices'] ) ) { |
|
| 37 | - $field['options'] = $field['choices']; |
|
| 38 | - unset( $field['choices'] ); |
|
| 36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
| 37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
| 38 | + unset( $field[ 'choices' ] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
| 41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | 42 | |
| 43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | function get_tooltip() { |
| 82 | - if( ! function_exists('gform_tooltip') ) { |
|
| 82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'url' => '#', |
| 90 | 90 | ) ); |
| 91 | 91 | |
| 92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Below this line has been modified by GravityView. |
| 133 | 133 | */ |
| 134 | 134 | |
| 135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
| 135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
| 136 | 136 | return ''; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | 170 | function get_field_id() { |
| 171 | - if( isset( $this->field['id'] ) ) { |
|
| 172 | - return esc_attr( $this->field['id'] ); |
|
| 171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
| 172 | + return esc_attr( $this->field[ 'id' ] ); |
|
| 173 | 173 | } |
| 174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
| 175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | 181 | function get_field_label() { |
| 182 | - return esc_html( trim( $this->field['label'] ) ); |
|
| 182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | 192 | function get_field_left_label() { |
| 193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
| 193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return string |
| 199 | 199 | */ |
| 200 | 200 | function get_label_class() { |
| 201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return string |
| 208 | 208 | */ |
| 209 | 209 | function get_field_desc() { |
| 210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function render_setting( $override_input = NULL ) { |
| 242 | 242 | |
| 243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
| 244 | 244 | <th scope="row" colspan="2"> |
| 245 | 245 | <div> |
| 246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -10,107 +10,107 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @var string |
| 12 | 12 | */ |
| 13 | - protected $name; |
|
| 13 | + protected $name; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Field settings |
| 17 | 17 | * |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - protected $field; |
|
| 20 | + protected $field; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Field current value |
| 24 | 24 | * |
| 25 | 25 | * @var mixed |
| 26 | 26 | */ |
| 27 | - protected $value; |
|
| 28 | - |
|
| 29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | - |
|
| 31 | - $this->name = $name; |
|
| 32 | - |
|
| 33 | - $defaults = self::get_field_defaults(); |
|
| 34 | - |
|
| 35 | - // Backward compatibility |
|
| 36 | - if( !empty( $field['choices'] ) ) { |
|
| 37 | - $field['options'] = $field['choices']; |
|
| 38 | - unset( $field['choices'] ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | - |
|
| 43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Returns the default details for a field option |
|
| 49 | - * |
|
| 50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | - * - desc // option description |
|
| 52 | - * - value // the option default value |
|
| 53 | - * - label // the option label |
|
| 54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | - * - id // the field id |
|
| 56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | - * - merge_tags // if the option supports merge tags feature |
|
| 59 | - * - class // (new) define extra classes for the field |
|
| 60 | - * - tooltip // |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public static function get_field_defaults() { |
|
| 65 | - return array( |
|
| 66 | - 'desc' => '', |
|
| 67 | - 'value' => null, |
|
| 68 | - 'label' => '', |
|
| 69 | - 'left_label' => null, |
|
| 70 | - 'id' => null, |
|
| 71 | - 'type' => 'text', |
|
| 72 | - 'options' => null, |
|
| 73 | - 'merge_tags' => true, |
|
| 74 | - 'class' => '', |
|
| 75 | - 'tooltip' => null, |
|
| 76 | - 'requires' => null |
|
| 77 | - ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - function get_tooltip() { |
|
| 82 | - if( ! function_exists('gform_tooltip') ) { |
|
| 83 | - return null; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
| 87 | - 'id' => '', |
|
| 88 | - 'type' => 'modal', |
|
| 89 | - 'url' => '#', |
|
| 90 | - ) ); |
|
| 91 | - |
|
| 92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Displays the tooltip |
|
| 97 | - * |
|
| 98 | - * @since 2.8.1 |
|
| 99 | - * |
|
| 100 | - * @global $__gf_tooltips |
|
| 101 | - * |
|
| 102 | - * @param string $name The name of the tooltip to be displayed |
|
| 103 | - * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
| 104 | - * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
| 105 | - * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
| 106 | - * @type string $id Unique ID of article for Beacon API |
|
| 107 | - * @type string $url URL of support doc article |
|
| 108 | - * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
| 109 | - * } |
|
| 110 | - * |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
| 27 | + protected $value; |
|
| 28 | + |
|
| 29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | + |
|
| 31 | + $this->name = $name; |
|
| 32 | + |
|
| 33 | + $defaults = self::get_field_defaults(); |
|
| 34 | + |
|
| 35 | + // Backward compatibility |
|
| 36 | + if( !empty( $field['choices'] ) ) { |
|
| 37 | + $field['options'] = $field['choices']; |
|
| 38 | + unset( $field['choices'] ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | + |
|
| 43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Returns the default details for a field option |
|
| 49 | + * |
|
| 50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | + * - desc // option description |
|
| 52 | + * - value // the option default value |
|
| 53 | + * - label // the option label |
|
| 54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | + * - id // the field id |
|
| 56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | + * - merge_tags // if the option supports merge tags feature |
|
| 59 | + * - class // (new) define extra classes for the field |
|
| 60 | + * - tooltip // |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public static function get_field_defaults() { |
|
| 65 | + return array( |
|
| 66 | + 'desc' => '', |
|
| 67 | + 'value' => null, |
|
| 68 | + 'label' => '', |
|
| 69 | + 'left_label' => null, |
|
| 70 | + 'id' => null, |
|
| 71 | + 'type' => 'text', |
|
| 72 | + 'options' => null, |
|
| 73 | + 'merge_tags' => true, |
|
| 74 | + 'class' => '', |
|
| 75 | + 'tooltip' => null, |
|
| 76 | + 'requires' => null |
|
| 77 | + ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + function get_tooltip() { |
|
| 82 | + if( ! function_exists('gform_tooltip') ) { |
|
| 83 | + return null; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $article = wp_parse_args( \GV\Utils::get( $this->field, 'article', array() ), array( |
|
| 87 | + 'id' => '', |
|
| 88 | + 'type' => 'modal', |
|
| 89 | + 'url' => '#', |
|
| 90 | + ) ); |
|
| 91 | + |
|
| 92 | + return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Displays the tooltip |
|
| 97 | + * |
|
| 98 | + * @since 2.8.1 |
|
| 99 | + * |
|
| 100 | + * @global $__gf_tooltips |
|
| 101 | + * |
|
| 102 | + * @param string $name The name of the tooltip to be displayed |
|
| 103 | + * @param string $css_class Optional. The CSS class to apply toi the element. Defaults to empty string. |
|
| 104 | + * @param bool $return Optional. If the tooltip should be returned instead of output. Defaults to false (output) |
|
| 105 | + * @param array $article Optional. Details about support doc article connected to the tooltip. { |
|
| 106 | + * @type string $id Unique ID of article for Beacon API |
|
| 107 | + * @type string $url URL of support doc article |
|
| 108 | + * @type string $type Type of Beacon element to open. {@see https://developer.helpscout.com/beacon-2/web/javascript-api/#beaconarticle} |
|
| 109 | + * } |
|
| 110 | + * |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + function tooltip( $name, $css_class = '', $return = false, $article = array() ) { |
|
| 114 | 114 | global $__gf_tooltips; //declared as global to improve WPML performance |
| 115 | 115 | |
| 116 | 116 | $css_class = empty( $css_class ) ? 'tooltip' : $css_class; |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | $tooltip_class = isset( $__gf_tooltips[ $name ] ) ? "tooltip_{$name}" : ''; |
| 129 | 129 | $tooltip_class = esc_attr( $tooltip_class ); |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Below this line has been modified by GravityView. |
|
| 133 | - */ |
|
| 131 | + /** |
|
| 132 | + * Below this line has been modified by GravityView. |
|
| 133 | + */ |
|
| 134 | 134 | |
| 135 | 135 | if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
| 136 | 136 | return ''; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $url = '#'; |
| 140 | - $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
| 141 | - $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
| 140 | + $atts = 'onclick="return false;" onkeypress="return false;"'; |
|
| 141 | + $anchor_text = '<i class=\'fa fa-question-circle\'></i>'; |
|
| 142 | 142 | $css_class = gravityview_sanitize_html_class( 'gf_tooltip ' . $css_class . ' ' . $tooltip_class ); |
| 143 | 143 | |
| 144 | 144 | $tooltip = sprintf( '<a href="%s" %s class="%s" title="%s" role="button">%s</a>', |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | $anchor_text |
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Modify the tooltip HTML before outputting |
|
| 154 | - * @internal |
|
| 155 | - * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
| 156 | - */ |
|
| 152 | + /** |
|
| 153 | + * Modify the tooltip HTML before outputting |
|
| 154 | + * @internal |
|
| 155 | + * @see GravityView_Support_Port::maybe_add_article_to_tooltip() |
|
| 156 | + */ |
|
| 157 | 157 | $tooltip = apply_filters( 'gravityview/tooltips/tooltip', $tooltip, $article, $url, $atts, $css_class, $tooltip_text, $anchor_text ); |
| 158 | 158 | |
| 159 | 159 | if ( ! $return ) { |
@@ -163,84 +163,84 @@ discard block |
||
| 163 | 163 | return $tooltip; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Build input id based on the name |
|
| 168 | - * @return string |
|
| 169 | - */ |
|
| 170 | - function get_field_id() { |
|
| 171 | - if( isset( $this->field['id'] ) ) { |
|
| 172 | - return esc_attr( $this->field['id'] ); |
|
| 173 | - } |
|
| 174 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Retrieve field label |
|
| 179 | - * @return string |
|
| 180 | - */ |
|
| 181 | - function get_field_label() { |
|
| 182 | - return esc_html( trim( $this->field['label'] ) ); |
|
| 183 | - } |
|
| 166 | + /** |
|
| 167 | + * Build input id based on the name |
|
| 168 | + * @return string |
|
| 169 | + */ |
|
| 170 | + function get_field_id() { |
|
| 171 | + if( isset( $this->field['id'] ) ) { |
|
| 172 | + return esc_attr( $this->field['id'] ); |
|
| 173 | + } |
|
| 174 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Retrieve field label |
|
| 179 | + * @return string |
|
| 180 | + */ |
|
| 181 | + function get_field_label() { |
|
| 182 | + return esc_html( trim( $this->field['label'] ) ); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * Retrieve field left label |
| 187 | - * |
|
| 188 | - * @since 1.7 |
|
| 189 | - * |
|
| 187 | + * |
|
| 188 | + * @since 1.7 |
|
| 189 | + * |
|
| 190 | 190 | * @return string |
| 191 | 191 | */ |
| 192 | 192 | function get_field_left_label() { |
| 193 | 193 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * Retrieve field label class |
|
| 198 | - * @return string |
|
| 199 | - */ |
|
| 200 | - function get_label_class() { |
|
| 201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Retrieve field description |
|
| 207 | - * @return string |
|
| 208 | - */ |
|
| 209 | - function get_field_desc() { |
|
| 210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * Verify if field should have merge tags |
|
| 216 | - * @return boolean |
|
| 217 | - */ |
|
| 218 | - function show_merge_tags() { |
|
| 219 | - // Show the merge tags if the field is a list view |
|
| 220 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 221 | - // Or is a single entry view |
|
| 222 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 223 | - |
|
| 224 | - return ( $is_single || $is_list ); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * important! Override this class |
|
| 231 | - * outputs the field option html |
|
| 232 | - */ |
|
| 233 | - function render_option() { |
|
| 234 | - // to replace on each field |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * important! Override this class if needed |
|
| 239 | - * outputs the field setting html |
|
| 240 | - */ |
|
| 241 | - function render_setting( $override_input = NULL ) { |
|
| 242 | - |
|
| 243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 196 | + /** |
|
| 197 | + * Retrieve field label class |
|
| 198 | + * @return string |
|
| 199 | + */ |
|
| 200 | + function get_label_class() { |
|
| 201 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Retrieve field description |
|
| 207 | + * @return string |
|
| 208 | + */ |
|
| 209 | + function get_field_desc() { |
|
| 210 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * Verify if field should have merge tags |
|
| 216 | + * @return boolean |
|
| 217 | + */ |
|
| 218 | + function show_merge_tags() { |
|
| 219 | + // Show the merge tags if the field is a list view |
|
| 220 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 221 | + // Or is a single entry view |
|
| 222 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 223 | + |
|
| 224 | + return ( $is_single || $is_list ); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * important! Override this class |
|
| 231 | + * outputs the field option html |
|
| 232 | + */ |
|
| 233 | + function render_option() { |
|
| 234 | + // to replace on each field |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * important! Override this class if needed |
|
| 239 | + * outputs the field setting html |
|
| 240 | + */ |
|
| 241 | + function render_setting( $override_input = NULL ) { |
|
| 242 | + |
|
| 243 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 244 | 244 | <th scope="row" colspan="2"> |
| 245 | 245 | <div> |
| 246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | </td> |
| 261 | 261 | <?php } |
| 262 | 262 | |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * important! Override this class |
|
| 267 | - * outputs the input html part |
|
| 268 | - */ |
|
| 269 | - function render_input( $override_input ) { |
|
| 270 | - echo ''; |
|
| 271 | - } |
|
| 265 | + /** |
|
| 266 | + * important! Override this class |
|
| 267 | + * outputs the input html part |
|
| 268 | + */ |
|
| 269 | + function render_input( $override_input ) { |
|
| 270 | + echo ''; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | 273 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Try subkeys after split. |
| 92 | 92 | */ |
| 93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
| 94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
| 94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function gf_query_debug( $query ) { |
| 146 | 146 | $introspect = $query->_introspect(); |
| 147 | 147 | return array( |
| 148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
| 148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | if ( $condition->expressions ) { |
| 159 | 159 | $conditions = array(); |
| 160 | 160 | foreach ( $condition->expressions as $expression ) { |
| 161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
| 161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
| 162 | 162 | } |
| 163 | 163 | return call_user_func_array( |
| 164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |