Changeset 6468 for trunk/bp-core/bp-core-avatars.php
- Timestamp:
- 10/26/2012 05:13:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r6342 r6468 12 12 */ 13 13 function bp_core_set_avatar_constants() { 14 global $bp;15 14 16 15 if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) ) … … 30 29 31 30 if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) { 31 32 $bp = buddypress(); 33 32 34 if ( !isset( $bp->site_options['fileupload_maxk'] ) ) { 33 35 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); // 5mb … … 46 48 47 49 function bp_core_set_avatar_globals() { 48 global $bp;50 $bp = buddypress(); 49 51 50 52 $bp->avatar = new stdClass; … … 88 90 * default, but can be extended to include your own custom components too. 89 91 * 90 * @global BuddyPress $bp The one true BuddyPress instance91 92 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 92 93 * @param array $args Determine the output of this function … … 94 95 */ 95 96 function bp_core_fetch_avatar( $args = '' ) { 96 global $bp, $current_blog; 97 98 // If avatars are disabled for the root site, obey that request and bail 99 if ( ! bp_get_option( 'show_avatars' ) ) 100 return; 101 102 global $current_blog; 103 104 $bp = buddypress(); 97 105 98 106 // Set a few default variables … … 373 381 // No avatar was found, and we've been told not to use a gravatar. 374 382 } else { 375 $gravatar = apply_filters( "bp_core_default_avatar_$object", BP_PLUGIN_URL . 'bp-core/images/mystery-man.jpg', $params);383 $gravatar = urlencode( apply_filters( "bp_core_default_avatar_$object", BP_PLUGIN_URL . 'bp-core/images/mystery-man.jpg', $params ) ); 376 384 } 377 385 378 386 if ( true === $html ) 379 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar. '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );387 return apply_filters( 'bp_core_fetch_avatar', '<img src="' . esc_attr( $gravatar ) . '" alt="' . esc_attr( $alt ) . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 380 388 else 381 389 return apply_filters( 'bp_core_fetch_avatar_url', $gravatar ); … … 390 398 * avatar_dir - The directory where the avatars to be uploaded. 391 399 * 392 * @global object $bp BuddyPress global settings393 400 * @param mixed $args 394 401 * @return bool Success/failure 395 402 */ 396 403 function bp_core_delete_existing_avatar( $args = '' ) { 397 global $bp;398 404 399 405 $defaults = array( … … 410 416 $item_id = bp_displayed_user_id(); 411 417 else if ( 'group' == $object ) 412 $item_id = $bp->groups->current_group->id;418 $item_id = buddypress()->groups->current_group->id; 413 419 else if ( 'blog' == $object ) 414 420 $item_id = $current_blog->id; … … 459 465 * If everything checks out, crop the image and move it to its real location. 460 466 * 461 * @global object $bp BuddyPress global settings462 467 * @param array $file The appropriate entry the from $_FILES superglobal. 463 468 * @param string $upload_dir_filter A filter to be applied to upload_dir … … 467 472 */ 468 473 function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) { 469 global $bp;470 474 471 475 /*** … … 505 509 // Filter the upload location 506 510 add_filter( 'upload_dir', $upload_dir_filter, 10, 0 ); 511 512 $bp = buddypress(); 507 513 508 514 $bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) ); … … 736 742 */ 737 743 function bp_core_avatar_upload_path() { 738 global $bp;744 $bp = buddypress(); 739 745 740 746 // See if the value has already been calculated and stashed in the $bp global … … 782 788 */ 783 789 function bp_core_avatar_url() { 784 global $bp;790 $bp = buddypress(); 785 791 786 792 // See if the value has already been calculated and stashed in the $bp global … … 850 856 */ 851 857 function bp_core_avatar_dimension( $type = 'thumb', $h_or_w = 'height' ) { 852 global $bp; 853 858 $bp = buddypress(); 854 859 $dim = isset( $bp->avatar->{$type}->{$h_or_w} ) ? (int) $bp->avatar->{$type}->{$h_or_w} : false; 855 860 … … 914 919 */ 915 920 function bp_core_avatar_original_max_width() { 916 global $bp; 917 918 return apply_filters( 'bp_core_avatar_original_max_width', (int) $bp->avatar->original_max_width ); 921 return apply_filters( 'bp_core_avatar_original_max_width', (int) buddypress()->avatar->original_max_width ); 919 922 } 920 923 … … 928 931 */ 929 932 function bp_core_avatar_original_max_filesize() { 930 global $bp; 931 932 return apply_filters( 'bp_core_avatar_original_max_filesize', (int) $bp->avatar->original_max_filesize ); 933 return apply_filters( 'bp_core_avatar_original_max_filesize', (int) buddypress()->avatar->original_max_filesize ); 933 934 } 934 935 … … 942 943 */ 943 944 function bp_core_avatar_default() { 944 global $bp; 945 946 return apply_filters( 'bp_core_avatar_default', $bp->avatar->full->default ); 945 return apply_filters( 'bp_core_avatar_default', buddypress()->avatar->full->default ); 947 946 } 948 947 … … 956 955 */ 957 956 function bp_core_avatar_default_thumb() { 958 global $bp; 959 960 return apply_filters( 'bp_core_avatar_thumb', $bp->avatar->thumb->default ); 961 } 957 return apply_filters( 'bp_core_avatar_thumb', buddypress()->avatar->thumb->default ); 958 }
Note: See TracChangeset
for help on using the changeset viewer.