@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | add_action( 'wp', array( $this, 'process_delete' ), 10000 ); |
| 44 | 44 | |
| 45 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 ); |
|
| 45 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
| 46 | 46 | |
| 47 | 47 | add_action( 'gravityview_before', array( $this, 'display_message' ) ); |
| 48 | 48 | |
| 49 | 49 | // For the Delete Entry Link, you don't want visible to all users. |
| 50 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 ); |
|
| 50 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
| 51 | 51 | |
| 52 | 52 | // Modify the field options based on the name of the field type |
| 53 | 53 | add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 ); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | // add template path to check for field |
| 56 | 56 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
| 57 | 57 | |
| 58 | - add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 3 ); |
|
| 58 | + add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 3 ); |
|
| 59 | 59 | |
| 60 | - add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 61 | - add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 60 | + add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 61 | + add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | static function getInstance() { |
| 71 | 71 | |
| 72 | - if( empty( self::$instance ) ) { |
|
| 72 | + if ( empty( self::$instance ) ) { |
|
| 73 | 73 | self::$instance = new self; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 106 | 106 | |
| 107 | 107 | // Always a link, never a filter |
| 108 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
| 108 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
| 109 | 109 | |
| 110 | 110 | // Delete Entry link should only appear to visitors capable of editing entries |
| 111 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
| 111 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
| 112 | 112 | |
| 113 | - $add_option['delete_link'] = array( |
|
| 113 | + $add_option[ 'delete_link' ] = array( |
|
| 114 | 114 | 'type' => 'text', |
| 115 | 115 | 'label' => __( 'Delete Link Text', 'gravityview' ), |
| 116 | 116 | 'desc' => NULL, |
| 117 | - 'value' => __('Delete Entry', 'gravityview'), |
|
| 117 | + 'value' => __( 'Delete Entry', 'gravityview' ), |
|
| 118 | 118 | 'merge_tags' => true, |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $field_options['allow_edit_cap'] = array( |
|
| 121 | + $field_options[ 'allow_edit_cap' ] = array( |
|
| 122 | 122 | 'type' => 'select', |
| 123 | 123 | 'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ), |
| 124 | 124 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
| 144 | 144 | |
| 145 | - if( 'edit' !== $zone ) { |
|
| 146 | - $entry_default_fields['delete_link'] = array( |
|
| 145 | + if ( 'edit' !== $zone ) { |
|
| 146 | + $entry_default_fields[ 'delete_link' ] = array( |
|
| 147 | 147 | 'label' => __( 'Delete Entry', 'gravityview' ), |
| 148 | 148 | 'type' => 'delete_link', |
| 149 | 149 | 'desc' => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ), |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | function add_available_field( $available_fields = array() ) { |
| 162 | 162 | |
| 163 | - $available_fields['delete_link'] = array( |
|
| 163 | + $available_fields[ 'delete_link' ] = array( |
|
| 164 | 164 | 'label_text' => __( 'Delete Entry', 'gravityview' ), |
| 165 | 165 | 'field_id' => 'delete_link', |
| 166 | 166 | 'label_type' => 'field', |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | $caps = $visibility_caps; |
| 189 | 189 | |
| 190 | 190 | // If we're configuring fields in the edit context, we want a limited selection |
| 191 | - if( $field_id === 'delete_link' ) { |
|
| 191 | + if ( $field_id === 'delete_link' ) { |
|
| 192 | 192 | |
| 193 | 193 | // Remove other built-in caps. |
| 194 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
| 194 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
| 195 | 195 | |
| 196 | - $caps['read'] = _x('Entry Creator', 'User capability', 'gravityview'); |
|
| 196 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | return $caps; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param [type] $entry [description] |
| 207 | 207 | */ |
| 208 | 208 | function set_entry( $entry = null ) { |
| 209 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
| 209 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $base = GravityView_API::directory_link( $post_id, true ); |
| 238 | 238 | |
| 239 | - if( empty( $base ) ) { |
|
| 240 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: '.$post_id ); |
|
| 239 | + if ( empty( $base ) ) { |
|
| 240 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: ' . $post_id ); |
|
| 241 | 241 | return NULL; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Use the slug instead of the ID for consistent security |
| 245 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 245 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 246 | 246 | |
| 247 | 247 | $view_id = empty( $view_id ) ? gravityview_get_view_id() : $view_id; |
| 248 | 248 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | 'view_id' => $view_id, |
| 254 | 254 | ), $base ); |
| 255 | 255 | |
| 256 | - $url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' ); |
|
| 256 | + $url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' ); |
|
| 257 | 257 | |
| 258 | 258 | return $url; |
| 259 | 259 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | function add_delete_button( $form = array(), $entry = array(), $view_id = NULL ) { |
| 271 | 271 | |
| 272 | 272 | // Only show the link to those who are allowed to see it. |
| 273 | - if( !self::check_user_cap_delete_entry( $entry ) ) { |
|
| 273 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | $show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true ); |
| 282 | 282 | |
| 283 | 283 | // If the button is hidden by the filter, don't show. |
| 284 | - if( !$show_delete_button ) { |
|
| 284 | + if ( ! $show_delete_button ) { |
|
| 285 | 285 | return; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $attributes = array( |
| 289 | 289 | 'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', |
| 290 | - 'tabindex' => ( GFCommon::$tab_index ++ ), |
|
| 290 | + 'tabindex' => ( GFCommon::$tab_index++ ), |
|
| 291 | 291 | 'onclick' => self::get_confirm_dialog(), |
| 292 | 292 | ); |
| 293 | 293 | |
@@ -311,27 +311,27 @@ discard block |
||
| 311 | 311 | function process_delete() { |
| 312 | 312 | |
| 313 | 313 | // If the form is submitted |
| 314 | - if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) { |
|
| 314 | + if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) { |
|
| 315 | 315 | |
| 316 | 316 | // Make sure it's a GravityView request |
| 317 | - $valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) ); |
|
| 317 | + $valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) ); |
|
| 318 | 318 | |
| 319 | - if( ! $valid_nonce_key ) { |
|
| 320 | - do_action('gravityview_log_debug', __METHOD__ . ' Delete entry not processed: nonce validation failed.' ); |
|
| 319 | + if ( ! $valid_nonce_key ) { |
|
| 320 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Delete entry not processed: nonce validation failed.' ); |
|
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // Get the entry slug |
| 325 | - $entry_slug = esc_attr( $_GET['entry_id'] ); |
|
| 325 | + $entry_slug = esc_attr( $_GET[ 'entry_id' ] ); |
|
| 326 | 326 | |
| 327 | 327 | // See if there's an entry there |
| 328 | 328 | $entry = gravityview_get_entry( $entry_slug, true, false ); |
| 329 | 329 | |
| 330 | - if( $entry ) { |
|
| 330 | + if ( $entry ) { |
|
| 331 | 331 | |
| 332 | 332 | $has_permission = $this->user_can_delete_entry( $entry ); |
| 333 | 333 | |
| 334 | - if( is_wp_error( $has_permission ) ) { |
|
| 334 | + if ( is_wp_error( $has_permission ) ) { |
|
| 335 | 335 | |
| 336 | 336 | $messages = array( |
| 337 | 337 | 'message' => urlencode( $has_permission->get_error_message() ), |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | // Delete the entry |
| 344 | 344 | $delete_response = $this->delete_or_trash_entry( $entry ); |
| 345 | 345 | |
| 346 | - if( is_wp_error( $delete_response ) ) { |
|
| 346 | + if ( is_wp_error( $delete_response ) ) { |
|
| 347 | 347 | |
| 348 | 348 | $messages = array( |
| 349 | 349 | 'message' => urlencode( $delete_response->get_error_message() ), |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | } else { |
| 364 | 364 | |
| 365 | - do_action('gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug '. $entry_slug ); |
|
| 365 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug ' . $entry_slug ); |
|
| 366 | 366 | |
| 367 | 367 | $messages = array( |
| 368 | - 'message' => urlencode( __('The entry does not exist.', 'gravityview') ), |
|
| 368 | + 'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ), |
|
| 369 | 369 | 'status' => 'error', |
| 370 | 370 | ); |
| 371 | 371 | } |
@@ -405,18 +405,18 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | private function delete_or_trash_entry( $entry ) { |
| 407 | 407 | |
| 408 | - $entry_id = $entry['id']; |
|
| 408 | + $entry_id = $entry[ 'id' ]; |
|
| 409 | 409 | |
| 410 | 410 | $mode = $this->get_delete_mode(); |
| 411 | 411 | |
| 412 | - if( 'delete' === $mode ) { |
|
| 412 | + if ( 'delete' === $mode ) { |
|
| 413 | 413 | |
| 414 | 414 | do_action( 'gravityview_log_debug', __METHOD__ . ' Starting delete entry: ', $entry_id ); |
| 415 | 415 | |
| 416 | 416 | // Delete the entry |
| 417 | 417 | $delete_response = GFAPI::delete_entry( $entry_id ); |
| 418 | 418 | |
| 419 | - if( ! is_wp_error( $delete_response ) ) { |
|
| 419 | + if ( ! is_wp_error( $delete_response ) ) { |
|
| 420 | 420 | $delete_response = 'deleted'; |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | $trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' ); |
| 438 | 438 | new GravityView_Cache; |
| 439 | 439 | |
| 440 | - if( ! $trashed ) { |
|
| 441 | - $delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) ); |
|
| 440 | + if ( ! $trashed ) { |
|
| 441 | + $delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) ); |
|
| 442 | 442 | } else { |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
| 470 | 470 | |
| 471 | 471 | // The entry had no connected post |
| 472 | - if( empty( $entry['post_id'] ) ) { |
|
| 472 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
| 473 | 473 | return; |
| 474 | 474 | } |
| 475 | 475 | |
@@ -480,22 +480,22 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | $delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true ); |
| 482 | 482 | |
| 483 | - if( false === $delete_post ) { |
|
| 483 | + if ( false === $delete_post ) { |
|
| 484 | 484 | return; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | $action = current_action(); |
| 488 | 488 | |
| 489 | - if( 'gravityview/delete-entry/deleted' === $action ) { |
|
| 490 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
| 489 | + if ( 'gravityview/delete-entry/deleted' === $action ) { |
|
| 490 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
| 491 | 491 | } else { |
| 492 | - $result = wp_trash_post( $entry['post_id'] ); |
|
| 492 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if( false === $result ) { |
|
| 496 | - do_action( 'gravityview_log_error', __METHOD__ . ' (called by '.$action.'): Error processing the Post connected to the entry.', $entry ); |
|
| 495 | + if ( false === $result ) { |
|
| 496 | + do_action( 'gravityview_log_error', __METHOD__ . ' (called by ' . $action . '): Error processing the Post connected to the entry.', $entry ); |
|
| 497 | 497 | } else { |
| 498 | - do_action( 'gravityview_log_debug', __METHOD__ . ' (called by '.$action.'): Successfully processed Post connected to the entry.', $entry ); |
|
| 498 | + do_action( 'gravityview_log_debug', __METHOD__ . ' (called by ' . $action . '): Successfully processed Post connected to the entry.', $entry ); |
|
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
@@ -508,13 +508,13 @@ discard block |
||
| 508 | 508 | public function verify_nonce() { |
| 509 | 509 | |
| 510 | 510 | // No delete entry request was made |
| 511 | - if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
| 511 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
| 512 | 512 | return false; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
| 515 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
| 516 | 516 | |
| 517 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
| 517 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
| 518 | 518 | |
| 519 | 519 | /** |
| 520 | 520 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | */ |
| 537 | 537 | public static function get_confirm_dialog() { |
| 538 | 538 | |
| 539 | - $confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview'); |
|
| 539 | + $confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' ); |
|
| 540 | 540 | |
| 541 | 541 | /** |
| 542 | 542 | * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | $confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm ); |
| 546 | 546 | |
| 547 | - return 'return window.confirm(\''. esc_js( $confirm ) .'\');'; |
|
| 547 | + return 'return window.confirm(\'' . esc_js( $confirm ) . '\');'; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
@@ -562,16 +562,16 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | $error = NULL; |
| 564 | 564 | |
| 565 | - if( ! $this->verify_nonce() ) { |
|
| 566 | - $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview'); |
|
| 565 | + if ( ! $this->verify_nonce() ) { |
|
| 566 | + $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' ); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - if( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 570 | - $error = __( 'You do not have permission to delete this entry.', 'gravityview'); |
|
| 569 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 570 | + $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if( $entry['status'] === 'trash' ) { |
|
| 574 | - if( 'trash' === $this->get_delete_mode() ) { |
|
| 573 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
| 574 | + if ( 'trash' === $this->get_delete_mode() ) { |
|
| 575 | 575 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
| 576 | 576 | } else { |
| 577 | 577 | $error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' ); |
@@ -579,11 +579,11 @@ discard block |
||
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | // No errors; everything's fine here! |
| 582 | - if( empty( $error ) ) { |
|
| 582 | + if ( empty( $error ) ) { |
|
| 583 | 583 | return true; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
| 586 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
| 587 | 587 | |
| 588 | 588 | return new WP_Error( 'gravityview-delete-entry-permissions', $error ); |
| 589 | 589 | } |
@@ -605,32 +605,32 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | $current_user = wp_get_current_user(); |
| 607 | 607 | |
| 608 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL; |
|
| 608 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL; |
|
| 609 | 609 | |
| 610 | 610 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
| 611 | - if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
| 611 | + if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
| 612 | 612 | |
| 613 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
| 613 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
| 614 | 614 | |
| 615 | 615 | return true; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
| 619 | 619 | // If field options are passed, check if current user can view the link |
| 620 | - if( !empty( $field ) ) { |
|
| 620 | + if ( ! empty( $field ) ) { |
|
| 621 | 621 | |
| 622 | 622 | // If capability is not defined, something is not right! |
| 623 | - if( empty( $field['allow_edit_cap'] ) ) { |
|
| 623 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
| 624 | 624 | |
| 625 | 625 | do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Cannot read delete entry field caps', $field ); |
| 626 | 626 | |
| 627 | 627 | return false; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
| 630 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
| 631 | 631 | |
| 632 | 632 | // Do not return true if cap is read, as we need to check if the current user created the entry |
| 633 | - if( $field['allow_edit_cap'] !== 'read' ) { |
|
| 633 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
| 634 | 634 | return true; |
| 635 | 635 | } |
| 636 | 636 | |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | - if( !isset( $entry['created_by'] ) ) { |
|
| 646 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 647 | 647 | |
| 648 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.'); |
|
| 648 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.' ); |
|
| 649 | 649 | |
| 650 | 650 | return false; |
| 651 | 651 | } |
@@ -653,24 +653,24 @@ discard block |
||
| 653 | 653 | $view_id = empty( $view_id ) ? $gravityview_view->getViewId() : $view_id; |
| 654 | 654 | |
| 655 | 655 | // Only checks user_delete view option if view is already set |
| 656 | - if( $view_id ) { |
|
| 656 | + if ( $view_id ) { |
|
| 657 | 657 | |
| 658 | 658 | $current_view = gravityview_get_current_view_data( $view_id ); |
| 659 | 659 | |
| 660 | - $user_delete = isset( $current_view['atts']['user_delete'] ) ? $current_view['atts']['user_delete'] : false; |
|
| 660 | + $user_delete = isset( $current_view[ 'atts' ][ 'user_delete' ] ) ? $current_view[ 'atts' ][ 'user_delete' ] : false; |
|
| 661 | 661 | |
| 662 | - if( empty( $user_delete ) ) { |
|
| 662 | + if ( empty( $user_delete ) ) { |
|
| 663 | 663 | |
| 664 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
| 664 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
| 665 | 665 | |
| 666 | 666 | return false; |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // If the logged-in user is the same as the user who created the entry, we're good. |
| 671 | - if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 671 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 672 | 672 | |
| 673 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 673 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 674 | 674 | |
| 675 | 675 | return true; |
| 676 | 676 | } |
@@ -693,31 +693,31 @@ discard block |
||
| 693 | 693 | */ |
| 694 | 694 | public function display_message( $current_view_id = 0 ) { |
| 695 | 695 | |
| 696 | - if( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
| 696 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
| 697 | 697 | return; |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | // Entry wasn't deleted from current View |
| 701 | - if( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) { |
|
| 701 | + if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) { |
|
| 702 | 702 | return; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - $status = esc_attr( $_GET['status'] ); |
|
| 706 | - $message_from_url = rgget('message'); |
|
| 705 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
| 706 | + $message_from_url = rgget( 'message' ); |
|
| 707 | 707 | $message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) ); |
| 708 | 708 | $class = ''; |
| 709 | 709 | |
| 710 | 710 | switch ( $status ) { |
| 711 | 711 | case 'error': |
| 712 | 712 | $class = ' gv-error error'; |
| 713 | - $error_message = __('There was an error deleting the entry: %s', 'gravityview'); |
|
| 713 | + $error_message = __( 'There was an error deleting the entry: %s', 'gravityview' ); |
|
| 714 | 714 | $message = sprintf( $error_message, $message_from_url ); |
| 715 | 715 | break; |
| 716 | 716 | case 'trashed': |
| 717 | - $message = __('The entry was successfully moved to the trash.', 'gravityview'); |
|
| 717 | + $message = __( 'The entry was successfully moved to the trash.', 'gravityview' ); |
|
| 718 | 718 | break; |
| 719 | 719 | default: |
| 720 | - $message = __('The entry was successfully deleted.', 'gravityview'); |
|
| 720 | + $message = __( 'The entry was successfully deleted.', 'gravityview' ); |
|
| 721 | 721 | break; |
| 722 | 722 | } |
| 723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url ); |
| 732 | 732 | |
| 733 | 733 | // DISPLAY ERROR/SUCCESS MESSAGE |
| 734 | - echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>'; |
|
| 734 | + echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>'; |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $labels = array( |
| 31 | 31 | 'cancel' => __( 'Cancel', 'gravityview' ), |
| 32 | - 'submit' => __( 'Update', 'gravityview') |
|
| 32 | + 'submit' => __( 'Update', 'gravityview' ) |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $update_tabindex = GFCommon::get_tabindex(); |
| 46 | 46 | $cancel_tabindex = GFCommon::get_tabindex(); |
| 47 | 47 | ?> |
| 48 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
| 48 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
| 49 | 49 | |
| 50 | - <a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
| 50 | + <a class="btn btn-sm button button-small gv-button-cancel" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
| 51 | 51 | <?php |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -61,5 +61,5 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | ?> |
| 63 | 63 | <input type="hidden" name="action" value="update" /> |
| 64 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
| 64 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
| 65 | 65 | </div> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
| 20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
| 21 | 21 | |
| 22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
| 23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function initialize() { |
| 37 | 37 | |
| 38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
| 38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
| 39 | 39 | |
| 40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
| 40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
| 41 | 41 | |
| 42 | 42 | // information box |
| 43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | function update_priority() { |
| 52 | 52 | global $wp_meta_boxes; |
| 53 | 53 | |
| 54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
| 55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
| 57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
| 58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
| 60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
| 54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
| 55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
| 57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
| 58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
| 60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | global $post; |
| 70 | 70 | |
| 71 | 71 | // On Comment Edit, for example, $post isn't set. |
| 72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
| 72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
| 154 | 154 | |
| 155 | - foreach( $metaboxes as $m ) { |
|
| 155 | + foreach ( $metaboxes as $m ) { |
|
| 156 | 156 | |
| 157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
| 157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
| 158 | 158 | |
| 159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
| 160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
| 182 | 182 | |
| 183 | - if( !empty( $links ) ) { |
|
| 184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
| 183 | + if ( ! empty( $links ) ) { |
|
| 184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
| 222 | 222 | |
| 223 | - if( empty( $curr_form )) { |
|
| 223 | + if ( empty( $curr_form ) ) { |
|
| 224 | 224 | return NULL; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $form = gravityview_get_form( $curr_form ); |
| 228 | 228 | |
| 229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
| 229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
| 230 | 230 | |
| 231 | - if( isset( $form['id'] ) ) { |
|
| 232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + if ( isset( $form[ 'id' ] ) ) { |
|
| 232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
| 233 | 233 | |
| 234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
| 235 | - $_GET['id'] = $form['id']; |
|
| 235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | $form_script = 'var form = new Form();'; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
| 241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
| 242 | 242 | |
| 243 | 243 | // Restore previous $_GET setting |
| 244 | - $_GET['id'] = $get_id_backup; |
|
| 244 | + $_GET[ 'id' ] = $get_id_backup; |
|
| 245 | 245 | |
| 246 | 246 | return $output; |
| 247 | 247 | } |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | global $post; |
| 298 | 298 | |
| 299 | 299 | // Only show this on GravityView post types. |
| 300 | - if( false === gravityview_is_admin_page() ) { |
|
| 300 | + if ( false === gravityview_is_admin_page() ) { |
|
| 301 | 301 | return; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // If the View hasn't been configured yet, don't show embed shortcode |
| 305 | - if( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
| 305 | + if ( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
| 306 | 306 | return; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) { |
| 46 | 46 | |
| 47 | 47 | // No modifier was set or the raw value was empty |
| 48 | - if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
| 48 | + if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
| 49 | 49 | return $value; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | foreach ( $gv_modifiers as $gv_modifier => $method ) { |
| 62 | 62 | |
| 63 | 63 | // Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure |
| 64 | - preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches ); |
|
| 64 | + preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches ); |
|
| 65 | 65 | |
| 66 | - if( ! empty( $matches ) ) { |
|
| 66 | + if ( ! empty( $matches ) ) { |
|
| 67 | 67 | // The called method is passed the raw value and the full matches array |
| 68 | 68 | $return = self::$method( $raw_value, $matches ); |
| 69 | 69 | break; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private static function modifier_timestamp( $raw_value, $matches ) { |
| 89 | 89 | |
| 90 | - if( empty( $matches[0] ) ) { |
|
| 90 | + if ( empty( $matches[ 0 ] ) ) { |
|
| 91 | 91 | return $raw_value; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | private static function modifier_wpautop( $raw_value, $matches ) { |
| 113 | 113 | |
| 114 | - if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) { |
|
| 114 | + if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) { |
|
| 115 | 115 | return $raw_value; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | private static function modifier_maxwords( $raw_value, $matches ) { |
| 137 | 137 | |
| 138 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 138 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 139 | 139 | return $raw_value; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $max = intval( $matches[1] ); |
|
| 142 | + $max = intval( $matches[ 1 ] ); |
|
| 143 | 143 | |
| 144 | 144 | $more_placeholder = '[GVMORE]'; |
| 145 | 145 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param array $aux_data Additional data to be used to replace merge tags {@see https://www.gravityhelp.com/documentation/article/gform_merge_tag_data/} |
| 176 | 176 | * @return string Text with variables maybe replaced |
| 177 | 177 | */ |
| 178 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true, $nl2br = true, $format = 'html', $aux_data = array() ) { |
|
| 178 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true, $nl2br = true, $format = 'html', $aux_data = array() ) { |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | * @internal Fixed $form['title'] in Gravity Forms |
| 201 | 201 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
| 202 | 202 | */ |
| 203 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
| 204 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
| 205 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
| 203 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
| 204 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
| 205 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
| 206 | 206 | |
| 207 | 207 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data ); |
| 208 | 208 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 226 | 226 | |
| 227 | - if( '' === $text ) { |
|
| 227 | + if ( '' === $text ) { |
|
| 228 | 228 | return $text; |
| 229 | 229 | } |
| 230 | 230 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see GFCommon::replace_variables_prepopulate() |
| 235 | 235 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
| 236 | 236 | */ |
| 237 | - if( false === $form ) { |
|
| 237 | + if ( false === $form ) { |
|
| 238 | 238 | return $text; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 269 | 269 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 270 | 270 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
| 271 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 271 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 272 | 272 | ); |
| 273 | 273 | |
| 274 | 274 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | return $original_text; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - foreach ( (array) $matches as $match ) { |
|
| 349 | - $full_tag = $match[0]; |
|
| 348 | + foreach ( (array)$matches as $match ) { |
|
| 349 | + $full_tag = $match[ 0 ]; |
|
| 350 | 350 | $modifier = rgar( $match, 2, 'permalink' ); |
| 351 | 351 | |
| 352 | 352 | $replacement = false; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $replacement = esc_html( $replacement ); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if( $url_encode ) { |
|
| 367 | + if ( $url_encode ) { |
|
| 368 | 368 | $replacement = urlencode( $replacement ); |
| 369 | 369 | } |
| 370 | 370 | |
@@ -404,14 +404,14 @@ discard block |
||
| 404 | 404 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
| 405 | 405 | |
| 406 | 406 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
| 407 | - if( empty( $matches ) ) { |
|
| 407 | + if ( empty( $matches ) ) { |
|
| 408 | 408 | return $text; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | foreach ( $matches as $match ) { |
| 412 | 412 | |
| 413 | - $full_tag = $match[0]; |
|
| 414 | - $property = $match[1]; |
|
| 413 | + $full_tag = $match[ 0 ]; |
|
| 414 | + $property = $match[ 1 ]; |
|
| 415 | 415 | |
| 416 | 416 | $value = stripslashes_deep( rgget( $property ) ); |
| 417 | 417 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * @since 1.15 |
| 436 | 436 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
| 437 | 437 | */ |
| 438 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 438 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 439 | 439 | |
| 440 | 440 | $value = $esc_html ? esc_html( $value ) : $value; |
| 441 | 441 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param[in] array $form Gravity Forms form array |
| 447 | 447 | * @param[in] array $entry Entry array |
| 448 | 448 | */ |
| 449 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 449 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 450 | 450 | |
| 451 | 451 | $text = str_replace( $full_tag, $value, $text ); |
| 452 | 452 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | parent::add_hooks(); |
| 69 | 69 | |
| 70 | - if( gravityview_is_admin_page() ) { |
|
| 70 | + if ( gravityview_is_admin_page() ) { |
|
| 71 | 71 | |
| 72 | 72 | // Make Yoast metabox go down to the bottom please. |
| 73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function disable_content_analysis( $options ) { |
| 94 | 94 | |
| 95 | - $options['keyword_analysis_active'] = false; |
|
| 96 | - $options['content_analysis_active'] = false; |
|
| 95 | + $options[ 'keyword_analysis_active' ] = false; |
|
| 96 | + $options[ 'content_analysis_active' ] = false; |
|
| 97 | 97 | |
| 98 | 98 | return $options; |
| 99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | global $pagenow; |
| 113 | 113 | |
| 114 | 114 | // New View page |
| 115 | - if( $pagenow === 'post-new.php' ) { |
|
| 116 | - $options['hideeditbox-gravityview'] = true; |
|
| 115 | + if ( $pagenow === 'post-new.php' ) { |
|
| 116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $options; |