Changeset 7308
- Timestamp:
- 07/25/2013 02:28:28 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-classes.php
r7228 r7308 26 26 var $is_spam; 27 27 28 function __construct( $id = false ) {28 public function __construct( $id = false ) { 29 29 if ( !empty( $id ) ) { 30 30 $this->id = $id; … … 33 33 } 34 34 35 function populate() {35 public function populate() { 36 36 global $wpdb, $bp; 37 37 … … 56 56 } 57 57 58 function save() {59 global $wpdb, $bp , $current_user;58 public function save() { 59 global $wpdb, $bp; 60 60 61 61 $this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) ); … … 113 113 * @return array 114 114 */ 115 function get( $args = array() ) {115 public static function get( $args = array() ) { 116 116 global $wpdb, $bp; 117 117 … … 350 350 * @since BuddyPress (1.2) 351 351 */ 352 function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {352 public static function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) { 353 353 _deprecated_function( __FUNCTION__, '1.5', 'Use BP_Activity_Activity::get() with the "in" parameter instead.' ); 354 354 return BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids ); 355 355 } 356 356 357 function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {357 public static function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) { 358 358 global $bp, $wpdb; 359 359 … … 392 392 } 393 393 394 function delete( $args) {394 public static function delete( $args = array() ) { 395 395 global $wpdb, $bp; 396 396 … … 467 467 } 468 468 469 function delete_activity_item_comments( $activity_ids = array() ) {469 public static function delete_activity_item_comments( $activity_ids = array() ) { 470 470 global $bp, $wpdb; 471 471 … … 475 475 } 476 476 477 function delete_activity_meta_entries( $activity_ids = array() ) {477 public static function delete_activity_meta_entries( $activity_ids = array() ) { 478 478 global $bp, $wpdb; 479 479 … … 496 496 * @since BuddyPress (1.2) 497 497 */ 498 function append_comments( $activities, $spam = 'ham_only' ) { 499 global $wpdb; 500 498 public static function append_comments( $activities, $spam = 'ham_only' ) { 501 499 $activity_comments = array(); 502 500 … … 528 526 * @since BuddyPress (1.2) 529 527 */ 530 function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {528 public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) { 531 529 global $wpdb, $bp; 532 530 … … 585 583 } 586 584 587 function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {585 public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) { 588 586 global $wpdb, $bp; 589 587 … … 609 607 } 610 608 611 function get_child_comments( $parent_id ) {609 public static function get_child_comments( $parent_id ) { 612 610 global $bp, $wpdb; 613 611 … … 620 618 * @return array 621 619 */ 622 function get_recorded_components() {620 public static function get_recorded_components() { 623 621 global $wpdb, $bp; 624 622 return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ); 625 623 } 626 624 627 function get_sitewide_items_for_feed( $limit = 35 ) { 628 global $bp; 629 625 public static function get_sitewide_items_for_feed( $limit = 35 ) { 630 626 $activities = bp_activity_get_sitewide( array( 'max' => $limit ) ); 631 627 $activity_feed = array(); … … 642 638 } 643 639 644 function get_in_operator_sql( $field, $items ) {640 public static function get_in_operator_sql( $field, $items ) { 645 641 global $wpdb; 646 642 … … 666 662 } 667 663 668 function get_filter_sql( $filter_array ) {664 public static function get_filter_sql( $filter_array ) { 669 665 670 666 $filter_sql = array(); … … 706 702 } 707 703 708 function get_last_updated() {704 public static function get_last_updated() { 709 705 global $bp, $wpdb; 710 706 … … 712 708 } 713 709 714 function total_favorite_count( $user_id ) {710 public static function total_favorite_count( $user_id ) { 715 711 if ( !$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ) ) 716 712 return 0; … … 719 715 } 720 716 721 function check_exists_by_content( $content ) {717 public static function check_exists_by_content( $content ) { 722 718 global $wpdb, $bp; 723 719 … … 725 721 } 726 722 727 function hide_all_for_user( $user_id ) {723 public static function hide_all_for_user( $user_id ) { 728 724 global $wpdb, $bp; 729 725 -
trunk/bp-core/bp-core-classes.php
r7298 r7308 626 626 * @var integer 627 627 */ 628 var$id;628 public $id; 629 629 630 630 /** … … 633 633 * @var string 634 634 */ 635 var$avatar;635 public $avatar; 636 636 637 637 /** … … 640 640 * @var string 641 641 */ 642 var$avatar_thumb;642 public $avatar_thumb; 643 643 644 644 /** … … 647 647 * @var string 648 648 */ 649 var$avatar_mini;649 public $avatar_mini; 650 650 651 651 /** … … 654 654 * @var string 655 655 */ 656 var$fullname;656 public $fullname; 657 657 658 658 /** … … 661 661 * @var string 662 662 */ 663 var$email;663 public $email; 664 664 665 665 /** … … 668 668 * @var string 669 669 */ 670 var$user_url;670 public $user_url; 671 671 672 672 /** … … 675 675 * @var string 676 676 */ 677 var$user_link;677 public $user_link; 678 678 679 679 /** … … 684 684 * @var string 685 685 */ 686 var$last_active;686 public $last_active; 687 687 688 688 /* Extras */ … … 693 693 * @var integer 694 694 */ 695 var$total_friends;695 public $total_friends; 696 696 697 697 /** … … 701 701 * @deprecated No longer used 702 702 */ 703 var$total_blogs;703 public $total_blogs; 704 704 705 705 /** … … 710 710 * @var string 711 711 */ 712 var$total_groups;712 public $total_groups; 713 713 714 714 /** … … 728 728 * @param boolean $populate_extras Whether to fetch extra information such as group/friendship counts or not. 729 729 */ 730 function __construct( $user_id, $populate_extras = false ) {730 public function __construct( $user_id, $populate_extras = false ) { 731 731 if ( !empty( $user_id ) ) { 732 732 $this->id = $user_id; … … 751 751 * @uses bp_profile_last_updated_date() Returns the last updated date for a user. 752 752 */ 753 function populate() {753 private function populate() { 754 754 755 755 if ( bp_is_active( 'xprofile' ) ) … … 784 784 * Populates extra fields such as group and friendship counts. 785 785 */ 786 function populate_extras() {786 private function populate_extras() { 787 787 788 788 if ( bp_is_active( 'friends' ) ) { … … 796 796 } 797 797 798 function get_profile_data() {798 private function get_profile_data() { 799 799 return BP_XProfile_ProfileData::get_all_for_user( $this->id ); 800 800 } … … 802 802 /** Static Methods ********************************************************/ 803 803 804 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 ) {804 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 ) { 805 805 global $wpdb, $bp; 806 806 … … 989 989 * @static 990 990 */ 991 function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {991 public static function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) { 992 992 global $bp, $wpdb; 993 993 … … 1054 1054 * @static 1055 1055 */ 1056 function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {1056 public static function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) { 1057 1057 global $wpdb; 1058 1058 … … 1098 1098 * @static 1099 1099 */ 1100 function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {1100 public static function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) { 1101 1101 global $bp, $wpdb; 1102 1102 … … 1140 1140 * @static 1141 1141 */ 1142 function get_user_extras( &$paged_users, &$user_ids, $type = false ) {1142 public static function get_user_extras( &$paged_users, &$user_ids, $type = false ) { 1143 1143 global $bp, $wpdb; 1144 1144 … … 1223 1223 * @static 1224 1224 */ 1225 function get_core_userdata( $user_id ) {1225 public static function get_core_userdata( $user_id ) { 1226 1226 global $wpdb; 1227 1227 … … 1248 1248 * @var integer 1249 1249 */ 1250 var$id;1250 public $id; 1251 1251 1252 1252 /** … … 1255 1255 * @var integer 1256 1256 */ 1257 var$item_id;1257 public $item_id; 1258 1258 1259 1259 /** … … 1262 1262 * @var integer 1263 1263 */ 1264 var$secondary_item_id = null;1264 public $secondary_item_id = null; 1265 1265 1266 1266 /** … … 1269 1269 * @var integer 1270 1270 */ 1271 var$user_id;1271 public $user_id; 1272 1272 1273 1273 /** … … 1276 1276 * @var string 1277 1277 */ 1278 var$component_name;1278 public $component_name; 1279 1279 1280 1280 /** … … 1283 1283 * @var string 1284 1284 */ 1285 var$component_action;1285 public $component_action; 1286 1286 1287 1287 /** … … 1290 1290 * @var string 1291 1291 */ 1292 var$date_notified;1292 public $date_notified; 1293 1293 1294 1294 /** … … 1297 1297 * @var boolean 1298 1298 */ 1299 var$is_new;1299 public $is_new; 1300 1300 1301 1301 /** Public Methods ********************************************************/ … … 1306 1306 * @param integer $id 1307 1307 */ 1308 function __construct( $id = 0 ) {1308 public function __construct( $id = 0 ) { 1309 1309 if ( !empty( $id ) ) { 1310 1310 $this->id = $id; … … 1320 1320 * @return bool Success or failure 1321 1321 */ 1322 function save() {1322 public function save() { 1323 1323 global $bp, $wpdb; 1324 1324 … … 1348 1348 * @global wpdb $wpdb WordPress database object 1349 1349 */ 1350 function populate() {1350 private function populate() { 1351 1351 global $bp, $wpdb; 1352 1352 … … 1364 1364 /** Static Methods ********************************************************/ 1365 1365 1366 function check_access( $user_id, $notification_id ) {1366 public static function check_access( $user_id, $notification_id ) { 1367 1367 global $wpdb, $bp; 1368 1368 … … 1380 1380 * @static 1381 1381 */ 1382 function get_all_for_user( $user_id, $status = 'is_new' ) {1382 public static function get_all_for_user( $user_id, $status = 'is_new' ) { 1383 1383 global $bp, $wpdb; 1384 1384 … … 1398 1398 * @static 1399 1399 */ 1400 function delete_for_user_by_type( $user_id, $component_name, $component_action ) {1400 public static function delete_for_user_by_type( $user_id, $component_name, $component_action ) { 1401 1401 global $bp, $wpdb; 1402 1402 … … 1416 1416 * @static 1417 1417 */ 1418 function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {1418 public static function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) { 1419 1419 global $bp, $wpdb; 1420 1420 … … 1434 1434 * @static 1435 1435 */ 1436 function delete_from_user_by_type( $user_id, $component_name, $component_action ) {1436 public static function delete_from_user_by_type( $user_id, $component_name, $component_action ) { 1437 1437 global $bp, $wpdb; 1438 1438 … … 1451 1451 * @static 1452 1452 */ 1453 function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {1453 public static function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) { 1454 1454 global $bp, $wpdb; 1455 1455 … … 1713 1713 * @global unknown $wp_embed 1714 1714 */ 1715 function __construct() {1715 public function __construct() { 1716 1716 global $wp_embed; 1717 1717 … … 1762 1762 * @return string The embed HTML on success, otherwise the original URL. 1763 1763 */ 1764 function shortcode( $attr, $url = '' ) {1764 public function shortcode( $attr, $url = '' ) { 1765 1765 if ( empty( $url ) ) 1766 1766 return ''; … … 1827 1827 * @return string The embed HTML on success, otherwise the original URL. 1828 1828 */ 1829 function parse_oembed( $id, $url, $attr, $rawattr ) {1829 public function parse_oembed( $id, $url, $attr, $rawattr ) { 1830 1830 $id = intval( $id ); 1831 1831 … … 1895 1895 * @since BuddyPress (1.7) 1896 1896 */ 1897 function walk( $elements, $max_depth ) {1897 public function walk( $elements, $max_depth ) { 1898 1898 $args = array_slice( func_get_args(), 2 ); 1899 1899 $output = ''; … … 1982 1982 * @since BuddyPress (1.7) 1983 1983 */ 1984 function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {1984 public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { 1985 1985 // If we're someway down the tree, indent the HTML with the appropriate number of tabs 1986 1986 $indent = $depth ? str_repeat( "\t", $depth ) : ''; -
trunk/bp-friends/bp-friends-classes.php
r7298 r7308 11 11 12 12 class BP_Friends_Friendship { 13 var$id;14 var$initiator_user_id;15 var$friend_user_id;16 var$is_confirmed;17 var$is_limited;18 var$date_created;19 20 var$is_request;21 var$populate_friend_details;22 23 var$friend;24 25 function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {13 public $id; 14 public $initiator_user_id; 15 public $friend_user_id; 16 public $is_confirmed; 17 public $is_limited; 18 public $date_created; 19 20 public $is_request; 21 public $populate_friend_details; 22 23 public $friend; 24 25 public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) { 26 26 $this->is_request = $is_request; 27 27 … … 33 33 } 34 34 35 function populate() {35 public function populate() { 36 36 global $wpdb, $bp; 37 37 … … 53 53 } 54 54 55 function save() {55 public function save() { 56 56 global $wpdb, $bp; 57 57 … … 79 79 } 80 80 81 function delete() { 82 global $wpdb, $bp; 83 81 public function delete() { 82 global $wpdb, $bp; 84 83 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ); 85 84 } … … 87 86 /** Static Methods ********************************************************/ 88 87 89 function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {88 public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) { 90 89 global $wpdb, $bp; 91 90 … … 112 111 } 113 112 114 function get_friendship_id( $user_id, $friend_id ) {113 public static function get_friendship_id( $user_id, $friend_id ) { 115 114 global $wpdb, $bp; 116 115 … … 118 117 } 119 118 120 function get_friendship_request_user_ids( $user_id ) {119 public static function get_friendship_request_user_ids( $user_id ) { 121 120 global $wpdb, $bp; 122 121 … … 124 123 } 125 124 126 function total_friend_count( $user_id = 0 ) {125 public static function total_friend_count( $user_id = 0 ) { 127 126 global $wpdb, $bp; 128 127 … … 140 139 141 140 bp_update_user_meta( $user_id, 'total_friend_count', (int) $count ); 142 return (int) $count; 143 } 144 145 function search_friends( $filter, $user_id, $limit = null, $page = null ) { 141 142 return absint( $count ); 143 } 144 145 public static function search_friends( $filter, $user_id, $limit = null, $page = null ) { 146 146 global $wpdb, $bp; 147 147 … … 183 183 } 184 184 185 function check_is_friend( $loggedin_userid, $possible_friend_userid ) {185 public static function check_is_friend( $loggedin_userid, $possible_friend_userid ) { 186 186 global $wpdb, $bp; 187 187 … … 202 202 } 203 203 204 function get_bulk_last_active( $user_ids ) {204 public static function get_bulk_last_active( $user_ids ) { 205 205 global $wpdb; 206 206 … … 210 210 } 211 211 212 function accept($friendship_id) { 213 global $wpdb, $bp; 214 212 public static function accept($friendship_id) { 213 global $wpdb, $bp; 215 214 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) ); 216 215 } 217 216 218 function withdraw($friendship_id) { 219 global $wpdb, $bp; 220 217 public static function withdraw($friendship_id) { 218 global $wpdb, $bp; 221 219 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) ); 222 220 } 223 221 224 function reject($friendship_id) { 225 global $wpdb, $bp; 226 222 public static function reject($friendship_id) { 223 global $wpdb, $bp; 227 224 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) ); 228 225 } 229 226 230 function search_users( $filter, $user_id, $limit = null, $page = null ) {227 public static function search_users( $filter, $user_id, $limit = null, $page = null ) { 231 228 global $wpdb, $bp; 232 229 … … 254 251 } 255 252 256 function search_users_count( $filter ) {253 public static function search_users_count( $filter ) { 257 254 global $wpdb, $bp; 258 255 … … 277 274 } 278 275 279 function sort_by_name( $user_ids ) {276 public static function sort_by_name( $user_ids ) { 280 277 global $wpdb, $bp; 281 278 … … 288 285 } 289 286 290 function get_random_friends( $user_id, $total_friends = 5 ) {287 public static function get_random_friends( $user_id, $total_friends = 5 ) { 291 288 global $wpdb, $bp; 292 289 … … 306 303 } 307 304 308 function get_invitable_friend_count( $user_id, $group_id ) {305 public static function get_invitable_friend_count( $user_id, $group_id ) { 309 306 310 307 // Setup some data we'll use below … … 333 330 } 334 331 335 function get_user_ids_for_friendship( $friendship_id ) { 336 global $wpdb, $bp; 337 332 public static function get_user_ids_for_friendship( $friendship_id ) { 333 global $wpdb, $bp; 338 334 return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) ); 339 335 } 340 336 341 function delete_all_for_user( $user_id ) {337 public static function delete_all_for_user( $user_id ) { 342 338 global $wpdb, $bp; 343 339 -
trunk/bp-groups/bp-groups-classes.php
r7302 r7308 197 197 /** Static Methods ********************************************************/ 198 198 199 function group_exists( $slug, $table_name = false ) {199 public static function group_exists( $slug, $table_name = false ) { 200 200 global $wpdb, $bp; 201 201 … … 209 209 } 210 210 211 function get_id_from_slug( $slug ) {211 public static function get_id_from_slug( $slug ) { 212 212 return BP_Groups_Group::group_exists( $slug ); 213 213 } … … 1487 1487 } 1488 1488 1489 function total_group_count( $user_id = 0 ) {1489 public static function total_group_count( $user_id = 0 ) { 1490 1490 global $bp, $wpdb; 1491 1491 … … 1500 1500 } 1501 1501 1502 function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {1502 public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) { 1503 1503 global $wpdb, $bp; 1504 1504 … … 1551 1551 } 1552 1552 1553 function check_is_admin( $user_id, $group_id ) {1553 public static function check_is_admin( $user_id, $group_id ) { 1554 1554 global $wpdb, $bp; 1555 1555 … … 1560 1560 } 1561 1561 1562 function check_is_mod( $user_id, $group_id ) {1562 public static function check_is_mod( $user_id, $group_id ) { 1563 1563 global $wpdb, $bp; 1564 1564 … … 1569 1569 } 1570 1570 1571 function check_is_member( $user_id, $group_id ) {1571 public static function check_is_member( $user_id, $group_id ) { 1572 1572 global $wpdb, $bp; 1573 1573 -
trunk/bp-messages/bp-messages-classes.php
r7307 r7308 12 12 13 13 class BP_Messages_Thread { 14 var$thread_id;15 var$messages;16 var$recipients;17 var$sender_ids;18 19 var$unread_count;14 public $thread_id; 15 public $messages; 16 public $recipients; 17 public $sender_ids; 18 19 public $unread_count; 20 20 21 21 /** … … 67 67 public $messages_order; 68 68 69 function __construct( $thread_id = false, $order = 'ASC' ) {69 public function __construct( $thread_id = false, $order = 'ASC' ) { 70 70 if ( $thread_id ) 71 71 $this->populate( $thread_id, $order ); 72 72 } 73 73 74 function populate( $thread_id, $order ) {74 private function populate( $thread_id, $order ) { 75 75 global $wpdb, $bp; 76 76 … … 95 95 } 96 96 97 function mark_read() {97 public function mark_read() { 98 98 BP_Messages_Thread::mark_as_read( $this->thread_id ); 99 99 } 100 100 101 function mark_unread() {101 public function mark_unread() { 102 102 BP_Messages_Thread::mark_as_unread( $this->thread_id ); 103 103 } 104 104 105 function get_recipients() {105 public function get_recipients() { 106 106 global $wpdb, $bp; 107 107 … … 115 115 } 116 116 117 /** Static Functions **/ 118 119 function delete( $thread_id ) { 120 global $wpdb, $bp; 121 122 $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) ); 117 /** Static Functions ******************************************************/ 118 119 public static function delete( $thread_id ) { 120 global $wpdb, $bp; 121 122 // Mark messages as deleted 123 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) ); 123 124 124 125 // Check to see if any more recipients remain for this message … … 137 138 } 138 139 139 function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null, $search_terms = '' ) {140 public static function get_current_threads_for_user( $user_id, $box = 'inbox', $type = 'all', $limit = null, $page = null, $search_terms = '' ) { 140 141 global $wpdb, $bp; 141 142 … … 178 179 } 179 180 180 function mark_as_read( $thread_id ) {181 public static function mark_as_read( $thread_id ) { 181 182 global $wpdb, $bp; 182 183 … … 185 186 } 186 187 187 function mark_as_unread( $thread_id ) {188 public static function mark_as_unread( $thread_id ) { 188 189 global $wpdb, $bp; 189 190 … … 192 193 } 193 194 194 function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) {195 public static function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) { 195 196 global $wpdb, $bp; 196 197 … … 207 208 } 208 209 209 function user_is_sender( $thread_id ) {210 public static function user_is_sender( $thread_id ) { 210 211 global $wpdb, $bp; 211 212 … … 218 219 } 219 220 220 function get_last_sender( $thread_id ) {221 public static function get_last_sender( $thread_id ) { 221 222 global $wpdb, $bp; 222 223 … … 242 243 } 243 244 244 function check_access( $thread_id, $user_id = 0 ) {245 public static function check_access( $thread_id, $user_id = 0 ) { 245 246 global $wpdb, $bp; 246 247 … … 251 252 } 252 253 253 function is_valid( $thread_id ) {254 public static function is_valid( $thread_id ) { 254 255 global $wpdb, $bp; 255 256 … … 257 258 } 258 259 259 function get_recipient_links( $recipients ) {260 public static function get_recipient_links( $recipients ) { 260 261 if ( count( $recipients ) >= 5 ) 261 262 return sprintf( __( '%s Recipients', 'buddypress' ), number_format_i18n( count( $recipients ) ) ); … … 276 277 } 277 278 278 // Update Functions 279 280 function update_tables() { 279 public static function update_tables() { 281 280 global $wpdb, $bp; 282 281 … … 309 308 310 309 class BP_Messages_Message { 311 var$id;312 var$thread_id;313 var$sender_id;314 var$subject;315 var$message;316 var$date_sent;317 318 var$recipients = false;319 320 function __construct( $id = null ) {310 public $id; 311 public $thread_id; 312 public $sender_id; 313 public $subject; 314 public $message; 315 public $date_sent; 316 317 public $recipients = false; 318 319 public function __construct( $id = null ) { 321 320 $this->date_sent = bp_core_current_time(); 322 321 $this->sender_id = bp_loggedin_user_id(); 323 322 324 if ( !empty( $id ) ) 323 if ( !empty( $id ) ) { 325 324 $this->populate( $id ); 326 } 327 328 function populate( $id ) { 325 } 326 } 327 328 private function populate( $id ) { 329 329 global $wpdb, $bp; 330 330 … … 339 339 } 340 340 341 function send() {341 public function send() { 342 342 global $wpdb, $bp; 343 343 … … 392 392 } 393 393 394 function get_recipients() {394 public function get_recipients() { 395 395 global $bp, $wpdb; 396 397 396 return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 398 397 } 399 398 400 / / Static Functions401 402 function get_recipient_ids( $recipient_usernames ) {399 /** Static Functions ******************************************************/ 400 401 public static function get_recipient_ids( $recipient_usernames ) { 403 402 if ( !$recipient_usernames ) 404 403 return false; … … 415 414 } 416 415 417 function get_last_sent_for_user( $thread_id ) { 418 global $wpdb, $bp; 419 416 public static function get_last_sent_for_user( $thread_id ) { 417 global $wpdb, $bp; 420 418 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", bp_loggedin_user_id(), $thread_id ) ); 421 419 } 422 420 423 function is_user_sender( $user_id, $message_id ) {421 public static function is_user_sender( $user_id, $message_id ) { 424 422 global $wpdb, $bp; 425 423 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) ); 426 424 } 427 425 428 function get_message_sender( $message_id ) {426 public static function get_message_sender( $message_id ) { 429 427 global $wpdb, $bp; 430 428 return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) ); … … 433 431 434 432 class BP_Messages_Notice { 435 var$id = null;436 var$subject;437 var$message;438 var$date_sent;439 var$is_active;440 441 function __construct( $id = null ) {433 public $id = null; 434 public $subject; 435 public $message; 436 public $date_sent; 437 public $is_active; 438 439 public function __construct( $id = null ) { 442 440 if ( $id ) { 443 441 $this->id = $id; … … 446 444 } 447 445 448 function populate() {446 private function populate() { 449 447 global $wpdb, $bp; 450 448 … … 459 457 } 460 458 461 function save() {459 private function save() { 462 460 global $wpdb, $bp; 463 461 … … 488 486 } 489 487 490 function activate() {488 public function activate() { 491 489 $this->is_active = 1; 492 if ( !$this->save() ) 493 return false; 494 495 return true; 496 } 497 498 function deactivate() { 490 return (bool) $this->save(); 491 } 492 493 public function deactivate() { 499 494 $this->is_active = 0; 500 if ( !$this->save() ) 501 return false; 502 503 return true; 504 } 505 506 function delete() { 495 return (bool) $this->save(); 496 } 497 498 public function delete() { 507 499 global $wpdb, $bp; 508 500 -
trunk/bp-xprofile/bp-xprofile-classes.php
r7285 r7308 12 12 13 13 class BP_XProfile_Group { 14 var$id = null;15 var$name;16 var$description;17 var$can_delete;18 var$group_order;19 var$fields;20 21 function __construct( $id = null ) {14 public $id = null; 15 public $name; 16 public $description; 17 public $can_delete; 18 public $group_order; 19 public $fields; 20 21 public function __construct( $id = null ) { 22 22 if ( !empty( $id ) ) 23 23 $this->populate( $id ); 24 24 } 25 25 26 function populate( $id ) {26 private function populate( $id ) { 27 27 global $wpdb, $bp; 28 28 … … 39 39 } 40 40 41 function save() {41 private function save() { 42 42 global $wpdb, $bp; 43 43 … … 64 64 } 65 65 66 function delete() {66 private function delete() { 67 67 global $wpdb, $bp; 68 68 … … 112 112 * @return array $groups 113 113 */ 114 function get( $args = '') {114 public static function get( $args = array() ) { 115 115 global $wpdb, $bp; 116 116 … … 264 264 } 265 265 266 function admin_validate() {266 public static function admin_validate() { 267 267 global $message; 268 268 … … 276 276 } 277 277 278 function update_position( $field_group_id, $position ) {278 public static function update_position( $field_group_id, $position ) { 279 279 global $wpdb, $bp; 280 280 … … 294 294 * @return array $fields The database results, with field_visibility added 295 295 */ 296 function fetch_visibility_level( $user_id = 0, $fields = array() ) {296 public static function fetch_visibility_level( $user_id = 0, $fields = array() ) { 297 297 298 298 // Get the user's visibility level preferences … … 330 330 * visibility level + allow_custom (whether the admin allows this field to be set by user) 331 331 */ 332 function fetch_default_visibility_levels() {332 public static function fetch_default_visibility_levels() { 333 333 global $wpdb, $bp; 334 334 … … 348 348 } 349 349 350 function render_admin_form() {350 public static function render_admin_form() { 351 351 global $message; 352 352 … … 427 427 428 428 class BP_XProfile_Field { 429 var$id;430 var$group_id;431 var$parent_id;432 var$type;433 var$name;434 var$description;435 var$is_required;436 var$can_delete;437 var$field_order;438 var$option_order;439 var$order_by;440 var$is_default_option;441 var$default_visibility;442 var$allow_custom_visibility = 'allowed';443 444 var$data;445 var$message = null;446 var$message_type = 'err';447 448 function __construct( $id = null, $user_id = null, $get_data = true ) {429 public $id; 430 public $group_id; 431 public $parent_id; 432 public $type; 433 public $name; 434 public $description; 435 public $is_required; 436 public $can_delete; 437 public $field_order; 438 public $option_order; 439 public $order_by; 440 public $is_default_option; 441 public $default_visibility; 442 public $allow_custom_visibility = 'allowed'; 443 444 public $data; 445 public $message = null; 446 public $message_type = 'err'; 447 448 public function __construct( $id = null, $user_id = null, $get_data = true ) { 449 449 if ( !empty( $id ) ) 450 450 $this->populate( $id, $user_id, $get_data ); 451 451 } 452 452 453 function populate( $id, $user_id, $get_data ) {453 private function populate( $id, $user_id, $get_data ) { 454 454 global $wpdb, $userdata, $bp; 455 455 … … 488 488 } 489 489 490 function delete( $delete_data = false ) {490 private function delete( $delete_data = false ) { 491 491 global $wpdb, $bp; 492 492 … … 507 507 } 508 508 509 function save() {509 private function save() { 510 510 global $wpdb, $bp; 511 511 … … 624 624 } 625 625 626 function get_field_data( $user_id ) {626 public function get_field_data( $user_id ) { 627 627 return new BP_XProfile_ProfileData( $this->id, $user_id ); 628 628 } 629 629 630 function get_children( $for_editing = false ) {630 public function get_children( $for_editing = false ) { 631 631 global $wpdb, $bp; 632 632 … … 655 655 } 656 656 657 function delete_children() {657 public function delete_children() { 658 658 global $wpdb, $bp; 659 659 … … 663 663 } 664 664 665 /* Static Functions*/666 667 function get_type( $field_id ) {665 /** Static Methods ********************************************************/ 666 667 public static function get_type( $field_id ) { 668 668 global $wpdb, $bp; 669 669 … … 681 681 } 682 682 683 function delete_for_group( $group_id ) {683 public static function delete_for_group( $group_id ) { 684 684 global $wpdb, $bp; 685 685 … … 697 697 } 698 698 699 function get_id_from_name( $field_name ) {699 public static function get_id_from_name( $field_name ) { 700 700 global $wpdb, $bp; 701 701 … … 706 706 } 707 707 708 function update_position( $field_id, $position, $field_group_id ) {708 public static function update_position( $field_id, $position, $field_group_id ) { 709 709 global $wpdb, $bp; 710 710 … … 729 729 730 730 /* This function populates the items for radio buttons checkboxes and drop down boxes */ 731 function render_admin_form_children() {731 public function render_admin_form_children() { 732 732 $input_types = array( 'checkbox', 'selectbox', 'multiselectbox', 'radio' ); 733 733 … … 817 817 } 818 818 819 function render_admin_form( $message = '' ) {819 public function render_admin_form( $message = '' ) { 820 820 if ( empty( $this->id ) ) { 821 821 $title = __( 'Add Field', 'buddypress' ); … … 977 977 } 978 978 979 function admin_validate() {979 public function admin_validate() { 980 980 global $message; 981 981 … … 1004 1004 1005 1005 class BP_XProfile_ProfileData { 1006 var$id;1007 var$user_id;1008 var$field_id;1009 var$value;1010 var$last_updated;1011 1012 function __construct( $field_id = null, $user_id = null ) {1006 public $id; 1007 public $user_id; 1008 public $field_id; 1009 public $value; 1010 public $last_updated; 1011 1012 public function __construct( $field_id = null, $user_id = null ) { 1013 1013 if ( !empty( $field_id ) ) { 1014 1014 $this->populate( $field_id, $user_id ); … … 1016 1016 } 1017 1017 1018 function populate( $field_id, $user_id ) {1018 private function populate( $field_id, $user_id ) { 1019 1019 global $wpdb, $bp; 1020 1020 … … 1035 1035 1036 1036 /** 1037 * exists ()1038 *1039 1037 * Check if there is data already for the user. 1040 1038 * … … 1043 1041 * @return bool 1044 1042 */ 1045 function exists() {1043 private function exists() { 1046 1044 global $wpdb, $bp; 1047 1045 … … 1052 1050 1053 1051 /** 1054 * is_valid_field()1055 *1056 1052 * Check if this data is for a valid field. 1057 1053 * … … 1060 1056 * @return bool 1061 1057 */ 1062 function is_valid_field() {1058 private function is_valid_field() { 1063 1059 global $wpdb, $bp; 1064 1060 … … 1068 1064 } 1069 1065 1070 function save() {1066 private function save() { 1071 1067 global $wpdb, $bp; 1072 1068 … … 1102 1098 } 1103 1099 1104 function delete() {1100 private function delete() { 1105 1101 global $wpdb, $bp; 1106 1102 … … 1111 1107 } 1112 1108 1113 /** Static Functions**/1109 /** Static Methods ********************************************************/ 1114 1110 1115 1111 /** … … 1118 1114 * Get all of the profile information for a specific user. 1119 1115 */ 1120 function get_all_for_user( $user_id ) {1116 public static function get_all_for_user( $user_id ) { 1121 1117 global $wpdb, $bp; 1122 1118 … … 1150 1146 * @return int $fielddata_id 1151 1147 */ 1152 function get_fielddataid_byid( $field_id, $user_id ) {1148 public static function get_fielddataid_byid( $field_id, $user_id ) { 1153 1149 global $wpdb, $bp; 1154 1150 … … 1162 1158 } 1163 1159 1164 function get_value_byid( $field_id, $user_ids = null ) {1160 public static function get_value_byid( $field_id, $user_ids = null ) { 1165 1161 global $wpdb, $bp; 1166 1162 … … 1178 1174 } 1179 1175 1180 function get_value_byfieldname( $fields, $user_id = null ) {1176 public static function get_value_byfieldname( $fields, $user_id = null ) { 1181 1177 global $bp, $wpdb; 1182 1178 … … 1227 1223 } 1228 1224 1229 function delete_for_field( $field_id ) {1225 public static function delete_for_field( $field_id ) { 1230 1226 global $wpdb, $bp; 1231 1227 … … 1236 1232 } 1237 1233 1238 function get_last_updated( $user_id ) {1234 public static function get_last_updated( $user_id ) { 1239 1235 global $wpdb, $bp; 1240 1236 … … 1244 1240 } 1245 1241 1246 function delete_data_for_user( $user_id ) {1242 public static function delete_data_for_user( $user_id ) { 1247 1243 global $wpdb, $bp; 1248 1244 … … 1250 1246 } 1251 1247 1252 function get_random( $user_id, $exclude_fullname ) {1248 public static function get_random( $user_id, $exclude_fullname ) { 1253 1249 global $wpdb, $bp; 1254 1250 … … 1259 1255 } 1260 1256 1261 function get_fullname( $user_id = 0 ) {1257 public static function get_fullname( $user_id = 0 ) { 1262 1258 1263 1259 if ( empty( $user_id ) )
Note: See TracChangeset
for help on using the changeset viewer.