Index: /trunk/bp-core/bp-core-classes.php
===================================================================
--- /trunk/bp-core/bp-core-classes.php	(revision 5707)
+++ /trunk/bp-core/bp-core-classes.php	(revision 5708)
@@ -109,12 +109,5 @@
 	var $total_groups;
 
-	/**
-	 * PHP4 constructor.
-	 *
-	 * @see BP_Core_User::__construct()
-	 */
-	function bp_core_user( $user_id, $populate_extras = false ) {
-		$this->__construct( $user_id, $populate_extras );
-	}
+	/** Public Method*s *******************************************************/
 
 	/**
@@ -124,13 +117,16 @@
 	 * @param boolean $populate_extras Whether to fetch extra information such as group/friendship counts or not.
 	 */
-	function __construct( $user_id, $populate_extras = false ) {
-		if ( $user_id ) {
+	public function __construct( $user_id, $populate_extras = false ) {
+		if ( !empty( $user_id ) ) {
 			$this->id = $user_id;
 			$this->populate();
 
-			if ( $populate_extras )
+			if ( !empty( $populate_extras ) ) {
 				$this->populate_extras();
-		}
-	}
+			}
+		}
+	}
+
+	/** Private Methods *******************************************************/
 
 	/**
@@ -144,5 +140,5 @@
 	 * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
 	 */
-	function populate() {
+	private function populate() {
 
 		if ( bp_is_active( 'xprofile' ) )
@@ -177,5 +173,5 @@
 	 * Populates extra fields such as group and friendship counts.
 	 */
-	function populate_extras() {
+	private function populate_extras() {
 
 		if ( bp_is_active( 'friends' ) ) {
@@ -189,11 +185,11 @@
 	}
 
-	function get_profile_data() {
+	private function get_profile_data() {
 		return BP_XProfile_ProfileData::get_all_for_user( $this->id );
 	}
 
-	/** Static Functions ******************************************************/
-
-	function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
+	/** Static Methods ********************************************************/
+
+	public static function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
 		global $wpdb, $bp;
 
@@ -222,5 +218,5 @@
 		}
 
-		$sql['from'] = "FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON um.user_id = u.ID";
+		$sql['from'] = "FROM {$wpdb->users} u LEFT JOIN {$wpdb->usermeta} um ON um.user_id = u.ID";
 
 		// We search against xprofile fields, so we must join the table
@@ -260,5 +256,5 @@
 		}
 
-		if ( $include ) {
+		if ( !empty( $include ) ) {
 			if ( is_array( $include ) ) {
 				$uids = $wpdb->escape( implode( ',', (array)$include ) );
@@ -270,5 +266,5 @@
 				$sql['where_users'] = "AND u.ID IN ({$uids})";
 			}
-		} elseif ( $user_id && bp_is_active( 'friends' ) ) {
+		} elseif ( !empty( $user_id ) && bp_is_active( 'friends' ) ) {
 			$friend_ids = friends_get_friend_user_ids( $user_id );
 			$friend_ids = $wpdb->escape( implode( ',', (array)$friend_ids ) );
@@ -283,10 +279,10 @@
 		}
 
-		if ( $search_terms && bp_is_active( 'xprofile' ) ) {
+		if ( !empty( $search_terms ) && bp_is_active( 'xprofile' ) ) {
 			$search_terms             = like_escape( $wpdb->escape( $search_terms ) );
 			$sql['where_searchterms'] = "AND spd.value LIKE '%%$search_terms%%'";
 		}
 
-		if ( $meta_key ) {
+		if ( !empty( $meta_key ) ) {
 			$sql['where_meta'] = $wpdb->prepare( " AND umm.meta_key = %s", $meta_key );
 
@@ -315,5 +311,5 @@
 		}
 
-		if ( $limit && $page ) {
+		if ( !empty( $limit ) && !empty( $page ) ) {
 			$sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
 		}
@@ -382,5 +378,5 @@
 	 * @static
 	 */
-	function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
+	public static function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
 		global $bp, $wpdb;
 
@@ -444,5 +440,5 @@
 	 * @static
 	 */
-	function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
+	public static function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
 		global $wpdb;
 
@@ -489,5 +485,5 @@
 	 * @static
 	 */
-	function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
+	public static function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
 		global $bp, $wpdb;
 
@@ -532,5 +528,5 @@
 	 * @static
 	 */
-	function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
+	public static function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
 		global $bp, $wpdb;
 
@@ -612,5 +608,5 @@
 	 * @static
 	 */
-	function get_core_userdata( $user_id ) {
+	public static function get_core_userdata( $user_id ) {
 		global $wpdb;
 
@@ -688,21 +684,13 @@
 	var $is_new;
 
-
-	/**
-	 * PHP4 constructor
+	/** Public Methods ********************************************************/
+
+	/**
+	 * Constructor
 	 *
 	 * @param integer $id
 	 */
-	function bp_core_notification( $id = 0 ) {
-		$this->__construct($id);
-	}
-
-	/**
-	 * Constructor
-	 *
-	 * @param integer $id
-	 */
-	function __construct( $id = 0 ) {
-		if ( $id ) {
+	public function __construct( $id = 0 ) {
+		if ( !empty( $id ) ) {
 			$this->id = $id;
 			$this->populate();
@@ -711,10 +699,39 @@
 
 	/**
-	 * Fetches the notification data from the database.
+	 * Update or insert notification details into the database.
 	 *
 	 * @global object $bp Global BuddyPress settings object
 	 * @global wpdb $wpdb WordPress database object
-	 */
-	function populate() {
+	 * @return bool Success or failure
+	 */
+	public function save() {
+		global $bp, $wpdb;
+
+		// Update
+		if ( !empty( $this->id ) ) {
+			$sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = %s, is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
+
+		// Save
+		} else {
+			$sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, %s, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
+		}
+
+		if ( !$result = $wpdb->query( $sql ) )
+			return false;
+
+		$this->id = $wpdb->insert_id;
+
+		return true;
+	}
+
+	/** Private Methods *******************************************************/
+
+	/**
+	 * Fetches the notification data from the database.
+	 *
+	 * @global object $bp Global BuddyPress settings object
+	 * @global wpdb $wpdb WordPress database object
+	 */
+	private function populate() {
 		global $bp, $wpdb;
 
@@ -730,32 +747,7 @@
 	}
 
-	/**
-	 * Update or insert notification details into the database.
-	 *
-	 * @global object $bp Global BuddyPress settings object
-	 * @global wpdb $wpdb WordPress database object
-	 * @return bool Success or failure
-	 */
-	function save() {
-		global $bp, $wpdb;
-
-		// Update
-		if ( $this->id )
-			$sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = %s, is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
-
-		// Save
-		else
-			$sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, %s, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
-
-		if ( !$result = $wpdb->query( $sql ) )
-			return false;
-
-		$this->id = $wpdb->insert_id;
-		return true;
-	}
-
-	/** Static functions ******************************************************/
-
-	function check_access( $user_id, $notification_id ) {
+	/** Static Methods ********************************************************/
+
+	public static function check_access( $user_id, $notification_id ) {
 		global $wpdb, $bp;
 
@@ -773,5 +765,5 @@
 	 * @static
 	 */
-	function get_all_for_user( $user_id, $status = 'is_new' ) {
+	public static function get_all_for_user( $user_id, $status = 'is_new' ) {
 		global $bp, $wpdb;
 
@@ -791,5 +783,5 @@
 	 * @static
 	 */
-	function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
+	public static function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
 		global $bp, $wpdb;
 
@@ -809,5 +801,5 @@
 	 * @static
 	 */
-	function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
+	public static function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
 		global $bp, $wpdb;
 
@@ -827,5 +819,5 @@
 	 * @static
 	 */
-	function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
+	public static function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
 		global $bp, $wpdb;
 
@@ -844,5 +836,5 @@
 	 * @static
 	 */
-	function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
+	public static function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
 		global $bp, $wpdb;
 
@@ -996,9 +988,5 @@
 	 * @return bool False if not allowed
 	 */
-	function bp_button( $args = '' ) {
-		$this->__construct($args);
-	}
-
-	function __construct( $args = '' ) {
+	public function __construct( $args = '' ) {
 
 		// Default arguments
@@ -1104,5 +1092,5 @@
 	 * @return string
 	 */
-	function contents() {
+	public function contents() {
 		return $this->contents;
 	}
@@ -1113,5 +1101,5 @@
 	 * Output contents of button
 	 */
-	function display() {
+	public function display() {
 		if ( !empty( $this->contents ) )
 			echo $this->contents;
@@ -1129,4 +1117,5 @@
  */
 class BP_Embed extends WP_Embed {
+
 	/**
 	 * Constructor
@@ -1134,5 +1123,5 @@
 	 * @global unknown $wp_embed
 	 */
-	function __construct() {
+	public function __construct() {
 		global $wp_embed;
 
@@ -1183,5 +1172,5 @@
 	 * @return string The embed HTML on success, otherwise the original URL.
 	 */
-	function shortcode( $attr, $url = '' ) {
+	public function shortcode( $attr, $url = '' ) {
 		if ( empty( $url ) )
 			return '';
@@ -1248,5 +1237,5 @@
 	 * @return string The embed HTML on success, otherwise the original URL.
 	 */
-	function parse_oembed( $id, $url, $attr, $rawattr ) {
+	public function parse_oembed( $id, $url, $attr, $rawattr ) {
 		$id = intval( $id );
 
@@ -1281,3 +1270,4 @@
 	}
 }
+
 ?>
