Index: trunk/src/bp-core/bp-core-classes.php
===================================================================
--- trunk/src/bp-core/bp-core-classes.php	(revision 9351)
+++ trunk/src/bp-core/bp-core-classes.php	(revision 9404)
@@ -2759,119 +2759,118 @@
 abstract class BP_Recursive_Query {
 
-        /**
-         * Query arguments passed to the constructor.
-         *
-         * @since BuddyPress (2.2.0)
-         * @access public
-         * @var array
-         */
-        public $queries = array();
-
-        /**
-         * Generate SQL clauses to be appended to a main query.
-         *
-         * Extending classes should call this method from within a publicly
-         * accessible get_sql() method, and manipulate the SQL as necessary.
-         * For example, {@link BP_XProfile_Query::get_sql()} is merely a wrapper for
-         * get_sql_clauses(), while {@link BP_Activity_Query::get_sql()} discards
-         * the empty 'join' clause, and only passes the 'where' clause.
-         *
-         * @since BuddyPress (2.2.0)
-         * @access protected
-         *
-         * @param  string $primary_table
-         * @param  string $primary_id_column
-         * @return array
-         */
-        protected function get_sql_clauses() {
-                $sql = $this->get_sql_for_query( $this->queries );
-
-                if ( ! empty( $sql['where'] ) ) {
-                        $sql['where'] = ' AND ' . "\n" . $sql['where'] . "\n";
-                }
-
-                return $sql;
-        }
-
-        /**
-         * Generate SQL clauses for a single query array.
-         *
-         * If nested subqueries are found, this method recurses the tree to
-         * produce the properly nested SQL.
-         *
-         * Subclasses generally do not need to call this method. It is invoked
-         * automatically from get_sql_clauses().
-         *
-         * @since BuddyPress (2.2.0)
-         * @access protected
-         *
-         * @param  array $query Query to parse.
-         * @param  int   $depth Optional. Number of tree levels deep we
-         *                      currently are. Used to calculate indentation.
-         * @return array
-         */
-        protected function get_sql_for_query( $query, $depth = 0 ) {
-                $sql_chunks = array(
-                        'join'  => array(),
-                        'where' => array(),
-                );
-
-                $sql = array(
-                        'join'  => '',
-                        'where' => '',
-                );
-
-                $indent = '';
-                for ( $i = 0; $i < $depth; $i++ ) {
-                        $indent .= "\t";
-                }
-
-                foreach ( $query as $key => $clause ) {
-                        if ( 'relation' === $key ) {
-                                $relation = $query['relation'];
-                        } elseif ( is_array( $clause ) ) {
-                                // This is a first-order clause
-                                if ( $this->is_first_order_clause( $clause ) ) {
-                                        $clause_sql = $this->get_sql_for_clause( $clause, $query );
-
-                                        $where_count = count( $clause_sql['where'] );
-                                        if ( ! $where_count ) {
-                                                $sql_chunks['where'][] = '';
-                                        } elseif ( 1 === $where_count ) {
-                                                $sql_chunks['where'][] = $clause_sql['where'][0];
-                                        } else {
-                                                $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
-                                        }
-
-                                        $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
-                                // This is a subquery
-                                } else {
-                                        $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
-
-                                        $sql_chunks['where'][] = $clause_sql['where'];
-                                        $sql_chunks['join'][]  = $clause_sql['join'];
-
-                                }
-                        }
-                }
-
-                // Filter empties
-                $sql_chunks['join']  = array_filter( $sql_chunks['join'] );
-                $sql_chunks['where'] = array_filter( $sql_chunks['where'] );
-
-                if ( empty( $relation ) ) {
-                        $relation = 'AND';
-                }
-
-                if ( ! empty( $sql_chunks['join'] ) ) {
-                        $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
-                }
-
-                if ( ! empty( $sql_chunks['where'] ) ) {
-                        $sql['where'] = '( ' . "\n\t" . $indent . implode( ' ' . "\n\t" . $indent . $relation . ' ' . "\n\t" . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')' . "\n";
-                }
-
-                return $sql;
-        }
+	/**
+	 * Query arguments passed to the constructor.
+	 *
+	 * @since BuddyPress (2.2.0)
+	 * @access public
+	 * @var array
+	 */
+	public $queries = array();
+
+	/**
+	 * Generate SQL clauses to be appended to a main query.
+	 *
+	 * Extending classes should call this method from within a publicly
+	 * accessible get_sql() method, and manipulate the SQL as necessary.
+	 * For example, {@link BP_XProfile_Query::get_sql()} is merely a wrapper for
+	 * get_sql_clauses(), while {@link BP_Activity_Query::get_sql()} discards
+	 * the empty 'join' clause, and only passes the 'where' clause.
+	 *
+	 * @since BuddyPress (2.2.0)
+	 * @access protected
+	 *
+	 * @param  string $primary_table
+	 * @param  string $primary_id_column
+	 * @return array
+	 */
+	protected function get_sql_clauses() {
+		$sql = $this->get_sql_for_query( $this->queries );
+
+		if ( ! empty( $sql['where'] ) ) {
+			$sql['where'] = ' AND ' . "\n" . $sql['where'] . "\n";
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL clauses for a single query array.
+	 *
+	 * If nested subqueries are found, this method recurses the tree to
+	 * produce the properly nested SQL.
+	 *
+	 * Subclasses generally do not need to call this method. It is invoked
+	 * automatically from get_sql_clauses().
+	 *
+	 * @since BuddyPress (2.2.0)
+	 * @access protected
+	 *
+	 * @param  array $query Query to parse.
+	 * @param  int   $depth Optional. Number of tree levels deep we
+	 *                      currently are. Used to calculate indentation.
+	 * @return array
+	 */
+	protected function get_sql_for_query( $query, $depth = 0 ) {
+		$sql_chunks = array(
+			'join'  => array(),
+			'where' => array(),
+		);
+
+		$sql = array(
+			'join'  => '',
+			'where' => '',
+		);
+
+		$indent = '';
+		for ( $i = 0; $i < $depth; $i++ ) {
+			$indent .= "\t";
+		}
+
+		foreach ( $query as $key => $clause ) {
+			if ( 'relation' === $key ) {
+				$relation = $query['relation'];
+			} elseif ( is_array( $clause ) ) {
+				// This is a first-order clause
+				if ( $this->is_first_order_clause( $clause ) ) {
+					$clause_sql = $this->get_sql_for_clause( $clause, $query );
+
+					$where_count = count( $clause_sql['where'] );
+					if ( ! $where_count ) {
+						$sql_chunks['where'][] = '';
+					} elseif ( 1 === $where_count ) {
+						$sql_chunks['where'][] = $clause_sql['where'][0];
+					} else {
+						$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
+					}
+
+					$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
+				// This is a subquery
+				} else {
+					$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
+
+					$sql_chunks['where'][] = $clause_sql['where'];
+					$sql_chunks['join'][]  = $clause_sql['join'];
+				}
+			}
+		}
+
+		// Filter empties
+		$sql_chunks['join']  = array_filter( $sql_chunks['join'] );
+		$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
+
+		if ( empty( $relation ) ) {
+			$relation = 'AND';
+		}
+
+		if ( ! empty( $sql_chunks['join'] ) ) {
+			$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
+		}
+
+		if ( ! empty( $sql_chunks['where'] ) ) {
+			$sql['where'] = '( ' . "\n\t" . $indent . implode( ' ' . "\n\t" . $indent . $relation . ' ' . "\n\t" . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')' . "\n";
+		}
+
+		return $sql;
+	}
 
 	/**
@@ -2946,32 +2945,32 @@
 	}
 
-        /**
-         * Generate JOIN and WHERE clauses for a first-order clause.
-         *
-         * Must be overridden in a subclass.
-         *
-         * @since BuddyPress (2.2.0)
-         * @access protected
-         *
-         * @param  array $clause       Array of arguments belonging to the clause.
-         * @param  array $parent_query Parent query to which the clause belongs.
-         * @return array {
-         *     @type array $join  Array of subclauses for the JOIN statement.
-         *     @type array $where Array of subclauses for the WHERE statement.
-         * }
-         */
-        abstract protected function get_sql_for_clause( $clause, $parent_query );
-
-        /**
-         * Determine whether a clause is first-order.
-         *
-         * Must be overridden in a subclass.
-         *
-         * @since BuddyPress (2.2.0)
-         * @access protected
-         *
-         * @param  array $q Clause to check.
-         * @return bool
-         */
-        abstract protected function is_first_order_clause( $query );
+	/**
+	 * Generate JOIN and WHERE clauses for a first-order clause.
+	 *
+	 * Must be overridden in a subclass.
+	 *
+	 * @since BuddyPress (2.2.0)
+	 * @access protected
+	 *
+	 * @param  array $clause       Array of arguments belonging to the clause.
+	 * @param  array $parent_query Parent query to which the clause belongs.
+	 * @return array {
+	 *     @type array $join  Array of subclauses for the JOIN statement.
+	 *     @type array $where Array of subclauses for the WHERE statement.
+	 * }
+	 */
+	abstract protected function get_sql_for_clause( $clause, $parent_query );
+
+	/**
+	 * Determine whether a clause is first-order.
+	 *
+	 * Must be overridden in a subclass.
+	 *
+	 * @since BuddyPress (2.2.0)
+	 * @access protected
+	 *
+	 * @param  array $q Clause to check.
+	 * @return bool
+	 */
+	abstract protected function is_first_order_clause( $query );
 }
