Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2015 02:49:16 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Replace all remaining $bp global touches with buddypress().

All existing tests continue to pass as normal. I will further manually scrutinize each replacement to ensure correctness.

Fixes #5138. Any stragglers or updates will reference this ticket.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-forums/bp-forums-template.php

    r9467 r9471  
    2828         */
    2929        function bp_get_forums_slug() {
    30                 global $bp;
    31 
    3230                /**
    3331                 * Filters the forums component slug.
     
    3735                 * @param string $slug Forums component slug.
    3836                 */
    39                 return apply_filters( 'bp_get_forums_slug', $bp->forums->slug );
     37                return apply_filters( 'bp_get_forums_slug', buddypress()->forums->slug );
    4038        }
    4139
     
    5856         */
    5957        function bp_get_forums_root_slug() {
    60                 global $bp;
    61 
    6258                /**
    6359                 * Filters the forums component root slug.
     
    6763                 * @param string $root_slug Forums component root slug.
    6864                 */
    69                 return apply_filters( 'bp_get_forums_root_slug', $bp->forums->root_slug );
     65                return apply_filters( 'bp_get_forums_root_slug', buddypress()->forums->root_slug );
    7066        }
    7167
     
    231227         */
    232228        function __construct( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms, $offset = false, $number = false ) {
    233                 global $bp;
     229                $bp = buddypress();
    234230
    235231                $this->pag_page     = $page;
     
    333329                 * @param string $no_stickies Requested sticky format.
    334330                 */
    335                 $this->topic_count       = apply_filters_ref_array( 'bp_forums_template_topic_count',                                array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
     331                $this->topic_count = apply_filters_ref_array( 'bp_forums_template_topic_count', array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
    336332
    337333                /**
     
    499495 */
    500496function bp_has_forum_topics( $args = '' ) {
    501         global $forum_template, $bp;
     497        global $forum_template;
     498
     499        $bp = buddypress();
    502500
    503501        /***
     
    16661664         */
    16671665        function bp_get_my_forum_topics_link() {
    1668                 global $bp;
    1669 
    16701666                /**
    16711667                 * Filters the permalink to the 'personal' topics tab.
     
    16901686         */
    16911687        function bp_get_unreplied_forum_topics_link() {
    1692                 global $bp;
    1693 
    16941688                /**
    16951689                 * Filters the permalink to the 'unreplied' topics tab.
     
    17141708         */
    17151709        function bp_get_popular_forum_topics_link() {
    1716                 global $bp;
    1717 
    17181710                /**
    17191711                 * Filters the permalink to the 'popular' topics tab.
     
    17381730         */
    17391731        function bp_get_newest_forum_topics_link() {
    1740                 global $bp;
    1741 
    17421732                /**
    17431733                 * Filters the link to the forums directory.
     
    17641754         */
    17651755        function bp_get_forum_topic_type() {
    1766                 global $bp;
    17671756
    17681757                if ( !bp_is_directory() || !bp_current_action() )
     
    18791868         */
    18801869        function bp_get_forum_pagination_count() {
    1881                 global $bp, $forum_template;
     1870                global $forum_template;
    18821871
    18831872                $start_num  = intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1;
     
    19091898 */
    19101899function bp_is_edit_topic() {
    1911         global $bp;
    19121900
    19131901        if ( bp_is_action_variable( 'post' ) && bp_is_action_variable( 'edit' ) )
     
    20612049         */
    20622050        function __construct( $topic_id, $per_page, $max, $order ) {
    2063                 global $bp, $current_user, $forum_template;
    2064 
    2065                 if ( !isset( $forum_template ) ) {
    2066                         $forum_template = new stdClass;
    2067                 }
     2051                global $forum_template;
     2052
     2053                if ( !isset( $forum_template ) ) {
     2054                        $forum_template = new stdClass;
     2055                }
    20682056
    20692057                $this->pag_page        = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
     
    21932181         */
    21942182        function the_post() {
    2195                 global $post;
    21962183
    21972184                $this->in_the_loop = true;
     
    25162503         */
    25172504        function bp_get_the_topic_post_is_mine() {
    2518                 global $bp, $topic_template;
     2505                global $topic_template;
    25192506
    25202507                return bp_loggedin_user_id() == $topic_template->post->poster_id;
     
    26292616 */
    26302617function bp_the_topic_pagination_count() {
    2631         global $bp, $topic_template;
     2618        global $topic_template;
    26322619
    26332620        $start_num = intval( ( $topic_template->pag_page - 1 ) * $topic_template->pag_num ) + 1;
     
    27582745         */
    27592746        function bp_get_forum_name( $forum_id = 0 ) {
    2760                 global $bp;
    27612747
    27622748                if ( empty( $forum_id ) ) {
Note: See TracChangeset for help on using the changeset viewer.