<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][5686] trunk/bp-blogs: Remove unneeded globals and clean up some code in Blogs component.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/5686">5686</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2012-02-09 22:36:36 +0000 (Thu, 09 Feb 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove unneeded globals and clean up some code in Blogs component. See <a href="http://buddypress.trac.wordpress.org/ticket/3989">#3989</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsbpblogsactionsphp">trunk/bp-blogs/bp-blogs-actions.php</a></li>
<li><a href="#trunkbpblogsbpblogsactivityphp">trunk/bp-blogs/bp-blogs-activity.php</a></li>
<li><a href="#trunkbpblogsbpblogsbuddybarphp">trunk/bp-blogs/bp-blogs-buddybar.php</a></li>
<li><a href="#trunkbpblogsbpblogscachephp">trunk/bp-blogs/bp-blogs-cache.php</a></li>
<li><a href="#trunkbpblogsbpblogsclassesphp">trunk/bp-blogs/bp-blogs-classes.php</a></li>
<li><a href="#trunkbpblogsbpblogsfunctionsphp">trunk/bp-blogs/bp-blogs-functions.php</a></li>
<li><a href="#trunkbpblogsbpblogsloaderphp">trunk/bp-blogs/bp-blogs-loader.php</a></li>
<li><a href="#trunkbpblogsbpblogsscreensphp">trunk/bp-blogs/bp-blogs-screens.php</a></li>
<li><a href="#trunkbpblogsbpblogstemplatephp">trunk/bp-blogs/bp-blogs-template.php</a></li>
<li><a href="#trunkbpblogsbpblogswidgetsphp">trunk/bp-blogs/bp-blogs-widgets.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpblogsbpblogsactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-actions.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-actions.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-actions.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,16 +1,38 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Actions
+ *
+ * @package BuddyPress
+ * @subpackage BlogsActions
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><ins>+/**
+ * Redirect to a random blog in the multisite network
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsActions
+ */
</ins><span class="cx"> function bp_blogs_redirect_to_random_blog() {
</span><del>-        global $bp, $wpdb;
</del><span class="cx"> 
</span><del>-        if ( bp_is_blogs_component() &amp;&amp; isset( $_GET['random-blog'] ) ) {
</del><ins>+        // Bail if not looking for a random blog
+        if ( ! bp_is_blogs_component() || ! isset( $_GET['random-blog'] ) )
+                return;
+
+        // Multisite is active so find a random blog
+        if ( is_multisite() ) {
</ins><span class="cx">                 $blog = bp_blogs_get_random_blogs( 1, 1 );
</span><ins>+                bp_core_redirect( get_site_url( $blog['blogs'][0]-&gt;blog_id ) );
</ins><span class="cx"> 
</span><del>-                bp_core_redirect( get_site_url( $blog['blogs'][0]-&gt;blog_id ) );
</del><ins>+        // No multisite and still called, always redirect to root
+        } else {
+                bp_core_redirect( bp_core_get_root_domain() );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_actions', 'bp_blogs_redirect_to_random_blog' );
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-activity.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-activity.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-activity.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,17 +1,29 @@
</span><span class="cx"> &lt;?php
</span><del>-/******************************************************************************
- * These functions handle the recording, deleting and formatting of activity and
- * notifications for the user and for this specific component.
</del><ins>+
+/**
+ * BuddyPress Blogs Activity
+ *
+ * @package BuddyPress
+ * @subpackage BlogsActivity
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><del>-
</del><ins>+/**
+ * Register activity actions for the blogs component
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsActivity
+ * @global type $bp
+ * @return boolean 
+ */
</ins><span class="cx"> function bp_blogs_register_activity_actions() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( !bp_is_active( 'activity' ) )
</del><ins>+        // Bail if activity is not active
+        if ( ! bp_is_active( 'activity' ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         bp_activity_set_action( $bp-&gt;blogs-&gt;id, 'new_blog',         __( 'New site created',        'buddypress' ) );
</span><span class="lines">@@ -22,10 +34,21 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_register_activity_actions', 'bp_blogs_register_activity_actions' );
</span><span class="cx"> 
</span><ins>+/**
+ * Record the activity to the actvity stream
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsActivity
+ * @global BuddyPress $bp
+ * @param array $args
+ * @return boolean 
+ */
</ins><span class="cx"> function bp_blogs_record_activity( $args = '' ) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( !bp_is_active( 'activity' ) )
</del><ins>+        // Bail if activity is not active
+        if ( ! bp_is_active( 'activity' ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><span class="lines">@@ -45,7 +68,7 @@
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><span class="cx">         // Remove large images and replace them with just one image thumbnail
</span><del>-         if ( bp_is_active( 'activity' ) &amp;&amp; !empty( $content ) )
</del><ins>+         if ( !empty( $content ) )
</ins><span class="cx">                 $content = bp_activity_thumbnail_content_images( $content, $primary_link );
</span><span class="cx"> 
</span><span class="cx">         if ( !empty( $action ) )
</span><span class="lines">@@ -66,29 +89,41 @@
</span><span class="cx">         return bp_activity_add( array( 'id' =&gt; $id, 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'recorded_time' =&gt; $recorded_time, 'hide_sitewide' =&gt; $hide_sitewide ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Delete a blogs activity stream item
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsActivity
+ * @global BuddyPress $bp
+ * @param array $args
+ * @return If activity is not active
+ */
</ins><span class="cx"> function bp_blogs_delete_activity( $args = true ) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( bp_is_active( 'activity' ) ) {
-                $defaults = array(
-                        'item_id'           =&gt; false,
-                        'component'         =&gt; $bp-&gt;blogs-&gt;id,
-                        'type'              =&gt; false,
-                        'user_id'           =&gt; false,
-                        'secondary_item_id' =&gt; false
-                );
</del><ins>+        // Bail if activity is not active
+        if ( ! bp_is_active( 'activity' ) )
+                return false;
</ins><span class="cx"> 
</span><del>-                $params = wp_parse_args( $args, $defaults );
-                extract( $params, EXTR_SKIP );
</del><ins>+        $defaults = array(
+                'item_id'           =&gt; false,
+                'component'         =&gt; $bp-&gt;blogs-&gt;id,
+                'type'              =&gt; false,
+                'user_id'           =&gt; false,
+                'secondary_item_id' =&gt; false
+        );
</ins><span class="cx"> 
</span><del>-                bp_activity_delete_by_item_id( array(
-                        'item_id'           =&gt; $item_id,
-                        'component'         =&gt; $component,
-                        'type'              =&gt; $type,
-                        'user_id'           =&gt; $user_id,
-                        'secondary_item_id' =&gt; $secondary_item_id
-                ) );
-        }
</del><ins>+        $params = wp_parse_args( $args, $defaults );
+        extract( $params, EXTR_SKIP );
+
+        bp_activity_delete_by_item_id( array(
+                'item_id'           =&gt; $item_id,
+                'component'         =&gt; $component,
+                'type'              =&gt; $type,
+                'user_id'           =&gt; $user_id,
+                'secondary_item_id' =&gt; $secondary_item_id
+        ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsbuddybarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-buddybar.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-buddybar.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-buddybar.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,8 +1,25 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Activity
+ *
+ * @package BuddyPress
+ * @subpackage BlogsBuddyBar
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><del>-// *** &quot;My Blogs&quot; Menu ********
</del><ins>+/**
+ * Add a Sites menu to the BuddyBar
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsBuddyBar
+ * @global BuddyPress $bp
+ * @return boolean 
+ */
+        
</ins><span class="cx"> function bp_adminbar_blogs_menu() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="lines">@@ -12,7 +29,8 @@
</span><span class="cx">         if ( !is_multisite() )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' ) ) {
</del><ins>+        $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' );
+        if ( empty( $blogs ) ) {
</ins><span class="cx">                 $blogs = bp_blogs_get_blogs_for_user( bp_loggedin_user_id(), true );
</span><span class="cx">                 wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp' );
</span><span class="cx">         }
</span><span class="lines">@@ -60,4 +78,4 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 );
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogscachephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-cache.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-cache.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-cache.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,19 +1,40 @@
</span><span class="cx"> &lt;?php
</span><del>-/*******************************************************************************
- * Caching
</del><ins>+
+/**
+ * BuddyPress Blogs Caching
</ins><span class="cx">  *
</span><span class="cx">  * Caching functions handle the clearing of cached objects and pages on specific
</span><span class="cx">  * actions throughout BuddyPress.
</span><ins>+ *
+ * @package BuddyPress
+ * @subpackage BlogsBuddyBar
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><ins>+/**
+ * Clear the blog object cache
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsBuddyBar
+ * @param int $blog_id
+ * @param int $user_id 
+ */
</ins><span class="cx"> function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) {
</span><del>-        wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
</del><ins>+        wp_cache_delete( 'bp_blogs_of_user_'        . $user_id, 'bp' );
</ins><span class="cx">         wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Clear cache when a new blog is created
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsBuddyBar
+ * @param Blog $recorded_blog_obj 
+ */
</ins><span class="cx"> function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) {
</span><span class="cx">         bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj-&gt;user_id );
</span><span class="cx">         wp_cache_delete( 'bp_total_blogs', 'bp' );
</span><span class="lines">@@ -34,4 +55,4 @@
</span><span class="cx"> add_action( 'bp_blogs_new_blog',             'bp_core_clear_cache' );
</span><span class="cx"> add_action( 'bp_blogs_remove_data',          'bp_core_clear_cache' );
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-classes.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-classes.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-classes.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,8 +1,23 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Classes
+ *
+ * @package BuddyPress
+ * @subpackage BlogsClasses
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><del>-Class BP_Blogs_Blog {
</del><ins>+/**
+ * The main BuddyPress blog class
+ *
+ * @since BuddyPress (1.0)
+ * @package BuddyPress
+ * @subpackage BlogsClasses
+ */
+class BP_Blogs_Blog {
</ins><span class="cx">         var $id;
</span><span class="cx">         var $user_id;
</span><span class="cx">         var $blog_id;
</span><span class="lines">@@ -12,11 +27,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function __construct( $id = null ) {
</span><del>-                global $bp, $wpdb;
-
-                $user_id = bp_displayed_user_id();
-
-                if ( $id ) {
</del><ins>+                if ( !empty( $id ) ) {
</ins><span class="cx">                         $this-&gt;id = $id;
</span><span class="cx">                         $this-&gt;populate();
</span><span class="cx">                 }
</span><span class="lines">@@ -279,4 +290,5 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+
+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-functions.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-functions.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-functions.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -17,7 +17,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_get_blogs( $args = '' ) {
</span><del>-        global $bp;
</del><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><span class="cx">                 'type'         =&gt; 'active', // active, alphabetical, newest, or random
</span><span class="lines">@@ -73,17 +72,15 @@
</span><span class="cx"> /**
</span><span class="cx">  * Makes BuddyPress aware of a new site so that it can track its activity.
</span><span class="cx">  *
</span><del>- * @global object $bp BuddyPress global settings
</del><ins>+ * @since BuddyPress (1.0)
</ins><span class="cx">  * @param int $blog_id
</span><span class="cx">  * @param int $user_id
</span><span class="cx">  * @param $bool $no_activity ; optional.
</span><del>- * @since 1.0
</del><span class="cx">  * @uses BP_Blogs_Blog
</span><span class="cx">  */
</span><span class="cx"> function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
</span><del>-        global $bp;
</del><span class="cx"> 
</span><del>-        if ( !$user_id )
</del><ins>+        if ( empty( $user_id ) )
</ins><span class="cx">                 $user_id = bp_loggedin_user_id();
</span><span class="cx"> 
</span><span class="cx">         $name = get_blog_option( $blog_id, 'blogname' );
</span><span class="lines">@@ -95,11 +92,9 @@
</span><span class="cx">         $recorded_blog          = new BP_Blogs_Blog;
</span><span class="cx">         $recorded_blog-&gt;user_id = $user_id;
</span><span class="cx">         $recorded_blog-&gt;blog_id = $blog_id;
</span><ins>+        $recorded_blog_id       = $recorded_blog-&gt;save();
+        $is_recorded            = !empty( $recorded_blog_id ) ? true : false;
</ins><span class="cx"> 
</span><del>-        $recorded_blog_id = $recorded_blog-&gt;save();
-
-        $is_recorded = !empty( $recorded_blog_id ) ? true : false;
-
</del><span class="cx">         bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'name', $name );
</span><span class="cx">         bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'description', $description );
</span><span class="cx">         bp_blogs_update_blogmeta( $recorded_blog-&gt;blog_id, 'last_activity', bp_core_current_time() );
</span><span class="lines">@@ -233,13 +228,11 @@
</span><span class="cx">  * Record blog comment activity. Checks if blog is public and post is not
</span><span class="cx">  * password protected.
</span><span class="cx">  *
</span><del>- * @global $bp $bp
</del><span class="cx">  * @param int $comment_id
</span><span class="cx">  * @param bool $is_approved
</span><span class="cx">  * @return mixed
</span><span class="cx">  */
</span><span class="cx"> function bp_blogs_record_comment( $comment_id, $is_approved = true ) {
</span><del>-        global $bp;
</del><span class="cx"> 
</span><span class="cx">         // Get the users comment
</span><span class="cx">         $recorded_comment = get_comment( $comment_id );
</span><span class="lines">@@ -364,17 +357,21 @@
</span><span class="cx"> add_action( 'delete_blog', 'bp_blogs_remove_blog' );
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
</span><del>-        global $bp, $current_user;
</del><ins>+        global $bp;
</ins><span class="cx"> 
</span><del>-        $blog_id = (int)$blog_id;
-        $user_id = (int)$user_id;
</del><ins>+        $blog_id = (int) $blog_id;
+        $user_id = (int) $user_id;
</ins><span class="cx"> 
</span><span class="cx">         do_action( 'bp_blogs_before_remove_blog_for_user', $blog_id, $user_id );
</span><span class="cx"> 
</span><span class="cx">         BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
</span><span class="cx"> 
</span><span class="cx">         // Delete activity stream item
</span><del>-        bp_blogs_delete_activity( array( 'item_id' =&gt; $blog_id, 'component' =&gt; $bp-&gt;blogs-&gt;id, 'type' =&gt; 'new_blog' ) );
</del><ins>+        bp_blogs_delete_activity( array(
+                'item_id'   =&gt; $blog_id,
+                'component' =&gt; $bp-&gt;blogs-&gt;id,
+                'type'      =&gt; 'new_blog'
+        ) );
</ins><span class="cx"> 
</span><span class="cx">         do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
</span><span class="cx"> }
</span><span class="lines">@@ -404,7 +401,7 @@
</span><span class="cx"> add_action( 'delete_post', 'bp_blogs_remove_post' );
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_remove_comment( $comment_id ) {
</span><del>-        global $wpdb, $bp;
</del><ins>+        global $wpdb;
</ins><span class="cx"> 
</span><span class="cx">         // Delete activity stream item
</span><span class="cx">         bp_blogs_delete_activity( array( 'item_id' =&gt; $wpdb-&gt;blogid, 'secondary_item_id' =&gt; $comment_id, 'type' =&gt; 'new_blog_comment' ) );
</span><span class="lines">@@ -496,9 +493,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_total_blogs_for_user( $user_id = 0 ) {
</span><del>-        global $bp;
</del><span class="cx"> 
</span><del>-        if ( !$user_id )
</del><ins>+        if ( empty( $user_id ) )
</ins><span class="cx">                 $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
</span><span class="cx"> 
</span><span class="cx">         if ( !$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' ) ) {
</span><span class="lines">@@ -652,4 +648,5 @@
</span><span class="cx"> add_action( 'wpmu_delete_user',  'bp_blogs_remove_data' );
</span><span class="cx"> add_action( 'delete_user',       'bp_blogs_remove_data' );
</span><span class="cx"> add_action( 'bp_make_spam_user', 'bp_blogs_remove_data' );
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+
+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-loader.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-loader.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-loader.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> &lt;?php
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx">  * BuddyPress Blogs Streams Loader
</span><span class="cx">  *
</span><span class="lines">@@ -209,4 +210,4 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_setup_components', 'bp_setup_blogs', 6 );
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogsscreensphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-screens.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-screens.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-screens.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,4 +1,12 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Screens
+ *
+ * @package BuddyPress
+ * @subpackage BlogsScreens
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><span class="lines">@@ -35,4 +43,4 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_screens', 'bp_blogs_screen_index', 2 );
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkbpblogsbpblogstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-template.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-template.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-template.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,4 +1,12 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Template Tags
+ *
+ * @package BuddyPress
+ * @subpackage BlogsTemplate
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><span class="lines">@@ -6,7 +14,7 @@
</span><span class="cx">  * Output the blogs component slug
</span><span class="cx">  *
</span><span class="cx">  * @package BuddyPress
</span><del>- * @subpackage Blogs Template
</del><ins>+ * @subpackage BlogsTemplate
</ins><span class="cx">  * @since BuddyPress (r4100)
</span><span class="cx">  *
</span><span class="cx">  * @uses bp_get_blogs_slug()
</span><span class="lines">@@ -18,7 +26,7 @@
</span><span class="cx">          * Return the blogs component slug
</span><span class="cx">          *
</span><span class="cx">          * @package BuddyPress
</span><del>-         * @subpackage Blogs Template
</del><ins>+         * @subpackage BlogsTemplate
</ins><span class="cx">          * @since BuddyPress (r4100)
</span><span class="cx">          */
</span><span class="cx">         function bp_get_blogs_slug() {
</span><span class="lines">@@ -30,7 +38,7 @@
</span><span class="cx">  * Output the blogs component root slug
</span><span class="cx">  *
</span><span class="cx">  * @package BuddyPress
</span><del>- * @subpackage Blogs Template
</del><ins>+ * @subpackage BlogsTemplate
</ins><span class="cx">  * @since BuddyPress (r4100)
</span><span class="cx">  *
</span><span class="cx">  * @uses bp_get_blogs_root_slug()
</span><span class="lines">@@ -42,7 +50,7 @@
</span><span class="cx">          * Return the blogs component root slug
</span><span class="cx">          *
</span><span class="cx">          * @package BuddyPress
</span><del>-         * @subpackage Blogs Template
</del><ins>+         * @subpackage BlogsTemplate
</ins><span class="cx">          * @since BuddyPress (r4100)
</span><span class="cx">          */
</span><span class="cx">         function bp_get_blogs_root_slug() {
</span><span class="lines">@@ -54,7 +62,7 @@
</span><span class="cx">  * Output blog directory permalink
</span><span class="cx">  *
</span><span class="cx">  * @package BuddyPress
</span><del>- * @subpackage Blogs Template
</del><ins>+ * @subpackage BlogsTemplate
</ins><span class="cx">  * @since 1.5
</span><span class="cx">  * @uses bp_get_blogs_directory_permalink()
</span><span class="cx">  */
</span><span class="lines">@@ -65,7 +73,7 @@
</span><span class="cx">          * Return blog directory permalink
</span><span class="cx">          *
</span><span class="cx">          * @package BuddyPress
</span><del>-         * @subpackage Blogs Template
</del><ins>+         * @subpackage BlogsTemplate
</ins><span class="cx">          * @since 1.5
</span><span class="cx">          * @uses apply_filters()
</span><span class="cx">          * @uses traisingslashit()
</span><span class="lines">@@ -99,7 +107,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function __construct( $type, $page, $per_page, $max, $user_id, $search_terms ) {
</span><del>-                global $bp;
</del><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
</span><span class="cx">                 $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</span><span class="lines">@@ -174,7 +181,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function the_blog() {
</span><del>-                global $blog;
</del><span class="cx"> 
</span><span class="cx">                 $this-&gt;in_the_loop = true;
</span><span class="cx">                 $this-&gt;blog        = $this-&gt;next_blog();
</span><span class="lines">@@ -191,7 +197,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_has_blogs( $args = '' ) {
</span><del>-        global $bp, $blogs_template;
</del><ins>+        global $blogs_template;
</ins><span class="cx"> 
</span><span class="cx">         /***
</span><span class="cx">          * Set the defaults based on the current page. Any of these will be overridden
</span><span class="lines">@@ -227,8 +233,9 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( $max ) {
</span><del>-                if ( $per_page &gt; $max )
</del><ins>+                if ( $per_page &gt; $max ) {
</ins><span class="cx">                         $per_page = $max;
</span><ins>+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms );
</span><span class="lines">@@ -248,7 +255,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_pagination_count() {
</span><del>-        global $bp, $blogs_template;
</del><ins>+        global $blogs_template;
</ins><span class="cx"> 
</span><span class="cx">         $start_num = intval( ( $blogs_template-&gt;pag_page - 1 ) * $blogs_template-&gt;pag_num ) + 1;
</span><span class="cx">         $from_num  = bp_core_number_format( $start_num );
</span><span class="lines">@@ -271,7 +278,7 @@
</span><span class="cx">         echo bp_get_blog_avatar( $args );
</span><span class="cx"> }
</span><span class="cx">         function bp_get_blog_avatar( $args = '' ) {
</span><del>-                global $blogs_template, $bp;
</del><ins>+                global $blogs_template;
</ins><span class="cx">                 
</span><span class="cx">                 $defaults = array(
</span><span class="cx">                         'type'    =&gt; 'full',
</span><span class="lines">@@ -401,8 +408,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '') {
</span><del>-        global $current_user, $current_site;
-        global $bp;
</del><ins>+        global $current_user;
</ins><span class="cx"> 
</span><span class="cx">         if ( isset($_POST['submit']) ) {
</span><span class="cx">                 bp_blogs_validate_blog_signup();
</span><span class="lines">@@ -581,14 +587,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_create_blog_link() {
</span><del>-        global $bp;
-
</del><span class="cx">         if ( bp_is_my_profile() )
</span><span class="cx">                 echo apply_filters( 'bp_create_blog_link', '&lt;a href=&quot;' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/&quot;&gt;' . __( 'Create a Site', 'buddypress' ) . '&lt;/a&gt;' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_blog_tabs() {
</span><del>-        global $bp, $groups_template;
</del><span class="cx"> 
</span><span class="cx">         // Don't show these tabs on a user's own profile
</span><span class="cx">         if ( bp_is_my_profile() )
</span><span class="lines">@@ -607,10 +610,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_directory_blogs_search_form() {
</span><del>-        global $bp;
</del><span class="cx"> 
</span><span class="cx">         $default_search_value = bp_get_search_default_text();
</span><del>-        $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; ?&gt;
</del><ins>+        $search_value         = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; ?&gt;
</ins><span class="cx"> 
</span><span class="cx">         &lt;form action=&quot;&quot; method=&quot;get&quot; id=&quot;search-blogs-form&quot;&gt;
</span><span class="cx">                 &lt;label&gt;&lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;blogs_search&quot; placeholder=&quot;&lt;?php echo esc_attr( $search_value ) ?&gt;&quot; /&gt;&lt;/label&gt;
</span></span></pre></div>
<a id="trunkbpblogsbpblogswidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-widgets.php (5685 => 5686)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-widgets.php        2012-02-09 22:31:11 UTC (rev 5685)
+++ trunk/bp-blogs/bp-blogs-widgets.php        2012-02-09 22:36:36 UTC (rev 5686)
</span><span class="lines">@@ -1,16 +1,20 @@
</span><span class="cx"> &lt;?php
</span><ins>+
+/**
+ * BuddyPress Blogs Widgets
+ *
+ * @package BuddyPress
+ * @subpackage BlogsWidgets
+ */
+
</ins><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><del>-/***
- * The recent blogs widget is actually just the activity feed filtered on &quot;new_blog_post&quot;.
- * Why not make some of your own widgets using a filtered activity stream?
- */
-
</del><ins>+// @todo not use create_function()
</ins><span class="cx"> function bp_blogs_register_widgets() {
</span><del>-        global $wpdb, $bp;
</del><ins>+        global $wpdb;
</ins><span class="cx"> 
</span><del>-        if ( bp_is_active( 'activity' ) &amp;&amp; (int)$wpdb-&gt;blogid == bp_get_root_blog_id() )
</del><ins>+        if ( bp_is_active( 'activity' ) &amp;&amp; (int) $wpdb-&gt;blogid == bp_get_root_blog_id() )
</ins><span class="cx">                 add_action('widgets_init', create_function('', 'return register_widget(&quot;BP_Blogs_Recent_Posts_Widget&quot;);') );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' );
</span><span class="lines">@@ -26,7 +30,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function widget($args, $instance) {
</span><del>-                global $bp;
</del><span class="cx"> 
</span><span class="cx">                 extract( $args );
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>