Changeset 13904
- Timestamp:
- 06/04/2024 02:32:30 AM (3 months ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-buddybar.php
r13878 r13904 72 72 // Then, hook the screen function for the added nav item. 73 73 $hooked = bp_core_register_nav_screen_function( $nav_item ); 74 if ( false === $hooked ) {74 if ( false === $hooked ) { 75 75 return false; 76 76 } … … 129 129 'position' => 99, // Index of where this nav item should be positioned. 130 130 'screen_function' => false, // The name of the function to run when clicked. 131 'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.131 'default_subnav_slug' => false, // The slug of the default subnav item to select when clicked. 132 132 ); 133 133 … … 163 163 'position' => $r['position'], 164 164 'screen_function' => &$r['screen_function'], 165 'default_subnav_slug' => $r['default_subnav_slug']165 'default_subnav_slug' => $r['default_subnav_slug'], 166 166 ); 167 167 … … 218 218 'position' => 99, // Index of where this nav item should be positioned. 219 219 'screen_function' => false, // The name of the function to run when clicked. 220 'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.220 'default_subnav_slug' => false, // The slug of the default subnav item to select when clicked. 221 221 ); 222 222 … … 253 253 * directory or something else. 254 254 */ 255 if ( ( -1 != $r['position'] ) && bp_is_root_component( $r['slug'] ) && ! bp_displayed_user_id() ) {255 if ( ( -1 !== $r['position'] ) && bp_is_root_component( $r['slug'] ) && ! bp_displayed_user_id() ) { 256 256 return; 257 257 } … … 307 307 * 308 308 * @param array|string $args { 309 * Optional. Array describing the new default subnav item. 310 * 309 311 * @type string $parent_slug The slug of the nav item whose default is being changed. 310 312 * @type callable $screen_function The new default callback function that will run when the nav item is clicked. … … 318 320 'parent_slug' => false, // Slug of the parent. 319 321 'screen_function' => false, // The name of the function to run when clicked. 320 'subnav_slug' => false // The slug of the subnav item to select when clicked.322 'subnav_slug' => false, // The slug of the subnav item to select when clicked. 321 323 ); 322 324 … … 330 332 331 333 if ( ! $parent_nav ) { 332 return 334 return; 333 335 } 334 336 … … 381 383 // The only way to tell whether to set the subnav is to peek at the unfiltered_uri 382 384 // Find the component. 383 $component_uri_key = array_search( $parent_nav->slug, $bp->unfiltered_uri );385 $component_uri_key = array_search( $parent_nav->slug, $bp->unfiltered_uri, true ); 384 386 385 387 if ( false !== $component_uri_key ) { 386 if ( ! empty( $bp->unfiltered_uri[ $component_uri_key + 1] ) ) {387 $unfiltered_action = $bp->unfiltered_uri[ $component_uri_key + 1];388 if ( ! empty( $bp->unfiltered_uri[ $component_uri_key + 1 ] ) ) { 389 $unfiltered_action = $bp->unfiltered_uri[ $component_uri_key + 1 ]; 388 390 } 389 391 } … … 415 417 } 416 418 417 // The URL is explicitly requesting the new subnav item, but should be418 // directed to the canonical URL.419 } elseif ( $unfiltered_action == $r['subnav_slug'] ) {419 // The URL is explicitly requesting the new subnav item, but should be 420 // directed to the canonical URL. 421 } elseif ( $unfiltered_action === $r['subnav_slug'] ) { 420 422 unset( $bp->canonical_stack['action'] ); 421 423 422 // In all other cases (including the case where the original subnav item423 // is explicitly called in the URL), the canonical URL will contain the424 // subnav slug.424 // In all other cases (including the case where the original subnav item 425 // is explicitly called in the URL), the canonical URL will contain the 426 // subnav slug. 425 427 } else { 426 428 $bp->canonical_stack['action'] = bp_current_action(); 427 429 } 428 430 } 429 430 return;431 431 } 432 432 … … 459 459 * Admin Bar menu for group admins. Default: false. 460 460 * } 461 * @param string|null 461 * @param string|null $component The component the navigation is attached to. Defaults to 'members'. 462 462 * @return null|false Returns false on failure. 463 463 */ … … 637 637 $args, 638 638 array( 639 'slug' 640 'parent_slug' 641 'user_has_access' 642 'no_access_url' 643 'site_admin_only' 644 'screen_function' 639 'slug' => false, // URL slug for the screen. 640 'parent_slug' => false, // URL slug of the parent screen. 641 'user_has_access' => true, // Can the user visit this screen? 642 'no_access_url' => '', 643 'site_admin_only' => false, // Can only site admins visit this screen? 644 'screen_function' => false, // The name of the function to run when clicked. 645 645 ) 646 646 ); … … 674 674 675 675 // If we *do* meet condition (2), then the added subnav item is currently being requested. 676 if ( ( bp_current_action() && bp_is_current_action( $r['slug'] ) ) || ( bp_is_user() && ! bp_current_action() && ! empty( $parent_nav->screen_function ) && $r['screen_function'] == $parent_nav->screen_function ) ) {676 if ( ( bp_current_action() && bp_is_current_action( $r['slug'] ) ) || ( bp_is_user() && ! bp_current_action() && ! empty( $parent_nav->screen_function ) && $r['screen_function'] === $parent_nav->screen_function ) ) { 677 677 678 678 // If this is for site admins only and the user is not one, don't create the subnav item. … … 719 719 $retval['status'] = 'failure'; 720 720 721 // Success - hook to bp_screens.721 // Success - hook to bp_screens. 722 722 } else { 723 723 add_action( 'bp_screens', $subnav_item['screen_function'], 3 ); … … 725 725 } 726 726 727 // User doesn't have access. Determine redirect arguments based on728 // user status.727 // User doesn't have access. Determine redirect arguments based on 728 // user status. 729 729 } else { 730 730 $retval['status'] = 'failure'; … … 739 739 $redirect_to = trailingslashit( $subnav_item['no_access_url'] ); 740 740 741 // In the case of a user page, we try to assume a742 // redirect URL.741 // In the case of a user page, we try to assume a 742 // redirect URL. 743 743 } elseif ( bp_is_user() ) { 744 744 … … 755 755 $redirect_to = bp_displayed_user_url(); 756 756 757 // In some cases, the default tab is not accessible to758 // the logged-in user. So we fall back on a tab that we759 // know will be accessible.757 // In some cases, the default tab is not accessible to 758 // the logged-in user. So we fall back on a tab that we 759 // know will be accessible. 760 760 } else { 761 761 // Try 'activity' first. … … 771 771 } 772 772 773 // Fall back to the home page.773 // Fall back to the home page. 774 774 } else { 775 775 $message = __( 'You do not have access to this page.', 'buddypress' ); … … 781 781 'root' => $redirect_to, 782 782 'redirect' => false, 783 'mode' => 1 783 'mode' => 1, 784 784 ); 785 785 … … 987 987 function bp_get_admin_bar_pref( $context, $user = 0 ) { 988 988 $pref = get_user_option( "show_admin_bar_{$context}", $user ); 989 if ( false === $pref ) 989 if ( false === $pref ) { 990 990 return true; 991 } 991 992 992 993 return 'true' === $pref; -
trunk/src/bp-core/bp-core-cache.php
r13890 r13904 65 65 delete_transient( 'bp_active_member_count' ); 66 66 } 67 add_action( 'bp_core_activated_user', 67 add_action( 'bp_core_activated_user', 'bp_core_clear_member_count_caches' ); 68 68 add_action( 'bp_core_process_spammer_status', 'bp_core_clear_member_count_caches' ); 69 add_action( 'bp_core_deleted_account', 70 add_action( 'bp_first_activity_for_member', 71 add_action( 'deleted_user', 69 add_action( 'bp_core_deleted_account', 'bp_core_clear_member_count_caches' ); 70 add_action( 'bp_first_activity_for_member', 'bp_core_clear_member_count_caches' ); 71 add_action( 'deleted_user', 'bp_core_clear_member_count_caches' ); 72 72 73 73 /** … … 93 93 94 94 // Bail if post ID is not a directory page. 95 if ( ! in_array( $post_id, $page_ids ) ) {95 if ( ! in_array( $post_id, $page_ids, true ) ) { 96 96 return; 97 97 } … … 134 134 } 135 135 136 $keys = array_merge( $keys, array( 137 'registration', 138 'avatar_default', 139 'tags_blog_id', 140 'sitewide_tags_blog', 141 'registration', 142 'fileupload_mask', 143 ) ); 144 145 if ( in_array( $option, $keys ) ) { 136 $keys = array_merge( 137 $keys, 138 array( 139 'registration', 140 'avatar_default', 141 'tags_blog_id', 142 'sitewide_tags_blog', 143 'registration', 144 'fileupload_mask', 145 ) 146 ); 147 148 if ( in_array( $option, $keys, true ) ) { 146 149 wp_cache_delete( 'root_blog_options', 'bp' ); 147 150 } … … 207 210 $args, 208 211 array( 209 'object_ids' 210 'object_type' 212 'object_ids' => array(), // Comma-separated list or array of item ids. 213 'object_type' => '', // Canonical component id: groups, members, etc. 211 214 'cache_group' => '', // Cache group. 212 'meta_table' 215 'meta_table' => '', // Name of the table containing the metadata. 213 216 'object_column' => '', // DB column for the object ids (group_id, etc). 214 217 'cache_key_prefix' => '', // Prefix to use when creating cache key names. Eg 'bp_groups_groupmeta'. … … 246 249 if ( ! empty( $meta_list ) ) { 247 250 foreach ( $meta_list as $metarow ) { 248 $mpid = intval( $metarow[ $object_column] );251 $mpid = intval( $metarow[ $object_column ] ); 249 252 $mkey = $metarow['meta_key']; 250 253 $mval = $metarow['meta_value']; 251 254 252 255 // Force subkeys to be array type. 253 if ( !isset( $cache[$mpid] ) || !is_array( $cache[$mpid] ) ) 254 $cache[$mpid] = array(); 255 if ( !isset( $cache[$mpid][$mkey] ) || !is_array( $cache[$mpid][$mkey] ) ) 256 $cache[$mpid][$mkey] = array(); 256 if ( ! isset( $cache[ $mpid ] ) || ! is_array( $cache[ $mpid ] ) ) { 257 $cache[ $mpid ] = array(); 258 } 259 if ( ! isset( $cache[ $mpid ][ $mkey ] ) || ! is_array( $cache[ $mpid ][ $mkey ] ) ) { 260 $cache[ $mpid ][ $mkey ] = array(); 261 } 257 262 258 263 // Add a value to the current pid/key. 259 $cache[ $mpid][$mkey][] = $mval;264 $cache[ $mpid ][ $mkey ][] = $mval; 260 265 } 261 266 } … … 345 350 function bp_core_get_incremented_cache_key( $key, $group ) { 346 351 $incrementor = bp_core_get_incrementor( $group ); 347 $cache_key = md5( $key . $incrementor );352 $cache_key = md5( $key . $incrementor ); 348 353 return $cache_key; 349 354 } … … 414 419 * @since 7.0.0 415 420 * 416 * @param int $type_id The Type's term ID.421 * @param int $type_id The Type's term ID. 417 422 * @param string $taxonomy The Type's taxonomy name. 418 423 */ -
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 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 616 $base_url 617 $path_chunks 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 -
trunk/src/bp-core/bp-core-dependency.php
r13741 r13904 796 796 * @param string $action The action being run. 797 797 */ 798 do_action( 'bp_post_request', 798 do_action( 'bp_post_request', $action ); 799 799 } 800 800 … … 838 838 * @param string $action The action being run. 839 839 */ 840 do_action( 'bp_get_request', 841 } 840 do_action( 'bp_get_request', $action ); 841 } -
trunk/src/bp-core/bp-core-filters.php
r13878 r13904 41 41 * v--WordPress Actions v--BuddyPress Sub-actions 42 42 */ 43 add_filter( 'request', 'bp_request', 10);44 add_filter( 'template_include', 'bp_template_include', 10);45 add_filter( 'login_redirect', 'bp_login_redirect',10, 3 );46 add_filter( 'map_meta_cap', 'bp_map_meta_caps',10, 4 );43 add_filter( 'request', 'bp_request', 10 ); 44 add_filter( 'template_include', 'bp_template_include', 10 ); 45 add_filter( 'login_redirect', 'bp_login_redirect', 10, 3 ); 46 add_filter( 'map_meta_cap', 'bp_map_meta_caps', 10, 4 ); 47 47 48 48 // Add some filters to feedback messages. 49 add_filter( 'bp_core_render_message_content', 'wptexturize' 50 add_filter( 'bp_core_render_message_content', 'convert_smilies' 51 add_filter( 'bp_core_render_message_content', 'convert_chars' 52 add_filter( 'bp_core_render_message_content', 'wpautop' 49 add_filter( 'bp_core_render_message_content', 'wptexturize' ); 50 add_filter( 'bp_core_render_message_content', 'convert_smilies' ); 51 add_filter( 'bp_core_render_message_content', 'convert_chars' ); 52 add_filter( 'bp_core_render_message_content', 'wpautop' ); 53 53 add_filter( 'bp_core_render_message_content', 'shortcode_unautop' ); 54 add_filter( 'bp_core_render_message_content', 'wp_kses_data', 5 54 add_filter( 'bp_core_render_message_content', 'wp_kses_data', 5 ); 55 55 56 56 // Emails. … … 70 70 * bp_template_include() works and do something similar. :) 71 71 */ 72 add_filter( 'bp_template_include', 73 add_filter( 'bp_template_include', 'bp_template_include_theme_compat',4, 2 );72 add_filter( 'bp_template_include', 'bp_template_include_theme_supports', 2, 1 ); 73 add_filter( 'bp_template_include', 'bp_template_include_theme_compat', 4, 2 ); 74 74 75 75 // Filter BuddyPress template locations. … … 132 132 133 133 // Bail if not the root blog. 134 if ( ! bp_is_root_blog() ) 134 if ( ! bp_is_root_blog() ) { 135 135 return $pages; 136 } 136 137 137 138 $bp = buddypress(); 138 139 139 if ( ! empty( $bp->pages->activate ) )140 if ( ! empty( $bp->pages->activate ) ) { 140 141 $pages[] = $bp->pages->activate->id; 141 142 if ( !empty( $bp->pages->register ) ) 142 } 143 144 if ( ! empty( $bp->pages->register ) ) { 143 145 $pages[] = $bp->pages->register->id; 146 } 144 147 145 148 /** … … 169 172 } 170 173 171 if ( 'page' != $object->name ) {174 if ( 'page' !== $object->name ) { 172 175 return $object; 173 176 } 174 177 175 $bp = buddypress();178 $bp = buddypress(); 176 179 $pages = array(); 177 180 … … 270 273 271 274 // Get the WP page. 272 $page 275 $page = get_post( $item->object_id ); 273 276 274 277 // See if we should add our highlight CSS classes for the page. … … 285 288 * 286 289 * @param array $comments The array of comments supplied to the comments template. 287 * @param int $post_id The post ID.288 290 * @return array $comments The modified comment array. 289 291 */ 290 function bp_core_filter_comments( $comments , $post_id) {292 function bp_core_filter_comments( $comments ) { 291 293 global $wpdb; 292 294 … … 303 305 $user_ids = implode( ',', wp_parse_id_list( $user_ids ) ); 304 306 305 if ( ! $userdata = $wpdb->get_results( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) ) { 307 $userdata = $wpdb->get_results( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ); 308 if ( ! $userdata ) { 306 309 return $comments; 307 310 } 308 311 309 312 foreach ( (array) $userdata as $user ) { 310 $users[ $user->user_id] = bp_members_get_user_url( $user->user_id );313 $users[ $user->user_id ] = bp_members_get_user_url( $user->user_id ); 311 314 } 312 315 313 316 foreach ( (array) $comments as $i => $comment ) { 314 317 if ( ! empty( $comment->user_id ) ) { 315 if ( ! empty( $users[ $comment->user_id] ) ) {316 $comments[ $i]->comment_author_url = $users[$comment->user_id];318 if ( ! empty( $users[ $comment->user_id ] ) ) { 319 $comments[ $i ]->comment_author_url = $users[ $comment->user_id ]; 317 320 } 318 321 } … … 321 324 return $comments; 322 325 } 323 add_filter( 'comments_array', 'bp_core_filter_comments' , 10, 2);326 add_filter( 'comments_array', 'bp_core_filter_comments' ); 324 327 325 328 /** … … 339 342 340 343 // Only modify the redirect if we're on the main BP blog. 341 if ( ! bp_is_root_blog() ) {344 if ( ! bp_is_root_blog() ) { 342 345 return $redirect_to; 343 346 } 344 347 345 348 // Only modify the redirect once the user is logged in. 346 if ( ! is_a( $user, 'WP_User' ) ) {349 if ( ! is_a( $user, 'WP_User' ) ) { 347 350 return $redirect_to; 348 351 } … … 369 372 // logged-in user has any business to conduct in the Dashboard before allowing the 370 373 // redirect to go through. 371 if ( ! empty( $redirect_to ) && ( false === strpos( $redirect_to, 'wp-admin' ) || user_can( $user, 'edit_posts' ) ) ) {374 if ( ! empty( $redirect_to ) && ( false === strpos( $redirect_to, 'wp-admin' ) || user_can( $user, 'edit_posts' ) ) ) { 372 375 return $redirect_to; 373 376 } … … 400 403 function bp_email_plaintext_entity_decode( $retval, $prop, $transform ) { 401 404 switch ( $prop ) { 402 case 'content_plaintext' 403 case 'subject' 405 case 'content_plaintext': 406 case 'subject': 404 407 // Only decode if 'replace-tokens' is the current type. 405 408 if ( 'replace-tokens' === $transform ) { … … 408 411 return $retval; 409 412 } 410 break; 411 412 default : 413 default: 413 414 return $retval; 414 break;415 415 } 416 416 } … … 435 435 436 436 // Don't touch the email when a user is registered by the site admin. 437 if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {437 if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page !== get_current_screen()->id ) { 438 438 return $welcome_email; 439 439 } … … 473 473 474 474 // Don't touch the email when a user is registered by the site admin. 475 if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {475 if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page !== get_current_screen()->id ) { 476 476 return $welcome_email; 477 477 } 478 478 479 479 // Don't touch the email if we don't have a custom registration template. 480 if ( ! bp_has_custom_signup_page() ) 480 if ( ! bp_has_custom_signup_page() ) { 481 481 return $welcome_email; 482 } 482 483 483 484 // [User Set] Replaces $password in welcome email; Represents value set by user. … … 506 507 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) { 507 508 $is_signup_resend = false; 508 if ( is_admin() && buddypress()->members->admin->signups_page == get_current_screen()->id ) {509 if ( is_admin() && buddypress()->members->admin->signups_page === get_current_screen()->id ) { 509 510 // The admin is just approving/sending/resending the verification email. 510 511 $is_signup_resend = true; … … 571 572 572 573 // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications. 573 if ( in_array( get_current_screen()->id, array( 'user', 'user-network' )) ) {574 if ( in_array( get_current_screen()->id, array( 'user', 'user-network' ), true ) ) { 574 575 // If the Super Admin want to skip confirmation email. 575 if ( isset( $_POST[ 'noconfirmation'] ) && is_super_admin() ) {576 if ( isset( $_POST['noconfirmation'] ) && is_super_admin() ) { 576 577 return false; 577 578 578 // WordPress will manage the signup process.579 // WordPress will manage the signup process. 579 580 } else { 580 581 return $user; 581 582 } 582 583 583 // The site admin is approving/resending from the "manage signups" screen.584 } elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {584 // The site admin is approving/resending from the "manage signups" screen. 585 } elseif ( buddypress()->members->admin->signups_page === get_current_screen()->id ) { 585 586 /* 586 587 * There can be a case where the user was created without the skip confirmation … … 599 600 } 600 601 601 $user_id = 0;602 $user_id = 0; 602 603 $user_object = get_user_by( 'login', $user ); 603 604 if ( $user_object ) { … … 732 733 return apply_filters( 'bp_modify_page_title', $new_title, $title, $sep, $seplocation ); 733 734 } 734 add_filter( 'wp_title', 735 add_filter( 'bp_modify_page_title', 'wptexturize' 736 add_filter( 'bp_modify_page_title', 'convert_chars' 737 add_filter( 'bp_modify_page_title', 'esc_html' 735 add_filter( 'wp_title', 'bp_modify_page_title', 20, 3 ); 736 add_filter( 'bp_modify_page_title', 'wptexturize' ); 737 add_filter( 'bp_modify_page_title', 'convert_chars' ); 738 add_filter( 'bp_modify_page_title', 'esc_html' ); 738 739 739 740 /** … … 760 761 // We don't need to sanitize this as WordPress will take care of it. 761 762 $bp_title = array( 762 'title' => join( " $sep ", $bp_title_parts ) 763 'title' => join( " $sep ", $bp_title_parts ), 763 764 ); 764 765 … … 799 800 $menu_item->url = $menu_item->guid; 800 801 801 if ( ! in_array( array( 'bp-menu', 'bp-' . $menu_item->post_excerpt .'-nav' ), $menu_item->classes ) ) {802 if ( ! in_array( array( 'bp-menu', 'bp-' . $menu_item->post_excerpt . '-nav' ), $menu_item->classes ) ) { 802 803 $menu_item->classes[] = 'bp-menu'; 803 $menu_item->classes[] = 'bp-' . $menu_item->post_excerpt .'-nav';804 $menu_item->classes[] = 'bp-' . $menu_item->post_excerpt . '-nav'; 804 805 } 805 806 } … … 812 813 813 814 if ( is_array( $menu_classes ) ) { 814 $menu_classes = implode( ' ', $menu_item->classes );815 $menu_classes = implode( ' ', $menu_item->classes ); 815 816 } 816 817 … … 825 826 826 827 switch ( $matches[1] ) { 827 case 'login' 828 case 'login': 828 829 if ( is_user_logged_in() ) { 829 830 $menu_item->_invalid = true; … … 834 835 break; 835 836 836 case 'logout' 837 case 'logout': 837 838 if ( ! is_user_logged_in() ) { 838 839 $menu_item->_invalid = true; … … 844 845 845 846 // Don't show the Register link to logged-in users. 846 case 'register' 847 case 'register': 847 848 if ( is_user_logged_in() ) { 848 849 $menu_item->_invalid = true; … … 867 868 $menu_item->_invalid = true; 868 869 869 // Highlight the current page.870 // Highlight the current page. 870 871 } else { 871 872 $current = bp_get_requested_url(); … … 930 931 */ 931 932 function bp_customizer_nav_menus_set_item_types( $item_types = array() ) { 932 $item_types = array_merge( $item_types, array( 933 'bp_loggedin_nav' => array( 934 'title' => _x( 'BuddyPress (logged-in)', 'customizer menu section title', 'buddypress' ), 935 'type' => 'bp_nav', 936 'object' => 'bp_loggedin_nav', 937 ), 938 'bp_loggedout_nav' => array( 939 'title' => _x( 'BuddyPress (logged-out)', 'customizer menu section title', 'buddypress' ), 940 'type' => 'bp_nav', 941 'object' => 'bp_loggedout_nav', 942 ), 943 ) ); 933 $item_types = array_merge( 934 $item_types, 935 array( 936 'bp_loggedin_nav' => array( 937 'title' => _x( 'BuddyPress (logged-in)', 'customizer menu section title', 'buddypress' ), 938 'type' => 'bp_nav', 939 'object' => 'bp_loggedin_nav', 940 ), 941 'bp_loggedout_nav' => array( 942 'title' => _x( 'BuddyPress (logged-out)', 'customizer menu section title', 'buddypress' ), 943 'type' => 'bp_nav', 944 'object' => 'bp_loggedout_nav', 945 ), 946 ) 947 ); 944 948 945 949 return $item_types; … … 1053 1057 for ( $i = 0; $i < count( $quoted_matches[0] ); $i++ ) { 1054 1058 $quote_pos = strpos( $q, '__QUOTE__' ); 1055 $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 );1059 $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 ); 1056 1060 } 1057 1061 } … … 1083 1087 * @since 7.0.0 1084 1088 * 1085 * @ string $content Content to inject attribute into.1089 * @param string $content Content to inject attribute into. 1086 1090 * @return string 1087 1091 */ … … 1091 1095 } 1092 1096 1093 $content = str_replace( '<img ', '<img loading="lazy" ',$content );1097 $content = str_replace( '<img ', '<img loading="lazy" ', $content ); 1094 1098 $content = str_replace( '<iframe ', '<iframe loading="lazy" ', $content ); 1095 1099 … … 1149 1153 preg_match_all( '#<a[^>]+>#i', $value, $links, PREG_SET_ORDER ); 1150 1154 foreach ( $links as $link ) { 1151 $new_link = $link = array_shift( $link ); 1155 $link = array_shift( $link ); 1156 $new_link = $link; 1152 1157 1153 1158 // Add/modify style property. … … 1232 1237 1233 1238 // Default values for tokens set conditionally below. 1234 $tokens['email.preheader'] 1235 $tokens['recipient.email'] 1236 $tokens['recipient.name'] 1237 $tokens['recipient.username'] 1239 $tokens['email.preheader'] = ''; 1240 $tokens['recipient.email'] = ''; 1241 $tokens['recipient.name'] = ''; 1242 $tokens['recipient.username'] = ''; 1238 1243 1239 1244 // Who is the email going to? … … 1305 1310 * @param string $template Path to current template (probably single.php). 1306 1311 */ 1307 $email_template = apply_filters( 'bp_core_render_email_template', 1312 $email_template = apply_filters( 1313 'bp_core_render_email_template', 1308 1314 bp_locate_template( bp_email_get_template( get_queried_object() ), false ), 1309 1315 $template … … 1315 1321 1316 1322 ob_start(); 1317 include ( $email_template );1323 include $email_template; 1318 1324 $template = ob_get_contents(); 1319 1325 ob_end_clean(); … … 1364 1370 */ 1365 1371 function bp_get_post_type_link( $link = '', $post = null ) { 1366 if ( 1372 if ( 'rewrites' === bp_core_get_query_parser() && 'buddypress' === get_post_type( $post ) ) { 1367 1373 $bp_pages = (array) buddypress()->pages; 1368 1374
Note: See TracChangeset
for help on using the changeset viewer.