Index: bp-blogs-template.php
===================================================================
--- bp-blogs-template.php	(revision 14124)
+++ bp-blogs-template.php	(working copy)
@@ -14,7 +14,6 @@
  * Output the blogs component slug.
  *
  * @since 1.5.0
- *
  */
 function bp_blogs_slug() {
 	echo esc_attr( bp_get_blogs_slug() );
@@ -26,23 +25,22 @@
 	 *
 	 * @return string The 'blogs' slug.
 	 */
-	function bp_get_blogs_slug() {
+function bp_get_blogs_slug() {
 
-		/**
-		 * Filters the blogs component slug.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $slug Slug for the blogs component.
-		 */
-		return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
-	}
+	/**
+	 * Filters the blogs component slug.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $slug Slug for the blogs component.
+	 */
+	return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
+}
 
 /**
  * Output the blogs component root slug.
  *
  * @since 1.5.0
- *
  */
 function bp_blogs_root_slug() {
 	echo esc_attr( bp_get_blogs_root_slug() );
@@ -54,17 +52,17 @@
 	 *
 	 * @return string The 'blogs' root slug.
 	 */
-	function bp_get_blogs_root_slug() {
+function bp_get_blogs_root_slug() {
 
-		/**
-		 * Filters the blogs component root slug.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $root_slug Root slug for the blogs component.
-		 */
-		return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
-	}
+	/**
+	 * Filters the blogs component root slug.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $root_slug Root slug for the blogs component.
+	 */
+	return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
+}
 
 /**
  * Output Blogs directory's URL.
@@ -93,7 +91,7 @@
 	$path_chunks = bp_parse_args(
 		array_intersect_key( $path_chunks, $supported_chunks ),
 		array(
-			'component_id' => 'blogs'
+			'component_id' => 'blogs',
 		)
 	);
 
@@ -173,7 +171,7 @@
 
 	// Check for and use search terms.
 	$search_terms_default = false;
-	$search_query_arg = bp_core_get_component_search_query_arg( 'blogs' );
+	$search_query_arg     = bp_core_get_component_search_query_arg( 'blogs' );
 	if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
 		$search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] );
 	} elseif ( ! empty( $_REQUEST['s'] ) ) {
@@ -305,18 +303,18 @@
 	 *
 	 * @return string HTML pagination links.
 	 */
-	function bp_get_blogs_pagination_links() {
-		global $blogs_template;
+function bp_get_blogs_pagination_links() {
+	global $blogs_template;
 
-		/**
-		 * Filters the blogs pagination links.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $pag_links HTML pagination links.
-		 */
-		return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
-	}
+	/**
+	 * Filters the blogs pagination links.
+	 *
+	 * @since 1.0.0
+	 *
+	 * @param string $pag_links HTML pagination links.
+	 */
+	return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
+}
 
 /**
  * Output a blog's avatar.
@@ -361,164 +359,165 @@
 	 * }
 	 * @return string|bool User avatar string. False if avatars are turned off.
 	 */
-	function bp_get_blog_avatar( $args = '' ) {
-		global $blogs_template;
+function bp_get_blog_avatar( $args = '' ) {
+	global $blogs_template;
 
-		// Bail if avatars are turned off
-		// @todo Should we maybe still filter this?
-		if ( ! buddypress()->avatar->show_avatars ) {
-			return false;
-		}
+	// Bail if avatars are turned off
+	// @todo Should we maybe still filter this?
+	if ( ! buddypress()->avatar->show_avatars ) {
+		return false;
+	}
 
-		// Set default value for the `alt` attribute.
-		$alt_attribute = __( 'Site icon for the blog', 'buddypress' );
+	// Set default value for the `alt` attribute.
+	$alt_attribute = __( 'Site icon for the blog', 'buddypress' );
 
-		if ( ! empty( $args['blog_id'] ) ) {
-			$blog_id = (int) $args['blog_id'];
-		} else if ( isset( $blogs_template->blog->blog_id ) ) {
-			$blog_id = bp_get_blog_id();
+	if ( ! empty( $args['blog_id'] ) ) {
+		$blog_id = (int) $args['blog_id'];
+	} elseif ( isset( $blogs_template->blog->blog_id ) ) {
+		$blog_id = bp_get_blog_id();
 
-			/* translators: %s is the blog name */
-			$alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
-		} else {
-			$blog_id = 0;
-		}
+		/* translators: %s is the blog name */
+		$alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
+	} else {
+		$blog_id = 0;
+	}
 
-		// Parse the arguments.
-		$r = bp_parse_args(
-			$args,
-			array(
-				'item_id'    => $blog_id,
-				'avatar_dir' => 'blog-avatars',
-				'object'     => 'blog',
-				'type'       => 'full',
-				'width'      => false,
-				'height'     => false,
-				'class'      => 'avatar',
-				'id'         => false,
-				'alt'        => $alt_attribute,
-				'no_grav'    => false,
-				'html'       => true,
-			),
-			'blog_avatar'
-		);
+	// Parse the arguments.
+	$r = bp_parse_args(
+		$args,
+		array(
+			'item_id'    => $blog_id,
+			'avatar_dir' => 'blog-avatars',
+			'object'     => 'blog',
+			'type'       => 'full',
+			'width'      => false,
+			'height'     => false,
+			'class'      => 'avatar',
+			'id'         => false,
+			'alt'        => $alt_attribute,
+			'no_grav'    => false,
+			'html'       => true,
+		),
+		'blog_avatar'
+	);
 
-		/**
-		 * If the `admin_user_id` was provided, make the Blog avatar
-		 * defaults to the Blog's Admin user one.
-		 */
-		if ( isset( $r['admin_user_id'] ) && $r['admin_user_id'] ) {
-			$r['item_id']    = (int) $r['admin_user_id'];
-			$r['avatar_dir'] = 'avatars';
-			$r['object']     = 'user';
-		} elseif ( ! $r['no_grav'] ) {
-			$r['no_grav'] = true;
-		}
+	/**
+	 * If the `admin_user_id` was provided, make the Blog avatar
+	 * defaults to the Blog's Admin user one.
+	 */
+	if ( isset( $r['admin_user_id'] ) && $r['admin_user_id'] ) {
+		$r['item_id']    = (int) $r['admin_user_id'];
+		$r['avatar_dir'] = 'avatars';
+		$r['object']     = 'user';
+	} elseif ( ! $r['no_grav'] ) {
+		$r['no_grav'] = true;
+	}
 
-		// Use site icon if available.
-		$avatar = '';
-		if ( bp_is_active( 'blogs', 'site-icon' ) ) {
-			$site_icon = bp_blogs_get_blogmeta( $blog_id, "site_icon_url_{$r['type']}" );
+	// Use site icon if available.
+	$avatar = '';
+	if ( bp_is_active( 'blogs', 'site-icon' ) ) {
+		$site_icon = bp_blogs_get_blogmeta( $blog_id, "site_icon_url_{$r['type']}" );
 
-			// Never attempted to fetch site icon before; do it now!
-			if ( '' === $site_icon ) {
-				// Fetch the other size first.
-				if ( 'full' === $r['type'] ) {
-					$size      = bp_core_avatar_thumb_width();
-					$save_size = 'thumb';
-				} else {
-					$size      = bp_core_avatar_full_width();
-					$save_size = 'full';
-				}
+		// Never attempted to fetch site icon before; do it now!
+		if ( '' === $site_icon ) {
+			// Fetch the other size first.
+			if ( 'full' === $r['type'] ) {
+				$size      = bp_core_avatar_thumb_width();
+				$save_size = 'thumb';
+			} else {
+				$size      = bp_core_avatar_full_width();
+				$save_size = 'full';
+			}
 
-				$site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
+			$site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
 
-				// Empty site icons get saved as integer 0.
-				if ( empty( $site_icon ) ) {
-					$site_icon = 0;
-				}
+			// Empty site icons get saved as integer 0.
+			if ( empty( $site_icon ) ) {
+				$site_icon = 0;
+			}
 
-				// Sync site icon for other size to blogmeta.
-				bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$save_size}", $site_icon );
+			// Sync site icon for other size to blogmeta.
+			bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$save_size}", $site_icon );
 
-				// Now, fetch the size we want.
-				if ( 0 !== $site_icon ) {
-					$size      = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
-					$site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
-				}
-
-				// Sync site icon to blogmeta.
-				bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$r['type']}", $site_icon );
+			// Now, fetch the size we want.
+			if ( 0 !== $site_icon ) {
+				$size      = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
+				$site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
 			}
 
-			// We have a site icon.
-			if ( ! is_numeric( $site_icon ) ) {
-				// Just return the raw url of the Site Icon.
-				if ( ! $r['html'] ) {
-					return esc_url_raw( $site_icon );
-				}
+			// Sync site icon to blogmeta.
+			bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$r['type']}", $site_icon );
+		}
 
-				if ( empty( $r['width'] ) && ! isset( $size ) ) {
-					$size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
-				} else {
-					$size = (int) $r['width'];
-				}
+		// We have a site icon.
+		if ( ! is_numeric( $site_icon ) ) {
+			// Just return the raw url of the Site Icon.
+			if ( ! $r['html'] ) {
+				return esc_url_raw( $site_icon );
+			}
 
-				$avatar = sprintf( '<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" />',
-					esc_url( $site_icon ),
-					esc_attr( "{$r['class']} avatar-{$size}" ),
-					esc_attr( $size ),
-					esc_attr( $alt_attribute )
-				);
+			if ( empty( $r['width'] ) && ! isset( $size ) ) {
+				$size = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
+			} else {
+				$size = (int) $r['width'];
 			}
-		}
 
-		// Fallback to Default blog avatar.
-		if ( '' === $avatar ) {
-			$avatar = bp_core_fetch_avatar( $r );
+			$avatar = sprintf(
+				'<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" />',
+				esc_url( $site_icon ),
+				esc_attr( "{$r['class']} avatar-{$size}" ),
+				esc_attr( $size ),
+				esc_attr( $alt_attribute )
+			);
 		}
+	}
 
-		/**
-		 * Filters a blog's avatar.
-		 *
-		 * @since 1.5.0
-		 *
-		 * @param string $avatar  Formatted HTML <img> element, or raw avatar
-		 *                        URL based on $html arg.
-		 * @param int    $blog_id ID of the blog whose avatar is being displayed.
-		 * @param array  $r       Array of arguments used when fetching avatar.
-		 */
-		return apply_filters( 'bp_get_blog_avatar', $avatar, $blog_id, $r );
+	// Fallback to Default blog avatar.
+	if ( '' === $avatar ) {
+		$avatar = bp_core_fetch_avatar( $r );
 	}
 
+	/**
+	 * Filters a blog's avatar.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $avatar  Formatted HTML <img> element, or raw avatar
+	 *                        URL based on $html arg.
+	 * @param int    $blog_id ID of the blog whose avatar is being displayed.
+	 * @param array  $r       Array of arguments used when fetching avatar.
+	 */
+	return apply_filters( 'bp_get_blog_avatar', $avatar, $blog_id, $r );
+}
+
 function bp_blog_permalink() {
 	echo esc_url( bp_get_blog_permalink() );
 }
-	function bp_get_blog_permalink() {
-		global $blogs_template;
+function bp_get_blog_permalink() {
+	global $blogs_template;
 
-		if ( ! empty( $blogs_template->blog->domain ) ) {
-			$permalink = get_site_url( $blogs_template->blog->blog_id );
+	if ( ! empty( $blogs_template->blog->domain ) ) {
+		$permalink = get_site_url( $blogs_template->blog->blog_id );
 
-		} else {
-			$protocol = 'http://';
-			if ( is_ssl() ) {
-				$protocol = 'https://';
-			}
-
-			$permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
+	} else {
+		$protocol = 'http://';
+		if ( is_ssl() ) {
+			$protocol = 'https://';
 		}
 
-		/**
-		 * Filters the blog permalink.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $permalink Permalink URL for the blog.
-		 */
-		return apply_filters( 'bp_get_blog_permalink', $permalink );
+		$permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
 	}
 
+	/**
+	 * Filters the blog permalink.
+	 *
+	 * @since 1.0.0
+	 *
+	 * @param string $permalink Permalink URL for the blog.
+	 */
+	return apply_filters( 'bp_get_blog_permalink', $permalink );
+}
+
 /**
  * Output the name of the current blog in the loop.
  */
@@ -530,25 +529,25 @@
 	 *
 	 * @return string The name of the current blog in the loop.
 	 */
-	function bp_get_blog_name() {
-		global $blogs_template;
+function bp_get_blog_name() {
+	global $blogs_template;
 
-		$name = '';
+	$name = '';
 
-		if ( ! empty( $blogs_template->blog->name ) ) {
-			$name = $blogs_template->blog->name;
-		}
-
-		/**
-		 * Filters the name of the current blog in the loop.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $name Name of the current blog in the loop.
-		 */
-		return apply_filters( 'bp_get_blog_name', $name );
+	if ( ! empty( $blogs_template->blog->name ) ) {
+		$name = $blogs_template->blog->name;
 	}
 
+	/**
+	 * Filters the name of the current blog in the loop.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $name Name of the current blog in the loop.
+	 */
+	return apply_filters( 'bp_get_blog_name', $name );
+}
+
 /**
  * Output the ID of the current blog in the loop.
  *
@@ -564,18 +563,18 @@
 	 *
 	 * @return int ID of the current blog in the loop.
 	 */
-	function bp_get_blog_id() {
-		global $blogs_template;
+function bp_get_blog_id() {
+	global $blogs_template;
 
-		/**
-		 * Filters the ID of the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param int $blog_id ID of the current blog in the loop.
-		 */
-		return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
-	}
+	/**
+	 * Filters the ID of the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param int $blog_id ID of the current blog in the loop.
+	 */
+	return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
+}
 
 /**
  * Output the description of the current blog in the loop.
@@ -596,18 +595,18 @@
 	 *
 	 * @return string Description of the current blog in the loop.
 	 */
-	function bp_get_blog_description() {
-		global $blogs_template;
+function bp_get_blog_description() {
+	global $blogs_template;
 
-		/**
-		 * Filters the description of the current blog in the loop.
-		 *
-		 * @since 1.0.0
-		 *
-		 * @param string $value Description of the current blog in the loop.
-		 */
-		return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
-	}
+	/**
+	 * Filters the description of the current blog in the loop.
+	 *
+	 * @since 1.0.0
+	 *
+	 * @param string $value Description of the current blog in the loop.
+	 */
+	return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
+}
 
 /**
  * Output the row class of the current blog in the loop.
@@ -630,32 +629,32 @@
 	 * @param array $classes Array of custom classes.
 	 * @return string Row class of the site.
 	 */
-	function bp_get_blog_class( $classes = array() ) {
-		global $blogs_template;
+function bp_get_blog_class( $classes = array() ) {
+	global $blogs_template;
 
-		// Add even/odd classes, but only if there's more than 1 group.
-		if ( $blogs_template->blog_count > 1 ) {
-			$pos_in_loop = (int) $blogs_template->current_blog;
-			$classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
+	// Add even/odd classes, but only if there's more than 1 group.
+	if ( $blogs_template->blog_count > 1 ) {
+		$pos_in_loop = (int) $blogs_template->current_blog;
+		$classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
 
 		// If we've only one site in the loop, don't bother with odd and even.
-		} else {
-			$classes[] = 'bp-single-blog';
-		}
+	} else {
+		$classes[] = 'bp-single-blog';
+	}
 
-		/**
-		 * Filters the row class of the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param array $classes Array of classes to be applied to row.
-		 */
-		$classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) );
-		$classes = array_merge( $classes, array() );
-		$retval  = 'class="' . join( ' ', $classes ) . '"';
+	/**
+	 * Filters the row class of the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param array $classes Array of classes to be applied to row.
+	 */
+	$classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) );
+	$classes = array_merge( $classes, array() );
+	$retval  = 'class="' . join( ' ', $classes ) . '"';
 
-		return $retval;
-	}
+	return $retval;
+}
 
 /**
  * Output the last active date of the current blog in the loop.
@@ -676,47 +675,47 @@
 	 * }
 	 * @return string Last active date.
 	 */
-	function bp_get_blog_last_active( $args = array() ) {
-		global $blogs_template;
+function bp_get_blog_last_active( $args = array() ) {
+	global $blogs_template;
 
-		// Parse the activity format.
-		$r = bp_parse_args(
-			$args,
-			array(
-				'active_format' => true,
-			)
-		);
+	// Parse the activity format.
+	$r = bp_parse_args(
+		$args,
+		array(
+			'active_format' => true,
+		)
+	);
 
-		// Backwards compatibility for anyone forcing a 'true' active_format.
-		if ( true === $r['active_format'] ) {
-			/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
-			$r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' );
-		}
+	// Backwards compatibility for anyone forcing a 'true' active_format.
+	if ( true === $r['active_format'] ) {
+		/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
+		$r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' );
+	}
 
-		// Blog has been posted to at least once.
-		if ( isset( $blogs_template->blog->last_activity ) ) {
+	// Blog has been posted to at least once.
+	if ( isset( $blogs_template->blog->last_activity ) ) {
 
-			// Backwards compatibility for pre 1.5 'ago' strings.
-			$last_activity = ! empty( $r['active_format'] )
-				? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
-				: bp_core_time_since( $blogs_template->blog->last_activity );
+		// Backwards compatibility for pre 1.5 'ago' strings.
+		$last_activity = ! empty( $r['active_format'] )
+			? bp_core_get_last_activity( $blogs_template->blog->last_activity, $r['active_format'] )
+			: bp_core_time_since( $blogs_template->blog->last_activity );
 
 		// Blog has never been posted to.
-		} else {
-			$last_activity = __( 'Never active', 'buddypress' );
-		}
-
-		/**
-		 * Filters the last active date of the current blog in the loop.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param string $last_activity Last active date.
-		 * @param array  $r             Array of parsed args used to determine formatting.
-		 */
-		return apply_filters( 'bp_blog_last_active', $last_activity, $r );
+	} else {
+		$last_activity = __( 'Never active', 'buddypress' );
 	}
 
+	/**
+	 * Filters the last active date of the current blog in the loop.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $last_activity Last active date.
+	 * @param array  $r             Array of parsed args used to determine formatting.
+	 */
+	return apply_filters( 'bp_blog_last_active', $last_activity, $r );
+}
+
 /**
  * Output the latest post from the current blog in the loop.
  *
@@ -743,52 +742,52 @@
 	 * }
 	 * @return string $retval String of the form 'Latest Post: [link to post]'.
 	 */
-	function bp_get_blog_latest_post( $args = array() ) {
-		global $blogs_template;
+function bp_get_blog_latest_post( $args = array() ) {
+	global $blogs_template;
 
-		$r = bp_parse_args(
-			$args,
-			array(
-				'latest_format' => true,
-			)
-		);
+	$r = bp_parse_args(
+		$args,
+		array(
+			'latest_format' => true,
+		)
+	);
 
-		$retval = bp_get_blog_latest_post_title();
+	$retval = bp_get_blog_latest_post_title();
 
-		if ( ! empty( $retval ) ) {
-			if ( ! empty( $r['latest_format'] ) ) {
+	if ( ! empty( $retval ) ) {
+		if ( ! empty( $r['latest_format'] ) ) {
 
-				/**
-				 * Filters the title text of the latest post for the current blog in loop.
-				 *
-				 * @since 1.0.0
-				 *
-				 * @param string $retval Title of the latest post.
-				 */
-				$retval = sprintf(
-					/* translators: %s: the title of the latest post */
-					__( 'Latest Post: %s', 'buddypress' ),
-					'<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'
-				);
-			} else {
+			/**
+			 * Filters the title text of the latest post for the current blog in loop.
+			 *
+			 * @since 1.0.0
+			 *
+			 * @param string $retval Title of the latest post.
+			 */
+			$retval = sprintf(
+				/* translators: %s: the title of the latest post */
+				__( 'Latest Post: %s', 'buddypress' ),
+				'<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>'
+			);
+		} else {
 
-				/** This filter is documented in bp-blogs/bp-blogs-template.php */
-				$retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
-			}
+			/** This filter is documented in bp-blogs/bp-blogs-template.php */
+			$retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
 		}
-
-		/**
-		 * Filters the HTML markup result for the latest blog post in loop.
-		 *
-		 * @since 1.2.0
-		 * @since 2.6.0 Added the `$r` parameter.
-		 *
-		 * @param string $retval HTML markup for the latest post.
-		 * @param array  $r      Array of parsed arguments.
-		 */
-		return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
 	}
 
+	/**
+	 * Filters the HTML markup result for the latest blog post in loop.
+	 *
+	 * @since 1.2.0
+	 * @since 2.6.0 Added the `$r` parameter.
+	 *
+	 * @param string $retval HTML markup for the latest post.
+	 * @param array  $r      Array of parsed arguments.
+	 */
+	return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
+}
+
 /**
  * Output the title of the latest post on the current blog in the loop.
  *
@@ -808,24 +807,25 @@
 	 *
 	 * @return string Post title.
 	 */
-	function bp_get_blog_latest_post_title() {
-		global $blogs_template;
+function bp_get_blog_latest_post_title() {
+	global $blogs_template;
 
-		$retval = '';
+	$retval = '';
 
-		if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) )
-			$retval = $blogs_template->blog->latest_post->post_title;
-
-		/**
-		 * Filters the title text of the latest post on the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param string $retval Title text for the latest post.
-		 */
-		return apply_filters( 'bp_get_blog_latest_post_title', $retval );
+	if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) ) {
+		$retval = $blogs_template->blog->latest_post->post_title;
 	}
 
+	/**
+	 * Filters the title text of the latest post on the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param string $retval Title text for the latest post.
+	 */
+	return apply_filters( 'bp_get_blog_latest_post_title', $retval );
+}
+
 /**
  * Output the permalink of the latest post on the current blog in the loop.
  *
@@ -845,29 +845,29 @@
 	 *
 	 * @return string URL of the blog's latest post.
 	 */
-	function bp_get_blog_latest_post_permalink() {
-		global $blogs_template;
+function bp_get_blog_latest_post_permalink() {
+	global $blogs_template;
 
-		$retval = '';
+	$retval = '';
 
-		if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) )
-			$retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
-
-		/**
-		 * Filters the permalink of the latest post on the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param string $retval Permalink URL of the latest post.
-		 */
-		return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
+	if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) ) {
+		$retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
 	}
 
+	/**
+	 * Filters the permalink of the latest post on the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param string $retval Permalink URL of the latest post.
+	 */
+	return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
+}
+
 /**
  * Output the content of the latest post on the current blog in the loop.
  *
  * @since 1.7.0
- *
  */
 function bp_blog_latest_post_content() {
 	echo wp_kses_post( bp_get_blog_latest_post_content() );
@@ -881,25 +881,25 @@
 	 *
 	 * @return string Content of the blog's latest post.
 	 */
-	function bp_get_blog_latest_post_content() {
-		global $blogs_template;
+function bp_get_blog_latest_post_content() {
+	global $blogs_template;
 
-		$retval = '';
+	$retval = '';
 
-		if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) {
-			$retval = $blogs_template->blog->latest_post->post_content;
-		}
-
-		/**
-		 * Filters the content of the latest post on the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param string $retval Content of the latest post on the current blog in the loop.
-		 */
-		return apply_filters( 'bp_get_blog_latest_post_content', $retval );
+	if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) {
+		$retval = $blogs_template->blog->latest_post->post_content;
 	}
 
+	/**
+	 * Filters the content of the latest post on the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param string $retval Content of the latest post on the current blog in the loop.
+	 */
+	return apply_filters( 'bp_get_blog_latest_post_content', $retval );
+}
+
 /**
  * Output the featured image of the latest post on the current blog in the loop.
  *
@@ -923,25 +923,25 @@
 	 *                     'large', or 'post-thumbnail'. Default: 'thumbnail'.
 	 * @return string URL of the image.
 	 */
-	function bp_get_blog_latest_post_featured_image( $size = 'thumbnail' ) {
-		global $blogs_template;
+function bp_get_blog_latest_post_featured_image( $size = 'thumbnail' ) {
+	global $blogs_template;
 
-		$retval = '';
+	$retval = '';
 
-		if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) ) {
-			$retval = $blogs_template->blog->latest_post->images[$size];
-		}
-
-		/**
-		 * Filters the featured image of the latest post on the current blog in the loop.
-		 *
-		 * @since 1.7.0
-		 *
-		 * @param string $retval The featured image of the latest post on the current blog in the loop.
-		 */
-		return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
+	if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[ $size ] ) ) {
+		$retval = $blogs_template->blog->latest_post->images[ $size ];
 	}
 
+	/**
+	 * Filters the featured image of the latest post on the current blog in the loop.
+	 *
+	 * @since 1.7.0
+	 *
+	 * @param string $retval The featured image of the latest post on the current blog in the loop.
+	 */
+	return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
+}
+
 /**
  * Does the latest blog post have a featured image?
  *
@@ -953,7 +953,7 @@
  *              featured image of the given size.
  */
 function bp_blog_latest_post_has_featured_image( $thumbnail = 'thumbnail' ) {
-	$image  = bp_get_blog_latest_post_featured_image( $thumbnail );
+	$image = bp_get_blog_latest_post_featured_image( $thumbnail );
 
 	/**
 	 * Filters whether or not the latest blog post has a featured image.
@@ -976,7 +976,7 @@
  */
 function bp_blog_hidden_fields() {
 	if ( isset( $_REQUEST['s'] ) ) {
-		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
+		echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ) . '" name="search_terms" />';
 	}
 
 	if ( isset( $_REQUEST['letter'] ) ) {
@@ -999,17 +999,17 @@
 	 *
 	 * @return int Total number of blogs.
 	 */
-	function bp_get_total_blog_count() {
+function bp_get_total_blog_count() {
 
-		/**
-		 * Filters the total number of blogs on the site.
-		 *
-		 * @since 1.2.0
-		 *
-		 * @param int $value Total number of blogs on the site.
-		 */
-		return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
-	}
+	/**
+	 * Filters the total number of blogs on the site.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $value Total number of blogs on the site.
+	 */
+	return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
+}
 	add_filter( 'bp_get_total_blog_count', 'bp_core_number_format' );
 
 /**
@@ -1026,19 +1026,19 @@
 	 * @param int $user_id ID of the user.
 	 * @return int Total number of blogs for the user.
 	 */
-	function bp_get_total_blog_count_for_user( $user_id = 0 ) {
+function bp_get_total_blog_count_for_user( $user_id = 0 ) {
 
-		/**
-		 * Filters the total number of blogs for a given user.
-		 *
-		 * @since 1.2.0
-		 * @since 2.6.0 Added the `$user_id` parameter.
-		 *
-		 * @param int $value   Total number of blogs for a given user.
-		 * @param int $user_id ID of the queried user.
-		 */
-		return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
-	}
+	/**
+	 * Filters the total number of blogs for a given user.
+	 *
+	 * @since 1.2.0
+	 * @since 2.6.0 Added the `$user_id` parameter.
+	 *
+	 * @param int $value   Total number of blogs for a given user.
+	 * @param int $user_id ID of the queried user.
+	 */
+	return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
+}
 	add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
 
 
@@ -1076,7 +1076,14 @@
 		 *      WP_Error $errors     WP_Error object.
 		 * }
 		 */
-		$filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
+		$filtered_results = apply_filters(
+			'signup_another_blog_init',
+			array(
+				'blogname'   => $blogname,
+				'blog_title' => $blog_title,
+				'errors'     => $errors,
+			)
+		);
 		$blogname         = $filtered_results['blogname'];
 		$blog_title       = $filtered_results['blog_title'];
 		$errors           = $filtered_results['errors'];
@@ -1117,7 +1124,8 @@
 			 *
 			 * @since 1.0.0
 			 */
-			do_action( 'signup_hidden_fields' ); ?>
+			do_action( 'signup_hidden_fields' );
+			?>
 
 			<?php bp_blogs_signup_blog( $blogname, $blog_title, $errors ); ?>
 			<p>
@@ -1124,7 +1132,7 @@
 				<input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site', 'buddypress' ); ?>" />
 			</p>
 
-			<?php wp_nonce_field( 'bp_blog_signup_form' ) ?>
+			<?php wp_nonce_field( 'bp_blog_signup_form' ); ?>
 		</form>
 		<?php
 
@@ -1206,7 +1214,7 @@
 	if ( ! is_user_logged_in() ) {
 		$url = sprintf(
 			/* translators: %s is the site domain and path. */
-			__( 'domain.%s' , 'buddypress' ),
+			__( 'domain.%s', 'buddypress' ),
 			$current_site->domain . $current_site->path
 		);
 
@@ -1213,7 +1221,7 @@
 		if ( ! is_subdomain_install() ) {
 			$url = sprintf(
 				/* translators: %s is the site domain and path. */
-				__( '%sblogname' , 'buddypress'),
+				__( '%sblogname', 'buddypress' ),
 				$current_site->domain . $current_site->path
 			);
 		}
@@ -1222,9 +1230,10 @@
 			'<p>(<strong>%1$s.</strong> %2$s)</p>',
 			sprintf(
 				/* translators: %s is the site url. */
-				esc_html__( 'Your address will be %s' , 'buddypress' ), esc_url( $url )
+				esc_html__( 'Your address will be %s', 'buddypress' ),
+				esc_url( $url )
 			),
-			esc_html__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!' , 'buddypress' )
+			esc_html__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!', 'buddypress' )
 		);
 	}
 
@@ -1231,7 +1240,7 @@
 	// Blog Title.
 	?>
 	<p>
-		<label for="blog_title"><?php esc_html_e('Site Title:', 'buddypress') ?></label>
+		<label for="blog_title"><?php esc_html_e( 'Site Title:', 'buddypress' ); ?></label>
 		<input name="blog_title" type="text" id="blog_title" value="<?php echo esc_html( $blog_title ); ?>" />
 
 		<?php
@@ -1243,12 +1252,12 @@
 
 	<fieldset class="create-site">
 
-		<legend class="label"><?php esc_html_e( 'Privacy: I would like my site to appear in search engines, and in public listings around this network', 'buddypress' ) ?></legend>
+		<legend class="label"><?php esc_html_e( 'Privacy: I would like my site to appear in search engines, and in public listings around this network', 'buddypress' ); ?></legend>
 
 		<p>
 			<label class="checkbox" for="blog_public_on">
 				<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php checked( ! isset( $_POST['blog_public'] ) || 1 === (int) $_POST['blog_public'] ); ?> />
-				<strong><?php esc_html_e( 'Yes' , 'buddypress'); ?></strong>
+				<strong><?php esc_html_e( 'Yes', 'buddypress' ); ?></strong>
 			</label>
 		</p>
 
@@ -1255,7 +1264,7 @@
 		<p>
 			<label class="checkbox" for="blog_public_off">
 				<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php checked( isset( $_POST['blog_public'] ) && 0 === (int) $_POST['blog_public'] ); ?> />
-				<strong><?php esc_html_e( 'No' , 'buddypress'); ?></strong>
+				<strong><?php esc_html_e( 'No', 'buddypress' ); ?></strong>
 			</label>
 		</p>
 
@@ -1321,13 +1330,20 @@
 	 *      string $public Default public status.
 	 * }
 	 */
-	$meta = apply_filters( 'add_signup_meta', array( 'lang_id' => 1, 'public' => $public ) );
+	$meta = apply_filters(
+		'add_signup_meta',
+		array(
+			'lang_id' => 1,
+			'public'  => $public,
+		)
+	);
 
 	return wpmu_create_blog(
 		$blog['domain'],
 		$blog['path'],
 		$blog['blog_title'],
-		$current_user->ID, $meta,
+		$current_user->ID,
+		$meta,
 		$current_site->id
 	);
 }
@@ -1427,7 +1443,7 @@
 	}
 
 	$search_form_html = '<form action="" method="get" id="search-blogs-form">
-		<label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
+		<label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="' . esc_attr( $search_value ) . '" /></label>
 		<input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . esc_attr__( 'Search', 'buddypress' ) . '" />
 	</form>';
 
@@ -1462,40 +1478,40 @@
 	 *
 	 * @return false|string
 	 */
-	function bp_get_blog_create_button() {
-		if ( ! is_user_logged_in() ) {
-			return false;
-		}
+function bp_get_blog_create_button() {
+	if ( ! is_user_logged_in() ) {
+		return false;
+	}
 
-		if ( ! bp_blog_signup_enabled() ) {
-			return false;
-		}
+	if ( ! bp_blog_signup_enabled() ) {
+		return false;
+	}
 
-		$url = bp_get_blogs_directory_url(
-			array(
-				'create_single_item' => 1,
-			)
-		);
+	$url = bp_get_blogs_directory_url(
+		array(
+			'create_single_item' => 1,
+		)
+	);
 
-		$button_args = array(
-			'id'         => 'create_blog',
-			'component'  => 'blogs',
-			'link_text'  => __( 'Create a Site', 'buddypress' ),
-			'link_class' => 'blog-create no-ajax',
-			'link_href'  => $url,
-			'wrapper'    => false,
-			'block_self' => false,
-		);
+	$button_args = array(
+		'id'         => 'create_blog',
+		'component'  => 'blogs',
+		'link_text'  => __( 'Create a Site', 'buddypress' ),
+		'link_class' => 'blog-create no-ajax',
+		'link_href'  => $url,
+		'wrapper'    => false,
+		'block_self' => false,
+	);
 
-		/**
-		 * Filters the Create a Site button.
-		 *
-		 * @since 2.0.0
-		 *
-		 * @param array $button_args Array of arguments to be used for the Create a Site button.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
-	}
+	/**
+	 * Filters the Create a Site button.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $button_args Array of arguments to be used for the Create a Site button.
+	 */
+	return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
+}
 
 /**
  * Output the Create a Site nav item.
@@ -1515,26 +1531,26 @@
 	 *
 	 * @return string
 	 */
-	function bp_get_blog_create_nav_item() {
-		// Get the create a site button.
-		$create_blog_button = bp_get_blog_create_button();
+function bp_get_blog_create_nav_item() {
+	// Get the create a site button.
+	$create_blog_button = bp_get_blog_create_button();
 
-		// Make sure the button is available.
-		if ( empty( $create_blog_button ) ) {
-			return;
-		}
+	// Make sure the button is available.
+	if ( empty( $create_blog_button ) ) {
+		return;
+	}
 
-		$output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
+	$output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
 
-		/**
-		 * Filters the Create A Site nav item output.
-		 *
-		 * @since 2.2.0
-		 *
-		 * @param string $output Nav item output.
-		 */
-		return apply_filters( 'bp_get_blog_create_nav_item', $output );
-	}
+	/**
+	 * Filters the Create A Site nav item output.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $output Nav item output.
+	 */
+	return apply_filters( 'bp_get_blog_create_nav_item', $output );
+}
 
 /**
  * Checks if a specific theme is still filtering the Blogs directory title
@@ -1593,31 +1609,31 @@
 	 * }
 	 * @return array Thhe arguments of the button for visiting a blog in a loop.
 	 */
-	function bp_get_blogs_visit_blog_button_args( $args = '' ) {
-		$button_args = bp_parse_args(
-			$args,
-			array(
-				'id'                => 'visit_blog',
-				'component'         => 'blogs',
-				'must_be_logged_in' => false,
-				'block_self'        => false,
-				'wrapper_class'     => 'blog-button visit',
-				'link_href'         => bp_get_blog_permalink(),
-				'link_class'        => 'blog-button visit',
-				'link_text'         => __( 'Visit Site', 'buddypress' ),
-				'link_title'        => __( 'Visit Site', 'buddypress' ),
-			)
-		);
+function bp_get_blogs_visit_blog_button_args( $args = '' ) {
+	$button_args = bp_parse_args(
+		$args,
+		array(
+			'id'                => 'visit_blog',
+			'component'         => 'blogs',
+			'must_be_logged_in' => false,
+			'block_self'        => false,
+			'wrapper_class'     => 'blog-button visit',
+			'link_href'         => bp_get_blog_permalink(),
+			'link_class'        => 'blog-button visit',
+			'link_text'         => __( 'Visit Site', 'buddypress' ),
+			'link_title'        => __( 'Visit Site', 'buddypress' ),
+		)
+	);
 
-		/**
-		 * Filters the button for visiting a blog in a loop.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param array $button_args Array of arguments to be used for the button to visit a blog.
-		 */
-		return (array) apply_filters( 'bp_get_blogs_visit_blog_button', $button_args );
-	}
+	/**
+	 * Filters the button for visiting a blog in a loop.
+	 *
+	 * @since 1.2.10
+	 *
+	 * @param array $button_args Array of arguments to be used for the button to visit a blog.
+	 */
+	return (array) apply_filters( 'bp_get_blogs_visit_blog_button', $button_args );
+}
 
 	/**
 	 * Return button for visiting a blog in a loop.
@@ -1630,16 +1646,16 @@
 	 * @param array|string $args See {@link bp_get_blogs_visit_blog_button_args()}.
 	 * @return string The HTML for the Visit button.
 	 */
-	function bp_get_blogs_visit_blog_button( $args = '' ) {
-		$button_args = bp_get_blogs_visit_blog_button_args( $args );
+function bp_get_blogs_visit_blog_button( $args = '' ) {
+	$button_args = bp_get_blogs_visit_blog_button_args( $args );
 
-		if ( ! array_filter( $button_args ) ) {
-			return '';
-		}
-
-		return bp_get_button( $button_args );
+	if ( ! array_filter( $button_args ) ) {
+		return '';
 	}
 
+	return bp_get_button( $button_args );
+}
+
 /** Stats **********************************************************************/
 
 /**
