Changeset 13303
- Timestamp:
- 07/22/2022 12:54:40 PM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r13296 r13303 1543 1543 * Output button for visiting a blog in a loop. 1544 1544 * 1545 * @see bp_get_blogs_visit_blog_button () for description of arguments.1546 * 1547 * @param array|string $args See {@link bp_get_blogs_visit_blog_button ()}.1545 * @see bp_get_blogs_visit_blog_button_args() for description of arguments. 1546 * 1547 * @param array|string $args See {@link bp_get_blogs_visit_blog_button_args()}. 1548 1548 */ 1549 1549 function bp_blogs_visit_blog_button( $args = '' ) { 1550 1550 echo bp_get_blogs_visit_blog_button( $args ); 1551 1551 } 1552 /** 1553 * Return button for visiting a blog in a loop. 1552 1553 /** 1554 * Return the arguments of the button for visiting a blog in a loop. 1554 1555 * 1555 1556 * @see BP_Button for a complete description of arguments and return 1556 1557 * value. 1558 * 1559 * @since 11.0.0 1557 1560 * 1558 1561 * @param array|string $args { … … 1567 1570 * @type string $link_class Default: 'blog-button visit'. 1568 1571 * @type string $link_text Default: 'Visit Site'. 1572 * @type string $link_title Default: 'Visit Site'. 1569 1573 * } 1570 * @return string The HTML for the Visit button.1571 */ 1572 function bp_get_blogs_visit_blog_button ( $args = '' ) {1573 $button = bp_parse_args(1574 * @return array Thhe arguments of the button for visiting a blog in a loop. 1575 */ 1576 function bp_get_blogs_visit_blog_button_args( $args = '' ) { 1577 $button_args = bp_parse_args( 1574 1578 $args, 1575 1579 array( … … 1582 1586 'link_class' => 'blog-button visit', 1583 1587 'link_text' => __( 'Visit Site', 'buddypress' ), 1588 'link_title' => __( 'Visit Site', 'buddypress' ), 1584 1589 ) 1585 1590 ); … … 1590 1595 * @since 1.2.10 1591 1596 * 1592 * @param array $button Array of arguments to be used for the button to visit a blog. 1593 */ 1594 return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) ); 1597 * @param array $button_args Array of arguments to be used for the button to visit a blog. 1598 */ 1599 return apply_filters( 'bp_get_blogs_visit_blog_button', $button_args ); 1600 } 1601 1602 /** 1603 * Return button for visiting a blog in a loop. 1604 * 1605 * @see BP_Button for a complete description of arguments and return 1606 * value. 1607 * 1608 * @see bp_get_blogs_visit_blog_button_args() for description of arguments. 1609 * 1610 * @param array|string $args See {@link bp_get_blogs_visit_blog_button_args()}. 1611 * @return string The HTML for the Visit button. 1612 */ 1613 function bp_get_blogs_visit_blog_button( $args = '' ) { 1614 $button_args = bp_get_blogs_visit_blog_button_args( $args ); 1615 1616 if ( ! array_filter( $button_args ) ) { 1617 return ''; 1618 } 1619 1620 return bp_get_button( $button_args ); 1595 1621 } 1596 1622 -
trunk/src/bp-core/deprecated/11.0.php
r13302 r13303 57 57 return array(); 58 58 } 59 60 /** 61 * Catch the arguments for buttons 62 * 63 * @since 3.0.0 64 * @deprecated 11.0.0 65 * 66 * @param array $buttons The arguments of the button that BuddyPress is about to create. 67 * 68 * @return array An empty array to stop the button creation process. 69 */ 70 function bp_nouveau_blogs_catch_button_args( $button = array() ) { 71 _deprecated_function( __FUNCTION__, '11.0.0' ); 72 73 // Globalize the arguments so that we can use it in bp_nouveau_get_blogs_buttons(). 74 bp_nouveau()->blogs->button_args = $button; 75 76 // return an empty array to stop the button creation process 77 return array(); 78 } -
trunk/src/bp-templates/bp-nouveau/includes/blogs/functions.php
r12908 r13303 117 117 118 118 /** 119 * Catch the arguments for buttons120 *121 * @since 3.0.0122 *123 * @param array $buttons The arguments of the button that BuddyPress is about to create.124 *125 * @return array An empty array to stop the button creation process.126 */127 function bp_nouveau_blogs_catch_button_args( $button = array() ) {128 // Globalize the arguments so that we can use it in bp_nouveau_get_blogs_buttons().129 bp_nouveau()->blogs->button_args = $button;130 131 // return an empty array to stop the button creation process132 return array();133 }134 135 /**136 119 * Add settings to the customizer for the blogs component. 137 120 * -
trunk/src/bp-templates/bp-nouveau/includes/blogs/template-tags.php
r12567 r13303 200 200 } 201 201 202 /* 203 * This filter workaround is waiting for a core adaptation 204 * so that we can directly get the groups button arguments 205 * instead of the button. 206 * 207 * See https://buddypress.trac.wordpress.org/ticket/7126 208 */ 209 add_filter( 'bp_get_blogs_visit_blog_button', 'bp_nouveau_blogs_catch_button_args', 100, 1 ); 210 211 bp_get_blogs_visit_blog_button(); 212 213 remove_filter( 'bp_get_blogs_visit_blog_button', 'bp_nouveau_blogs_catch_button_args', 100, 1 ); 214 215 if ( isset( bp_nouveau()->blogs->button_args ) && bp_nouveau()->blogs->button_args ) { 216 $button_args = bp_nouveau()->blogs->button_args ; 217 218 // If we pass through parent classes add them to $button array 219 $parent_class = ''; 220 if ( ! empty( $args['parent_attr']['class'] ) ) { 221 $parent_class = $args['parent_attr']['class']; 222 } 223 224 // Set defaults if not set. 225 $button_args = array_merge( array( 226 'wrapper_id' => '', 227 'link_id' => '', 228 'link_rel' => '' 229 ), $button_args ); 230 231 $buttons['visit_blog'] = array( 232 'id' => 'visit_blog', 233 'position' => 5, 234 'component' => $button_args['component'], 235 'must_be_logged_in' => $button_args['must_be_logged_in'], 236 'block_self' => $button_args['block_self'], 237 'parent_element' => $parent_element, 238 'button_element' => $button_element, 239 'link_text' => $button_args['link_text'], 240 'parent_attr' => array( 241 'id' => $button_args['wrapper_id'], 242 'class' => $parent_class, 243 ), 244 'button_attr' => array( 245 'href' => $button_args['link_href'], 246 'id' => $button_args['link_id'], 247 'class' => $button_args['link_class'] . ' button', 248 'rel' => $button_args['link_rel'], 249 'title' => '', 250 ), 251 ); 252 253 unset( bp_nouveau()->blogs->button_args ); 254 } 202 $button_args = bp_get_blogs_visit_blog_button_args(); 203 204 // If we pass through parent classes add them to $button array 205 $parent_class = ''; 206 if ( ! empty( $args['parent_attr']['class'] ) ) { 207 $parent_class = $args['parent_attr']['class']; 208 } 209 210 // Set defaults if not set. 211 $button_args = array_merge( array( 212 'wrapper_id' => '', 213 'link_id' => '', 214 'link_rel' => '' 215 ), $button_args ); 216 217 $buttons['visit_blog'] = array( 218 'id' => 'visit_blog', 219 'position' => 5, 220 'component' => $button_args['component'], 221 'must_be_logged_in' => $button_args['must_be_logged_in'], 222 'block_self' => $button_args['block_self'], 223 'parent_element' => $parent_element, 224 'button_element' => $button_element, 225 'link_text' => $button_args['link_text'], 226 'link_title' => $button_args['link_title'], 227 'parent_attr' => array( 228 'id' => $button_args['wrapper_id'], 229 'class' => $parent_class, 230 ), 231 'button_attr' => array( 232 'href' => $button_args['link_href'], 233 'id' => $button_args['link_id'], 234 'class' => $button_args['link_class'] . ' button', 235 'rel' => $button_args['link_rel'], 236 'title' => '', 237 ), 238 ); 255 239 256 240 /** -
trunk/src/class-buddypress.php
r13273 r13303 560 560 require $this->plugin_dir . 'bp-core/deprecated/9.0.php'; 561 561 require $this->plugin_dir . 'bp-core/deprecated/10.0.php'; 562 require $this->plugin_dir . 'bp-core/deprecated/11.0.php'; 562 563 } 563 564
Note: See TracChangeset
for help on using the changeset viewer.