<!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][3937] trunk: Clean up bp-blogs-template whitespace and code formatting.</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>3937</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2011-01-26 20:43:59 +0000 (Wed, 26 Jan 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Clean up bp-blogs-template whitespace and code formatting. Add checks to BP_Component::_setup_nav and set params to optional.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsbpblogsfunctionsphp">trunk/bp-blogs/bp-blogs-functions.php</a></li>
<li><a href="#trunkbpblogsbpblogstemplatephp">trunk/bp-blogs/bp-blogs-template.php</a></li>
<li><a href="#trunkbpcorebpcorebuddybarphp">trunk/bp-core/bp-core-buddybar.php</a></li>
<li><a href="#trunkbpcorebpcorecomponentphp">trunk/bp-core/bp-core-component.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpblogsbpblogsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-functions.php (3936 => 3937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-functions.php        2011-01-26 20:30:30 UTC (rev 3936)
+++ trunk/bp-blogs/bp-blogs-functions.php        2011-01-26 20:43:59 UTC (rev 3937)
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx">         BP_Blogs_Blog::delete_blog_for_all( $blog_id );
</span><span class="cx">
</span><span class="cx">         // Delete activity stream item
</span><del>-        bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
</del><ins>+        bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
</ins><span class="cx">
</span><span class="cx">         do_action( 'bp_blogs_remove_blog', $blog_id );
</span><span class="cx"> }
</span><span class="lines">@@ -322,7 +322,7 @@
</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' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
</del><ins>+        bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => '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></pre></div>
<a id="trunkbpblogsbpblogstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-template.php (3936 => 3937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-template.php        2011-01-26 20:30:30 UTC (rev 3936)
+++ trunk/bp-blogs/bp-blogs-template.php        2011-01-26 20:43:59 UTC (rev 3937)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">                 global $blog;
</span><span class="cx">
</span><span class="cx">                 $this->in_the_loop = true;
</span><del>-                $this->blog = $this->next_blog();
</del><ins>+                $this->blog = $this->next_blog();
</ins><span class="cx">
</span><span class="cx">                 if ( 0 == $this->current_blog ) // loop has just started
</span><span class="cx">                         do_action('blog_loop_start');
</span><span class="lines">@@ -117,8 +117,8 @@
</span><span class="cx">          * if arguments are directly passed into the loop. Custom plugins should always
</span><span class="cx">          * pass their parameters directly to the loop.
</span><span class="cx">          */
</span><del>-        $type = 'active';
-        $user_id = 0;
</del><ins>+        $type = 'active';
+        $user_id = 0;
</ins><span class="cx">         $search_terms = null;
</span><span class="cx">
</span><span class="cx">         /* User filtering */
</span><span class="lines">@@ -126,12 +126,12 @@
</span><span class="cx">                 $user_id = $bp->displayed_user->id;
</span><span class="cx">
</span><span class="cx">         $defaults = array(
</span><del>-                'type' => $type,
-                'page' => 1,
-                'per_page' => 20,
-                'max' => false,
</del><ins>+                'type' => $type,
+                'page' => 1,
+                'per_page' => 20,
+                'max' => false,
</ins><span class="cx">
</span><del>-                'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
</del><ins>+                'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
</ins><span class="cx">                 'search_terms' => $search_terms // Pass search terms to filter on the blog title or description.
</span><span class="cx">         );
</span><span class="cx">
</span><span class="lines">@@ -170,9 +170,9 @@
</span><span class="cx">         global $bp, $blogs_template;
</span><span class="cx">
</span><span class="cx">         $start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
</span><del>-        $from_num = bp_core_number_format( $start_num );
-        $to_num = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
-        $total = bp_core_number_format( $blogs_template->total_blog_count );
</del><ins>+        $from_num = bp_core_number_format( $start_num );
+        $to_num = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
+        $total = bp_core_number_format( $blogs_template->total_blog_count );
</ins><span class="cx">
</span><span class="cx">         echo sprintf( __( 'Viewing blog %1$s to %2$s (of %3$s blogs)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
</span><span class="cx">         <span class="ajax-loader"></span><?php
</span><span class="lines">@@ -194,12 +194,12 @@
</span><span class="cx">                 global $blogs_template, $bp;
</span><span class="cx">
</span><span class="cx">                 $defaults = array(
</span><del>-                        'type' => 'full',
-                        'width' => false,
-                        'height' => false,
-                        'class' => 'avatar',
-                        'id' => false,
-                        'alt' => __( 'Blog authored by %s', 'buddypress' ),
</del><ins>+                        'type' => 'full',
+                        'width' => false,
+                        'height' => false,
+                        'class' => 'avatar',
+                        'id' => false,
+                        'alt' => __( 'Blog authored by %s', 'buddypress' ),
</ins><span class="cx">                         'no_grav' => true
</span><span class="cx">                 );
</span><span class="cx">
</span><span class="lines">@@ -273,17 +273,14 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> function bp_blog_hidden_fields() {
</span><del>-        if ( isset( $_REQUEST['s'] ) ) {
</del><ins>+        if ( isset( $_REQUEST['s'] ) )
</ins><span class="cx">                 echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
</span><del>-        }
</del><span class="cx">
</span><del>-        if ( isset( $_REQUEST['letter'] ) ) {
</del><ins>+        if ( isset( $_REQUEST['letter'] ) )
</ins><span class="cx">                 echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
</span><del>-        }
</del><span class="cx">
</span><del>-        if ( isset( $_REQUEST['blogs_search'] ) ) {
</del><ins>+        if ( isset( $_REQUEST['blogs_search'] ) )
</ins><span class="cx">                 echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function bp_total_blog_count() {
</span><span class="lines">@@ -372,7 +369,9 @@
</span><span class="cx">                 echo '<label for="blogname">' . __('Blog Domain:', 'buddypress') . '</label>';
</span><span class="cx">
</span><span class="cx">         if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
</span><ins>+
</ins><span class="cx">                 <p class="error"><?php echo $errmsg ?></p>
</span><ins>+
</ins><span class="cx">         <?php }
</span><span class="cx">
</span><span class="cx">         if ( !is_subdomain_install() )
</span><span class="lines">@@ -394,9 +393,13 @@
</span><span class="cx">
</span><span class="cx">         // Blog Title
</span><span class="cx">         ?>
</span><ins>+
</ins><span class="cx">         <label for="blog_title"><?php _e('Blog Title:', 'buddypress') ?></label>
</span><ins>+
</ins><span class="cx">         <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
</span><ins>+
</ins><span class="cx">                 <p class="error"><?php echo $errmsg ?></p>
</span><ins>+
</ins><span class="cx">         <?php }
</span><span class="cx">         echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_html($blog_title, 1).'" /></p>';
</span><span class="cx">         ?>
</span><span class="lines">@@ -463,22 +466,22 @@
</span><span class="cx">
</span><span class="cx"> function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) {
</span><span class="cx">         $protocol = is_ssl() ? 'https://' : 'http://';
</span><del>-        $blog_url = $protocol . $domain . $path;
-        ?>
-        <p><?php _e('Congratulations! You have successfully registered a new blog.', 'buddypress') ?></p>
</del><ins>+        $blog_url = $protocol . $domain . $path; ?>
+
+        <p><?php _e( 'Congratulations! You have successfully registered a new blog.', 'buddypress' ) ?></p>
</ins><span class="cx">         <p>
</span><del>-                <?php printf(__('<a href="%1$s">%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress'), $blog_url, $blog_url, $blog_url . "wp-login.php", $user_name) ?>
</del><ins>+                <?php printf(__( '<a href="%1$s">%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress' ), $blog_url, $blog_url, $blog_url . "wp-login.php", $user_name ); ?>
</ins><span class="cx">         </p>
</span><del>-        <?php
</del><ins>+
+<?php
</ins><span class="cx">         do_action('signup_finished');
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function bp_create_blog_link() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( bp_is_my_profile() )        {
-                echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create">' . __('Create a Blog', 'buddypress') . '</a>' );
-        }
</del><ins>+        if ( bp_is_my_profile() )
+                echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog', 'buddypress' ) . '</a>' );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function bp_blogs_blog_tabs() {
</span><span class="lines">@@ -488,13 +491,14 @@
</span><span class="cx">         if ( bp_is_my_profile() )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        $current_tab = $bp->current_action
-?>
</del><ins>+        $current_tab = $bp->current_action; ?>
+
</ins><span class="cx">         <ul class="content-header-nav">
</span><del>-                <li<?php if ( 'my-blogs' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
-                <li<?php if ( 'recent-posts' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
-                <li<?php if ( 'recent-comments' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
</del><ins>+                <li<?php if ( 'my-blogs' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/my-blogs' ); ?>"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
+                <li<?php if ( 'recent-posts' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/recent-posts' ); ?>"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
+                <li<?php if ( 'recent-comments' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/recent-comments' );?>"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
</ins><span class="cx">         </ul>
</span><ins>+
</ins><span class="cx"> <?php
</span><span class="cx">         do_action( 'bp_blogs_blog_tabs', $current_tab );
</span><span class="cx"> }
</span><span class="lines">@@ -503,13 +507,13 @@
</span><span class="cx">         global $bp;
</span><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;
</del><ins>+        $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; ?>
</ins><span class="cx">
</span><del>-        ?>
</del><span class="cx">         <form action="" method="get" id="search-blogs-form">
</span><span class="cx">                 <label><input type="text" name="s" id="blogs_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
</span><span class="cx">                 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
</span><span class="cx">         </form>
</span><ins>+
</ins><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpcorebpcorebuddybarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-buddybar.php (3936 => 3937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-buddybar.php        2011-01-26 20:30:30 UTC (rev 3936)
+++ trunk/bp-core/bp-core-buddybar.php        2011-01-26 20:43:59 UTC (rev 3937)
</span><span class="lines">@@ -445,7 +445,7 @@
</span><span class="cx">
</span><span class="cx">         if ( bp_blog_signup_enabled() ) {
</span><span class="cx">                 echo '<li' . $alt . '>';
</span><del>-                echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
</del><ins>+                echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
</ins><span class="cx">                 echo '</li>';
</span><span class="cx">         }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpcorebpcorecomponentphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-component.php (3936 => 3937)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-component.php        2011-01-26 20:30:30 UTC (rev 3936)
+++ trunk/bp-core/bp-core-component.php        2011-01-26 20:43:59 UTC (rev 3937)
</span><span class="lines">@@ -206,14 +206,21 @@
</span><span class="cx">         /**
</span><span class="cx">          * Setup the navigation
</span><span class="cx">          *
</span><del>-         * @param arr $main_nav
-         * @param arr $sub_nav
</del><ins>+         * @param arr $main_nav Optional
+         * @param arr $sub_nav Optional
</ins><span class="cx">          */
</span><del>-        function _setup_nav( $main_nav, $sub_nav ) {
-                bp_core_new_nav_item( $main_nav );
</del><ins>+        function _setup_nav( $main_nav = '', $sub_nav = '' ) {
+                // No sub nav items without a main nav item
+                if ( !empty( $main_nav ) ) {
+                        bp_core_new_nav_item( $main_nav );
</ins><span class="cx">
</span><del>-                foreach( $sub_nav as $nav )
-                        bp_core_new_subnav_item( $nav );
</del><ins>+                        // Sub nav items are not required
+                        if ( !empty( $sub_nav ) ) {
+                                foreach( $sub_nav as $nav ) {
+                                        bp_core_new_subnav_item( $nav );
+                                }
+                        }
+                }
</ins><span class="cx">
</span><span class="cx">                 // Call action
</span><span class="cx">                 do_action( 'bp_' . $this->id . '_setup_nav' );
</span></span></pre>
</div>
</div>
</body>
</html>