Changeset 13436 for trunk/src/bp-blogs/bp-blogs-template.php
- Timestamp:
- 03/15/2023 08:16:46 AM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r13409 r13436 68 68 69 69 /** 70 * Output blog directory permalink. 71 * 72 * @since 1.5.0 73 * 74 */ 75 function bp_blogs_directory_permalink() { 76 echo esc_url( bp_get_blogs_directory_permalink() ); 77 } 78 /** 79 * Return blog directory permalink. 80 * 81 * @since 1.5.0 82 * 83 * 84 * @return string The URL of the Blogs directory. 85 */ 86 function bp_get_blogs_directory_permalink() { 87 88 /** 89 * Filters the blog directory permalink. 90 * 91 * @since 1.5.0 92 * 93 * @param string $value Permalink URL for the blog directory. 94 */ 95 return apply_filters( 'bp_get_blogs_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) ); 96 } 70 * Output Blogs directory's URL. 71 * 72 * @since 12.0.0 73 */ 74 function bp_blogs_directory_url() { 75 echo esc_url( bp_get_blogs_directory_url() ); 76 } 77 78 /** 79 * Returns the Blogs directory's URL. 80 * 81 * @since 12.0.0 82 * 83 * @param array $path_chunks { 84 * An array of arguments. Optional. 85 * 86 * @type int $create_single_item `1` to get the Blogs create link. 87 * } 88 * @return string The URL built for the BP Rewrites URL parser. 89 */ 90 function bp_get_blogs_directory_url( $path_chunks = array() ) { 91 $supported_chunks = array_fill_keys( array( 'create_single_item' ), true ); 92 93 $path_chunks = bp_parse_args( 94 array_intersect_key( $path_chunks, $supported_chunks ), 95 array( 96 'component_id' => 'blogs' 97 ) 98 ); 99 100 $url = bp_rewrites_get_url( $path_chunks ); 101 102 /** 103 * Filters the Blogs directory's URL. 104 * 105 * @since 12.0.0 106 * 107 * @param string $url The Blogs directory's URL. 108 * @param array $path_chunks { 109 * An array of arguments. Optional. 110 * 111 * @type int $create_single_item `1` to get the Blogs create link. 112 * } 113 */ 114 return apply_filters( 'bp_get_blogs_directory_url', $url, $path_chunks ); 115 } 97 116 98 117 /** … … 474 493 global $blogs_template; 475 494 476 if ( empty( $blogs_template->blog->domain ) ) 477 $permalink = bp_get_root_domain() . $blogs_template->blog->path; 478 else { 495 if ( ! empty( $blogs_template->blog->domain ) ) { 496 $permalink = get_site_url( $blogs_template->blog->blog_id ); 497 498 } else { 479 499 $protocol = 'http://'; 480 if ( is_ssl() ) 500 if ( is_ssl() ) { 481 501 $protocol = 'https://'; 502 } 482 503 483 504 $permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path; … … 1349 1370 } 1350 1371 1372 $url = bp_get_blogs_directory_url( 1373 array( 1374 'create_single_item' => 1, 1375 ) 1376 ); 1377 1351 1378 /** 1352 1379 * Filters "Create a Site" links for users viewing their own profiles. … … 1354 1381 * @since 1.0.0 1355 1382 * 1356 * @param string $ valueHTML link for creating a site.1357 */ 1358 echo apply_filters( 'bp_create_blog_link', '<a href="' . trailingslashit( bp_get_blogs_directory_permalink() . 'create' ). '">' . __( 'Create a Site', 'buddypress' ) . '</a>' );1383 * @param string $url HTML link for creating a site. 1384 */ 1385 echo apply_filters( 'bp_create_blog_link', '<a href="' . $url . '">' . __( 'Create a Site', 'buddypress' ) . '</a>' ); 1359 1386 } 1360 1387 … … 1460 1487 } 1461 1488 1489 $url = bp_get_blogs_directory_url( 1490 array( 1491 'create_single_item' => 1, 1492 ) 1493 ); 1494 1462 1495 $button_args = array( 1463 1496 'id' => 'create_blog', … … 1465 1498 'link_text' => __( 'Create a Site', 'buddypress' ), 1466 1499 'link_class' => 'blog-create no-ajax', 1467 'link_href' => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),1500 'link_href' => $url, 1468 1501 'wrapper' => false, 1469 1502 'block_self' => false,
Note: See TracChangeset
for help on using the changeset viewer.