Changeset 10356 for trunk/src/bp-core/bp-core-cssjs.php
- Timestamp:
- 11/15/2015 07:57:03 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-cssjs.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-cssjs.php
r10155 r10356 28 28 $scripts = apply_filters( 'bp_core_register_common_scripts', array( 29 29 30 // Legacy 30 // Legacy. 31 31 'bp-confirm' => array( 'file' => "{$url}confirm{$min}.js", 'dependencies' => array( 'jquery' ), 'footer' => false ), 32 32 'bp-widget-members' => array( 'file' => "{$url}widget-members{$min}.js", 'dependencies' => array( 'jquery' ), 'footer' => false ), … … 133 133 } 134 134 135 // Enqueue the Attachments scripts for the Avatar UI 135 // Enqueue the Attachments scripts for the Avatar UI. 136 136 bp_attachments_enqueue_scripts( 'BP_Attachment_Avatar' ); 137 137 138 // Add Some actions for Theme backcompat 138 // Add Some actions for Theme backcompat. 139 139 add_action( 'bp_after_profile_avatar_upload_content', 'bp_avatar_template_check' ); 140 140 add_action( 'bp_after_group_admin_content', 'bp_avatar_template_check' ); … … 153 153 } 154 154 155 // Enqueue the Attachments scripts for the Cover Image UI 155 // Enqueue the Attachments scripts for the Cover Image UI. 156 156 bp_attachments_enqueue_scripts( 'BP_Attachment_Cover_Image' ); 157 157 } … … 185 185 } 186 186 187 // Get avatar full width and height 187 // Get avatar full width and height. 188 188 $full_height = bp_core_avatar_full_height(); 189 189 $full_width = bp_core_avatar_full_width(); 190 190 191 // Calculate Aspect Ratio 191 // Calculate Aspect Ratio. 192 192 if ( !empty( $full_height ) && ( $full_width != $full_height ) ) { 193 193 $aspect_ratio = $full_width / $full_height; … … 196 196 } 197 197 198 // Default cropper coordinates 199 200 // Smaller than full-width: cropper defaults to entire image 198 // Default cropper coordinates. 199 // Smaller than full-width: cropper defaults to entire image. 201 200 if ( $image[0] < $full_width ) { 202 201 $crop_left = 0; 203 202 $crop_right = $image[0]; 204 203 205 // Less than 2x full-width: cropper defaults to full-width 204 // Less than 2x full-width: cropper defaults to full-width. 206 205 } elseif ( $image[0] < ( $full_width * 2 ) ) { 207 206 $padding_w = round( ( $image[0] - $full_width ) / 2 ); … … 209 208 $crop_right = $image[0] - $padding_w; 210 209 211 // Larger than 2x full-width: cropper defaults to 1/2 image width 210 // Larger than 2x full-width: cropper defaults to 1/2 image width. 212 211 } else { 213 212 $crop_left = round( $image[0] / 4 ); … … 215 214 } 216 215 217 // Smaller than full-height: cropper defaults to entire image 216 // Smaller than full-height: cropper defaults to entire image. 218 217 if ( $image[1] < $full_height ) { 219 218 $crop_top = 0; 220 219 $crop_bottom = $image[1]; 221 220 222 // Less than double full-height: cropper defaults to full-height 221 // Less than double full-height: cropper defaults to full-height. 223 222 } elseif ( $image[1] < ( $full_height * 2 ) ) { 224 223 $padding_h = round( ( $image[1] - $full_height ) / 2 ); … … 226 225 $crop_bottom = $image[1] - $padding_h; 227 226 228 // Larger than 2x full-height: cropper defaults to 1/2 image height 227 // Larger than 2x full-height: cropper defaults to 1/2 image height. 229 228 } else { 230 229 $crop_top = round( $image[1] / 4 ); … … 273 272 /** 274 273 * Output the inline CSS for the BP image cropper. 275 *276 * @package BuddyPress Core277 274 */ 278 275 function bp_core_add_cropper_inline_css() { … … 362 359 * @since 2.4.0 363 360 * 364 * @param bool $return true to get the inline css361 * @param bool $return True to get the inline css. 365 362 * @return string|array the inline css or an associative array containing 366 363 * the css rules and the style handle … … 369 366 $bp = buddypress(); 370 367 371 // Find the component of the current item 368 // Find the component of the current item. 372 369 if ( bp_is_user() ) { 373 370 374 371 // User is not allowed to upload cover images 375 // no need to carry on 372 // no need to carry on. 376 373 if ( bp_disable_cover_image_uploads() ) { 377 374 return; … … 385 382 386 383 // Users are not allowed to upload cover images for their groups 387 // no need to carry on 384 // no need to carry on. 388 385 if ( bp_disable_group_cover_image_uploads() ) { 389 386 return; … … 403 400 } 404 401 405 // Get the settings of the cover image feature for the current component 402 // Get the settings of the cover image feature for the current component. 406 403 $params = bp_attachments_get_cover_image_settings( $cover_image_object['component'] ); 407 404 … … 411 408 } 412 409 413 // Try to call the callback 410 // Try to call the callback. 414 411 if ( is_callable( $params['callback'] ) ) { 415 412 … … 439 436 ) ) ); 440 437 441 // Finally add the inline css to the handle 438 // Finally add the inline css to the handle. 442 439 if ( ! empty( $inline_css ) ) { 443 440 444 // Used to get the css when Ajax setting the cover image 441 // Used to get the css when Ajax setting the cover image. 445 442 if ( true === $return ) { 446 443 return array(
Note: See TracChangeset
for help on using the changeset viewer.