Changeset 13904 for trunk/src/bp-core/bp-core-catchuri.php
- Timestamp:
- 06/04/2024 02:32:30 AM (21 months ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-catchuri.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-catchuri.php
r13767 r13904 46 46 * @since 1.6.0 47 47 * 48 * @return bool True if yes, false if no.48 * @return bool 49 49 */ 50 50 function bp_core_enable_root_profiles() { … … 52 52 $retval = false; 53 53 54 if ( defined( 'BP_ENABLE_ROOT_PROFILES' ) && ( true == BP_ENABLE_ROOT_PROFILES ) )54 if ( defined( 'BP_ENABLE_ROOT_PROFILES' ) && ( true === BP_ENABLE_ROOT_PROFILES ) ) { 55 55 $retval = true; 56 } 56 57 57 58 /** … … 82 83 83 84 // Reset the post. 84 bp_theme_compat_reset_post( array( 85 'ID' => 0, 86 'is_404' => true, 87 'post_status' => 'publish', 88 ) ); 85 bp_theme_compat_reset_post( 86 array( 87 'ID' => 0, 88 'is_404' => true, 89 'post_status' => 'publish', 90 ) 91 ); 89 92 90 93 // Set theme compat to false since the reset post function automatically sets … … 118 121 } 119 122 120 // Theme compat doesn't require a template lookup.123 // Theme compat doesn't require a template lookup. 121 124 } else { 122 125 $template = ''; … … 185 188 exit(); 186 189 187 // No template found, so setup theme compatibility.188 // @todo Some other 404 handling if theme compat doesn't kick in.190 // No template found, so setup theme compatibility. 191 // @todo Some other 404 handling if theme compat doesn't kick in. 189 192 } else { 190 193 … … 291 294 // If coming from bp_core_redirect() and $bp_no_status_set is true, 292 295 // we are redirecting to an accessible page so skip this check. 293 if ( ! empty( $bp->no_status_set ) )296 if ( ! empty( $bp->no_status_set ) ) { 294 297 return false; 295 296 if ( !isset( $wp_query->queried_object ) && !bp_is_blog_page() ) { 298 } 299 300 if ( ! isset( $wp_query->queried_object ) && ! bp_is_blog_page() ) { 297 301 bp_do_404(); 298 302 } … … 310 314 * 311 315 * @param array|string $args { 316 * Optional. Array of arguments for redirecting user when visiting access controlled areas. 312 317 * @type int $mode Specifies the destination of the redirect. 1 will 313 318 * direct to the root domain (home page), which assumes you have a … … 332 337 'redirect' => $redirect_url, // the URL you get redirected to when a user successfully logs in. 333 338 'root' => bp_get_root_url(), // the landing page you get redirected to when a user doesn't have access. 334 'message' => __( 'You must log in to access the page you requested.', 'buddypress' ) 339 'message' => __( 'You must log in to access the page you requested.', 'buddypress' ), 335 340 ); 336 341 … … 348 353 */ 349 354 $r = apply_filters( 'bp_core_no_access', $r ); 355 350 356 extract( $r, EXTR_SKIP ); 351 357 … … 353 359 * @ignore Ignore these filters and use 'bp_core_no_access' above. 354 360 */ 355 $mode = apply_filters( 'bp_no_access_mode', $mode, $root,$redirect, $message );356 $redirect = apply_filters( 'bp_no_access_redirect', $redirect, $root, $message, $mode);357 $root = apply_filters( 'bp_no_access_root', $root, $redirect, $message, $mode);358 $message = apply_filters( 'bp_no_access_message', $message, $root, $redirect, $mode);361 $mode = apply_filters( 'bp_no_access_mode', $mode, $root, $redirect, $message ); 362 $redirect = apply_filters( 'bp_no_access_redirect', $redirect, $root, $message, $mode ); 363 $root = apply_filters( 'bp_no_access_root', $root, $redirect, $message, $mode ); 364 $message = apply_filters( 'bp_no_access_message', $message, $root, $redirect, $mode ); 359 365 $root = trailingslashit( $root ); 360 366 … … 363 369 // Option to redirect to wp-login.php. 364 370 // Error message is displayed with bp_core_no_access_wp_login_error(). 365 case 2 : 366 if ( !empty( $redirect ) ) { 367 bp_core_redirect( add_query_arg( array( 368 'bp-auth' => 1, 369 'action' => 'bpnoaccess' 370 ), wp_login_url( $redirect ) ) ); 371 case 2: 372 if ( ! empty( $redirect ) ) { 373 bp_core_redirect( 374 add_query_arg( 375 array( 376 'bp-auth' => 1, 377 'action' => 'bpnoaccess', 378 ), 379 wp_login_url( $redirect ) 380 ) 381 ); 371 382 } else { 372 383 bp_core_redirect( $root ); … … 377 388 // Redirect to root with "redirect_to" parameter. 378 389 // Error message is displayed with bp_core_add_message(). 379 case 1 : 380 default : 381 390 case 1: 391 default: 382 392 $url = $root; 383 if ( ! empty( $redirect ) ) {393 if ( ! empty( $redirect ) ) { 384 394 $url = add_query_arg( 'redirect_to', urlencode( $redirect ), $root ); 385 395 } 386 396 387 if ( ! empty( $message ) ) {397 if ( ! empty( $message ) ) { 388 398 bp_core_add_message( $message, 'error' ); 389 399 } … … 502 512 503 513 // Build the URL in the address bar. 504 $requested_url = bp_get_requested_url();505 $query_args = '';514 $requested_url = bp_get_requested_url(); 515 $query_args = ''; 506 516 507 517 // Stash query args. … … 582 592 // is set to be the front page, ensure that the current canonical URL 583 593 // is the home page URL. 584 if ( 'page' == get_option( 'show_on_front' ) && $page_on_front = (int) get_option( 'page_on_front' ) ) {585 $front_page_component = array_search( $page_on_front, bp_core_get_directory_page_ids() );594 if ( 'page' === get_option( 'show_on_front' ) && $page_on_front = (int) get_option( 'page_on_front' ) ) { 595 $front_page_component = array_search( $page_on_front, bp_core_get_directory_page_ids(), true ); 586 596 587 597 /* … … 595 605 $bp->canonical_stack['canonical_url'] = trailingslashit( bp_get_root_url() ); 596 606 597 // Except when the front page is set to the registration page598 // and the current user is logged in. In this case we send to599 // the members directory to avoid redirect loops.600 } elseif ( bp_is_register_page() && 'register' == $front_page_component && is_user_logged_in() ) {607 // Except when the front page is set to the registration page 608 // and the current user is logged in. In this case we send to 609 // the members directory to avoid redirect loops. 610 } elseif ( bp_is_register_page() && 'register' === $front_page_component && is_user_logged_in() ) { 601 611 602 612 /** … … 613 623 if ( empty( $bp->canonical_stack['canonical_url'] ) ) { 614 624 // Build the URL in the address bar. 615 $requested_url = bp_get_requested_url();616 $base_url = '';617 $path_chunks = array();618 $component_id = '';625 $requested_url = bp_get_requested_url(); 626 $base_url = ''; 627 $path_chunks = array(); 628 $component_id = ''; 619 629 620 630 // Get query args. … … 678 688 } elseif ( isset( $query_args['bp_member_action'] ) && 'members' === $component_id ) { 679 689 unset( $query_args['bp_member_action'] ); 680 } elseif ( isset( $query_args['bp_group_action'] ) && 'groups' === $component_id ) {690 } elseif ( isset( $query_args['bp_group_action'] ) && 'groups' === $component_id ) { 681 691 unset( $query_args['bp_group_action'] ); 682 692 } … … 750 760 */ 751 761 function _bp_maybe_remove_redirect_canonical() { 752 if ( ! bp_is_blog_page() ) 762 if ( ! bp_is_blog_page() ) { 753 763 remove_action( 'template_redirect', 'redirect_canonical' ); 764 } 754 765 } 755 766
Note: See TracChangeset
for help on using the changeset viewer.