Changeset 7769
- Timestamp:
- 02/02/2014 07:09:47 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r7756 r7769 38 38 } 39 39 } 40 41 if ( !defined( 'BP_AVATAR_DEFAULT' ) )42 define( 'BP_AVATAR_DEFAULT', $bp->plugin_url . 'bp-core/images/mystery-man.jpg' );43 44 if ( !defined( 'BP_AVATAR_DEFAULT_THUMB' ) )45 define( 'BP_AVATAR_DEFAULT_THUMB', $bp->plugin_url . 'bp-core/images/mystery-man-50.jpg' );46 40 47 41 if ( ! defined( 'BP_SHOW_AVATARS' ) ) { … … 74 68 75 69 // Defaults 76 $bp->avatar->thumb->default = BP_AVATAR_DEFAULT_THUMB;77 $bp->avatar->full->default = BP_AVATAR_DEFAULT;70 $bp->avatar->thumb->default = bp_core_avatar_default_thumb(); 71 $bp->avatar->full->default = bp_core_avatar_default(); 78 72 79 73 // These have to be set on page load in order to avoid infinite filter loops at runtime … … 440 434 $default_grav = 'wavatar'; 441 435 } else if ( 'mystery' == $bp->grav_default->{$object} ) { 442 $default_grav = apply_filters( 'bp_core_mysteryman_src', bp_core_avatar_default(), $grav_size );436 $default_grav = apply_filters( 'bp_core_mysteryman_src', 'mm', $grav_size ); 443 437 } else { 444 438 $default_grav = $bp->grav_default->{$object}; … … 472 466 // No avatar was found, and we've been told not to use a gravatar. 473 467 } else { 474 $gravatar = apply_filters( "bp_core_default_avatar_$object", $bp->plugin_url . 'bp-core/images/mystery-man.jpg', $params );468 $gravatar = apply_filters( "bp_core_default_avatar_$object", bp_core_avatar_default( 'local' ), $params ); 475 469 } 476 470 … … 1117 1111 * @since BuddyPress (1.5.0) 1118 1112 * 1113 * @param string $type 'local' if the fallback should be the locally-hosted 1114 * version of the mystery-man, 'gravatar' if the fallback should be 1115 * Gravatar's version. Default: 'gravatar'. 1119 1116 * @return string The URL of the default avatar. 1120 1117 */ 1121 function bp_core_avatar_default() { 1122 return apply_filters( 'bp_core_avatar_default', buddypress()->avatar->full->default ); 1118 function bp_core_avatar_default( $type = 'gravatar' ) { 1119 // Local override 1120 if ( defined( 'BP_AVATAR_DEFAULT' ) ) { 1121 $avatar = BP_AVATAR_DEFAULT; 1122 1123 // Use the local default image 1124 } else if ( 'local' === $type ) { 1125 $avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man.jpg'; 1126 1127 // Use Gravatar's mystery man as fallback 1128 } else { 1129 if ( is_ssl() ) { 1130 $host = 'https://secure.gravatar.com'; 1131 } else { 1132 $host = 'http://www.gravatar.com'; 1133 } 1134 1135 $avatar = $host . '/avatar/00000000000000000000000000000000?d=mm&s=' . bp_core_avatar_full_width(); 1136 } 1137 1138 return apply_filters( 'bp_core_avatar_default', $avatar ); 1123 1139 } 1124 1140 … … 1126 1142 * Get the URL of the 'thumb' default avatar. 1127 1143 * 1144 * Uses Gravatar's mystery-man avatar, unless BP_AVATAR_DEFAULT_THUMB has been 1145 * defined. 1146 * 1128 1147 * @since BuddyPress (1.5.0) 1129 1148 * 1149 * @param string $type 'local' if the fallback should be the locally-hosted 1150 * version of the mystery-man, 'gravatar' if the fallback should be 1151 * Gravatar's version. Default: 'gravatar'. 1130 1152 * @return string The URL of the default avatar thumb. 1131 1153 */ 1132 function bp_core_avatar_default_thumb() { 1133 return apply_filters( 'bp_core_avatar_thumb', buddypress()->avatar->thumb->default ); 1134 } 1154 function bp_core_avatar_default_thumb( $type = 'gravatar' ) { 1155 // Local override 1156 if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) { 1157 $avatar = BP_AVATAR_DEFAULT_THUMB; 1158 1159 // Use the local default image 1160 } else if ( 'local' === $type ) { 1161 $avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man-50.jpg'; 1162 1163 // Use Gravatar's mystery man as fallback 1164 } else { 1165 if ( is_ssl() ) { 1166 $host = 'https://secure.gravatar.com'; 1167 } else { 1168 $host = 'http://www.gravatar.com'; 1169 } 1170 1171 $avatar = $host . '/avatar/00000000000000000000000000000000?d=mm&s=' . bp_core_avatar_thumb_width(); 1172 } 1173 1174 return apply_filters( 'bp_core_avatar_thumb', $avatar ); 1175 }
Note: See TracChangeset
for help on using the changeset viewer.