Changeset 7433
- Timestamp:
- 10/16/2013 01:36:51 PM (11 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-actions.php
r7380 r7433 2 2 3 3 /** 4 * BuddyPress Filters & Actions 4 * BuddyPress Filters & Actions. 5 5 * 6 6 * @package BuddyPress … … 17 17 18 18 /** 19 * Attach BuddyPress to WordPress 19 * Attach BuddyPress to WordPress. 20 20 * 21 21 * BuddyPress uses its own internal actions to help aid in third-party plugin -
trunk/bp-core/bp-core-admin.php
r7427 r7433 2 2 3 3 /** 4 * Main BuddyPress Admin Class 4 * Main BuddyPress Admin Class. 5 5 * 6 6 * @package BuddyPress … … 13 13 if ( !class_exists( 'BP_Admin' ) ) : 14 14 /** 15 * Load s BuddyPress plugin admin area15 * Load BuddyPress plugin admin area. 16 16 * 17 17 * @package BuddyPress 18 18 * @subpackage CoreAdministration 19 * @since BuddyPress (1.6) 19 * 20 * @since BuddyPress (1.6.0) 20 21 */ 21 22 class BP_Admin { … … 24 25 25 26 /** 26 * @var string Path to the BuddyPress admin directory 27 * Path to the BuddyPress admin directory. 28 * 29 * @var string $admin_dir 27 30 */ 28 31 public $admin_dir = ''; … … 31 34 32 35 /** 33 * @var string URL to the BuddyPress admin directory 36 * URL to the BuddyPress admin directory. 37 * 38 * @var string $admin_url 34 39 */ 35 40 public $admin_url = ''; 36 41 37 42 /** 38 * @var string URL to the BuddyPress images directory 43 * URL to the BuddyPress images directory. 44 * 45 * @var string $images_url 39 46 */ 40 47 public $images_url = ''; 41 48 42 49 /** 43 * @var string URL to the BuddyPress admin CSS directory 50 * URL to the BuddyPress admin CSS directory. 51 * 52 * @var string $css_url 44 53 */ 45 54 public $css_url = ''; 46 55 47 56 /** 48 * @var string URL to the BuddyPress admin JS directory 57 * URL to the BuddyPress admin JS directory. 58 * 59 * @var string 49 60 */ 50 61 public $js_url = ''; … … 53 64 54 65 /** 55 * The main BuddyPress admin loader 56 * 57 * @since BuddyPress (1.6 )58 * 59 * @uses BP_Admin::setup_globals() Setup the globals needed 60 * @uses BP_Admin::includes() Include the required files 61 * @uses BP_Admin::setup_actions() Setup the hooks and actions 66 * The main BuddyPress admin loader. 67 * 68 * @since BuddyPress (1.6.0) 69 * 70 * @uses BP_Admin::setup_globals() Setup the globals needed. 71 * @uses BP_Admin::includes() Include the required files. 72 * @uses BP_Admin::setup_actions() Setup the hooks and actions. 62 73 */ 63 74 public function __construct() { … … 68 79 69 80 /** 70 * Admin globals 71 * 72 * @since BuddyPress (1.6) 81 * Set admin-related globals. 82 * 73 83 * @access private 84 * @since BuddyPress (1.6.0) 74 85 */ 75 86 private function setup_globals() { … … 88 99 89 100 /** 90 * Include required files 91 * 92 * @since BuddyPress (1.6 )101 * Include required files. 102 * 103 * @since BuddyPress (1.6.0) 93 104 * @access private 94 105 */ … … 102 113 103 114 /** 104 * Setup the admin hooks, actions and filters 105 * 106 * @since BuddyPress (1.6) 115 * Set up the admin hooks, actions, and filters. 116 * 107 117 * @access private 108 * 109 * @uses add_action() To add various actions 110 * @uses add_filter() To add various filters 118 * @since BuddyPress (1.6.0) 119 * 120 * @uses add_action() To add various actions. 121 * @uses add_filter() To add various filters. 111 122 */ 112 123 private function setup_actions() { … … 139 150 140 151 /** 141 * Add the navigational menu elements 152 * Add the navigational menu elements. 142 153 * 143 154 * @since BuddyPress (1.6) 144 155 * 145 * @uses add_management_page() To add the Recount page in Tools section 156 * @uses add_management_page() To add the Recount page in Tools section. 146 157 * @uses add_options_page() To add the Forums settings page in Settings 147 * section158 * section. 148 159 */ 149 160 public function admin_menus() { … … 227 238 228 239 /** 229 * Register the settings 230 * 231 * @since BuddyPress (1.6 )232 * 233 * @uses add_settings_section() To add our own settings section 234 * @uses add_settings_field() To add various settings fields 235 * @uses register_setting() To register various settings 240 * Register the settings. 241 * 242 * @since BuddyPress (1.6.0) 243 * 244 * @uses add_settings_section() To add our own settings section. 245 * @uses add_settings_field() To add various settings fields. 246 * @uses register_setting() To register various settings. 236 247 */ 237 248 public function register_admin_settings() { … … 316 327 317 328 /** 318 * Add Settings link to plugins area 319 * 320 * @since BuddyPress (1.6 )321 * 322 * @param array $links Links array in which we would prepend our link 323 * @param string $file Current plugin basename 324 * @return array Processed links 329 * Add Settings link to plugins area. 330 * 331 * @since BuddyPress (1.6.0) 332 * 333 * @param array $links Links array in which we would prepend our link. 334 * @param string $file Current plugin basename. 335 * @return array Processed links. 325 336 */ 326 337 public function modify_plugin_action_links( $links, $file ) { … … 338 349 339 350 /** 340 * Add some general styling to the admin area 341 * 342 * @since BuddyPress (1.6 )351 * Add some general styling to the admin area. 352 * 353 * @since BuddyPress (1.6.0) 343 354 */ 344 355 public function admin_head() { … … 354 365 355 366 /** 356 * Add some general styling to the admin area 357 * 358 * @since BuddyPress (1.6 )367 * Add some general styling to the admin area. 368 * 369 * @since BuddyPress (1.6.0) 359 370 */ 360 371 public function enqueue_scripts() { … … 370 381 371 382 /** 372 * Output the about screen 373 * 374 * @since BuddyPress (1.7 )383 * Output the about screen. 384 * 385 * @since BuddyPress (1.7.0) 375 386 */ 376 387 public function about_screen() { … … 481 492 482 493 /** 483 * Output the credits screen 484 * 485 * Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll494 * Output the credits screen. 495 * 496 * Hardcoding this in here is pretty janky. It's fine for now, but we'll 486 497 * want to leverage api.wordpress.org eventually. 487 498 * 488 * @since BuddyPress (1.7 )499 * @since BuddyPress (1.7.0) 489 500 */ 490 501 public function credits_screen() { … … 613 624 614 625 /** 615 * Setup BuddyPress Admin 626 * Setup BuddyPress Admin. 616 627 * 617 * @since BuddyPress (1.6 )628 * @since BuddyPress (1.6.0) 618 629 * 619 630 * @uses BP_Admin -
trunk/bp-core/bp-core-adminbar.php
r7228 r7433 2 2 3 3 /** 4 * BuddyPress Core Toolbar 4 * BuddyPress Core Toolbar. 5 5 * 6 * Handles the core functions related to the WordPress Toolbar 6 * Handles the core functions related to the WordPress Toolbar. 7 7 * 8 8 * @package BuddyPress … … 14 14 15 15 /** 16 * Add s the secondary BuddyPress area to the my-account menu16 * Add the secondary BuddyPress area to the my-account menu. 17 17 * 18 * @since BuddyPress 1.6 18 * @since BuddyPress (1.6.0) 19 * 19 20 * @global WP_Admin_Bar $wp_admin_bar 20 21 */ … … 44 45 45 46 /** 46 * Handle the Toolbar/BuddyBar business 47 * Handle the Toolbar/BuddyBar business. 47 48 * 48 * @since BuddyPress (1.2 )49 * @since BuddyPress (1.2.0) 49 50 * 50 51 * @global string $wp_version … … 53 54 * @uses bp_use_wp_admin_bar() 54 55 * @uses show_admin_bar() 55 * @uses add_action() To hook 'bp_adminbar_logo' to 'bp_adminbar_logo' 56 * @uses add_action() To hook 'bp_adminbar_login_menu' to 'bp_adminbar_menus' 57 * @uses add_action() To hook 'bp_adminbar_account_menu' to 'bp_adminbar_menus' 58 * @uses add_action() To hook 'bp_adminbar_thisblog_menu' to 'bp_adminbar_menus' 59 * @uses add_action() To hook 'bp_adminbar_random_menu' to 'bp_adminbar_menus' 60 * @uses add_action() To hook 'bp_core_admin_bar' to 'wp_footer' 61 * @uses add_action() To hook 'bp_core_admin_bar' to 'admin_footer' 56 * @uses add_action() To hook 'bp_adminbar_logo' to 'bp_adminbar_logo'. 57 * @uses add_action() To hook 'bp_adminbar_login_menu' to 'bp_adminbar_menus'. 58 * @uses add_action() To hook 'bp_adminbar_account_menu' to 'bp_adminbar_menus'. 59 * @uses add_action() To hook 'bp_adminbar_thisblog_menu' to 'bp_adminbar_menus'. 60 * @uses add_action() To hook 'bp_adminbar_random_menu' to 'bp_adminbar_menus'. 61 * @uses add_action() To hook 'bp_core_admin_bar' to 'wp_footer'. 62 * @uses add_action() To hook 'bp_core_admin_bar' to 'admin_footer'. 62 63 */ 63 64 function bp_core_load_admin_bar() { … … 89 90 90 91 /** 91 * Handle the Toolbar CSS 92 * Handle the Toolbar CSS. 92 93 * 93 * @since BuddyPress 1.594 * @since BuddyPress (1.5.0) 94 95 */ 95 96 function bp_core_load_admin_bar_css() { -
trunk/bp-core/bp-core-avatars.php
r7428 r7433 2 2 3 3 /** 4 * BuddyPress Avatars 4 * BuddyPress Avatars. 5 5 */ 6 6 … … 9 9 10 10 /*** 11 * Set up the constants we need for avatar support 11 * Set up the constants we need for avatar support. 12 12 */ 13 13 function bp_core_set_avatar_constants() { … … 51 51 add_action( 'bp_init', 'bp_core_set_avatar_constants', 3 ); 52 52 53 /** 54 * Set up global variables related to avatars. 55 * 56 * @since BuddyPress (1.5.0) 57 */ 53 58 function bp_core_set_avatar_globals() { 54 59 $bp = buddypress(); … … 478 483 479 484 /** 480 * Delete an existing avatar 481 * 482 * Accepted values for $args are: 483 * item_id - item id which relates to the object type. 484 * object - the objetc type user, group, blog, etc. 485 * avatar_dir - The directory where the avatars to be uploaded. 486 * 487 * @param mixed $args 488 * @return bool Success/failure 485 * Delete an existing avatar. 486 * 487 * @param array $args { 488 * Array of function parameters. 489 * @type bool|int $item_id ID of the item whose avatar you're deleting. 490 * Defaults to the current item of type $object. 491 * @type string $object Object type of the item whose avatar you're 492 * deleting. 'user', 'group', 'blog', or custom. Default: 'user'. 493 * @type bool|string $avatar_dir Subdirectory where avatar is located. 494 * Default: false, which falls back on the default location 495 * corresponding to the $object. 496 * } 497 * @return bool True on success, false on failure. 489 498 */ 490 499 function bp_core_delete_existing_avatar( $args = '' ) { … … 546 555 547 556 /** 548 * Handles avatar uploading. 549 * 550 * The functions starts off by checking that the file has been uploaded properly using bp_core_check_avatar_upload(). 551 * It then checks that the file size is within limits, and that it has an accepted file extension (jpg, gif, png). 552 * If everything checks out, crop the image and move it to its real location. 553 * 554 * @param array $file The appropriate entry the from $_FILES superglobal. 555 * @param string $upload_dir_filter A filter to be applied to upload_dir 556 * @return bool Success/failure 557 * Handle avatar uploading. 558 * 559 * The functions starts off by checking that the file has been uploaded 560 * properly using bp_core_check_avatar_upload(). It then checks that the file 561 * size is within limits, and that it has an accepted file extension (jpg, gif, 562 * png). If everything checks out, crop the image and move it to its real 563 * location. 564 * 557 565 * @see bp_core_check_avatar_upload() 558 566 * @see bp_core_check_avatar_type() 567 * 568 * @param array $file The appropriate entry the from $_FILES superglobal. 569 * @param string $upload_dir_filter A filter to be applied to 'upload_dir'. 570 * @return bool True on success, false on failure. 559 571 */ 560 572 function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) { … … 672 684 673 685 /** 674 * Crop an uploaded avatar 686 * Crop an uploaded avatar. 675 687 * 676 688 * $args has the following parameters: … … 684 696 * crop_y - The vertical starting point of the crop 685 697 * 686 * @param mixed $args 687 * @return bool Success/failure 698 * @param array $args { 699 * Array of function parameters. 700 * @type string $object Object type of the item whose avatar you're 701 * handling. 'user', 'group', 'blog', or custom. Default: 'user'. 702 * @type string $avatar_dir Subdirectory where avatar should be stored. 703 * Default: 'avatars'. 704 * @type bool|int $item_id ID of the item that the avatar belongs to. 705 * @type bool|string $original_file Absolute papth to the original avatar 706 * file. 707 * @type int $crop_w Crop width. Default: the global 'full' avatar width, 708 * as retrieved by bp_core_avatar_full_width(). 709 * @type int $crop_h Crop height. Default: the global 'full' avatar height, 710 * as retrieved by bp_core_avatar_full_height(). 711 * @type int $crop_x The horizontal starting point of the crop. Default: 0. 712 * @type int $crop_y The vertical starting point of the crop. Default: 0. 713 * } 714 * @return bool True on success, false on failure. 688 715 */ 689 716 function bp_core_avatar_handle_crop( $args = '' ) { … … 764 791 765 792 /** 766 * bp_core_fetch_avatar_filter() 767 * 768 * Attempts to filter get_avatar function and let BuddyPress have a go 769 * at finding an avatar that may have been uploaded locally. 770 * 771 * @global array $authordata 772 * @param string $avatar The result of get_avatar from before-filter 773 * @param int|string|object $user A user ID, email address, or comment object 774 * @param int $size Size of the avatar image (thumb/full) 775 * @param string $default URL to a default image to use if no avatar is available 776 * @param string $alt Alternate text to use in image tag. Defaults to blank 777 * @return string 793 * Replace default WordPress avatars with BP avatars, if available. 794 * 795 * Filters 'get_avatar'. 796 * 797 * @param string $avatar The avatar path passed to 'get_avatar'. 798 * @param int|string|object $user A user ID, email address, or comment object. 799 * @param int $size Size of the avatar image ('thumb' or 'full'). 800 * @param string $default URL to a default image to use if no avatar is available. 801 * @param string $alt Alternate text to use in image tag. Default: ''. 802 * @return string BP avatar path, if found; else the original avatar path. 778 803 */ 779 804 function bp_core_fetch_avatar_filter( $avatar, $user, $size, $default, $alt = '' ) { … … 816 841 817 842 /** 818 * Has the current avatar upload generated an error?819 * 820 * @param array $file 821 * @return bool 843 * Is the current avatar upload error-free? 844 * 845 * @param array $file The $_FILES array. 846 * @return bool True if no errors are found. False if there are errors. 822 847 */ 823 848 function bp_core_check_avatar_upload( $file ) { … … 831 856 * Is the file size of the current avatar upload permitted? 832 857 * 833 * @param array $file 834 * @return bool 858 * @param array $file The $_FILES array. 859 * @return bool True if the avatar is under the size limit, otherwise false. 835 860 */ 836 861 function bp_core_check_avatar_size( $file ) { … … 846 871 * Permitted file types are JPG, GIF and PNG. 847 872 * 848 * @param string $file849 * @return bool 873 * @param array $file The $_FILES array. 874 * @return bool True if the file extension is permitted, otherwise false. 850 875 */ 851 876 function bp_core_check_avatar_type($file) { … … 857 882 858 883 /** 859 * Fetch esdata from the BP root blog's upload directory.884 * Fetch data from the BP root blog's upload directory. 860 885 * 861 886 * Handy for multisite instances because all uploads are made on the BP root … … 865 890 * once to get what we need. 866 891 * 867 * @since BuddyPress (1.8 )892 * @since BuddyPress (1.8.0) 868 893 * 869 894 * @uses wp_upload_dir() 870 895 * 871 * @param string $type The variable we want to return from the $bp->avatars object.872 * Only 'upload_path' and 'url' are supported.873 * @return string 896 * @param string $type The variable we want to return from the $bp->avatars 897 * object. Only 'upload_path' and 'url' are supported. Default: 'upload_path'. 898 * @return string The avatar upload directory path. 874 899 */ 875 900 function bp_core_get_upload_dir( $type = 'upload_path' ) { … … 949 974 950 975 /** 951 * bp_core_avatar_upload_path() 952 * 953 * Returns the absolute upload path for the WP installation 976 * Get the absolute upload path for the WP installation. 954 977 * 955 978 * @uses wp_upload_dir To get upload directory info 956 * @return string Absolute path to WP upload directory 979 * 980 * @return string Absolute path to WP upload directory. 957 981 */ 958 982 function bp_core_avatar_upload_path() { … … 961 985 962 986 /** 963 * bp_core_avatar_url() 964 * 965 * Returns the raw base URL for root site upload location 966 * 967 * @uses wp_upload_dir To get upload directory info 968 * @return string Full URL to current upload location 987 * Get the raw base URL for root site upload location. 988 * 989 * @uses wp_upload_dir To get upload directory info. 990 * 991 * @return string Full URL to current upload location. 969 992 */ 970 993 function bp_core_avatar_url() { … … 973 996 974 997 /** 975 * Check if a given user ID has an uploaded avatar 976 * 977 * @since BuddyPress (1.0) 978 * @param int $user_id 979 * @return boolean 998 * Check if a given user ID has an uploaded avatar. 999 * 1000 * @since BuddyPress (1.0.0) 1001 * 1002 * @param int $user_id ID of the user whose avatar is being checked. 1003 * @return bool True if the user has uploaded a local avatar. Otherwise false. 980 1004 */ 981 1005 function bp_get_user_has_avatar( $user_id = 0 ) { … … 992 1016 993 1017 /** 994 * Utility function for fetching an avatar dimension setting 995 * 996 * @package BuddyPress 997 * @since BuddyPress (1.5) 998 * 999 * @param string $type 'thumb' for thumbs, otherwise full 1000 * @param string $h_or_w 'height' for height, otherwise width 1001 * @return int $dim The dimension 1018 * Utility function for fetching an avatar dimension setting. 1019 * 1020 * @since BuddyPress (1.5.0) 1021 * 1022 * @param string $type Dimension type you're fetching dimensions for. 'thumb' 1023 * or 'full'. Default: 'thumb'. 1024 * @param string $h_or_w Which dimension is being fetched. 'height' or 'width'. 1025 * Default: 'height'. 1026 * @return int $dim The dimension. 1002 1027 */ 1003 1028 function bp_core_avatar_dimension( $type = 'thumb', $h_or_w = 'height' ) { … … 1009 1034 1010 1035 /** 1011 * Get the avatar thumb width setting 1012 * 1013 * @package BuddyPress 1014 * @since BuddyPress (1.5) 1015 * 1016 * @return int The thumb width 1036 * Get the 'thumb' avatar width setting. 1037 * 1038 * @since BuddyPress (1.5.0) 1039 * 1040 * @return int The 'thumb' width. 1017 1041 */ 1018 1042 function bp_core_avatar_thumb_width() { … … 1021 1045 1022 1046 /** 1023 * Get the avatar thumb height setting 1024 * 1025 * @package BuddyPress 1026 * @since BuddyPress (1.5) 1027 * 1028 * @return int The thumb height 1047 * Get the 'thumb' avatar height setting. 1048 * 1049 * @since BuddyPress (1.5.0) 1050 * 1051 * @return int The 'thumb' height. 1029 1052 */ 1030 1053 function bp_core_avatar_thumb_height() { … … 1033 1056 1034 1057 /** 1035 * Get the avatar full width setting 1036 * 1037 * @package BuddyPress 1038 * @since BuddyPress (1.5) 1039 * 1040 * @return int The full width 1058 * Get the 'full' avatar width setting 1059 * 1060 * @since BuddyPress (1.5.0) 1061 * 1062 * @return int The 'full' width. 1041 1063 */ 1042 1064 function bp_core_avatar_full_width() { … … 1045 1067 1046 1068 /** 1047 * Get the avatar full height setting 1048 * 1049 * @package BuddyPress 1050 * @since BuddyPress (1.5) 1051 * 1052 * @return int The full height 1069 * Get the 'full' avatar height setting. 1070 * 1071 * @since BuddyPress (1.5.0) 1072 * 1073 * @return int The 'full' height. 1053 1074 */ 1054 1075 function bp_core_avatar_full_height() { … … 1057 1078 1058 1079 /** 1059 * Get the max width for original avatar uploads 1060 * 1061 * @package BuddyPress 1062 * @since BuddyPress (1.5) 1063 * 1064 * @return int The width 1080 * Get the max width for original avatar uploads. 1081 * 1082 * @since BuddyPress (1.5.0) 1083 * 1084 * @return int The max width for original avatar uploads. 1065 1085 */ 1066 1086 function bp_core_avatar_original_max_width() { … … 1069 1089 1070 1090 /** 1071 * Get the max filesize for original avatar uploads 1072 * 1073 * @package BuddyPress 1074 * @since BuddyPress (1.5) 1075 * 1076 * @return int The filesize 1091 * Get the max filesize for original avatar uploads. 1092 * 1093 * @since BuddyPress (1.5.0) 1094 * 1095 * @return int The max filesize for original avatar uploads. 1077 1096 */ 1078 1097 function bp_core_avatar_original_max_filesize() { … … 1081 1100 1082 1101 /** 1083 * Get the default avatar 1084 * 1085 * @package BuddyPress 1086 * @since BuddyPress (1.5) 1087 * 1088 * @return int The URL of the default avatar 1102 * Get the URL of the 'full' default avatar. 1103 * 1104 * @since BuddyPress (1.5.0) 1105 * 1106 * @return string The URL of the default avatar. 1089 1107 */ 1090 1108 function bp_core_avatar_default() { … … 1093 1111 1094 1112 /** 1095 * Get the default avatar thumb 1096 * 1097 * @package BuddyPress 1098 * @since BuddyPress (1.5) 1099 * 1100 * @return int The URL of the default avatar thumb 1113 * Get the URL of the 'thumb' default avatar. 1114 * 1115 * @since BuddyPress (1.5.0) 1116 * 1117 * @return string The URL of the default avatar thumb. 1101 1118 */ 1102 1119 function bp_core_avatar_default_thumb() {
Note: See TracChangeset
for help on using the changeset viewer.