Skip to:
Content

BuddyPress.org

Changeset 8629


Ignore:
Timestamp:
07/15/2014 11:37:32 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Add conditional brackets and do some output type-casting in bp_core_add_cropper_inline_js().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-cssjs.php

    r8612 r8629  
    6767        // Bail if no image was uploaded
    6868        $image = apply_filters( 'bp_inline_cropper_image', getimagesize( bp_core_avatar_upload_path() . buddypress()->avatar_admin->image->dir ) );
    69         if ( empty( $image ) )
     69        if ( empty( $image ) ) {
    7070                return;
     71        }
    7172
    72         //
     73        // Get avatar full width and height
    7374        $full_height = bp_core_avatar_full_height();
    7475        $full_width  = bp_core_avatar_full_width();
     
    9293                                onChange: showPreview,
    9394                                onSelect: updateCoords,
    94                                 aspectRatio: <?php echo $aspect_ratio; ?>,
    95                                 setSelect: [ <?php echo $crop_left; ?>, <?php echo $crop_top; ?>, <?php echo $crop_right; ?>, <?php echo $crop_bottom; ?> ]
     95                                aspectRatio: <?php echo (int) $aspect_ratio; ?>,
     96                                setSelect: [ <?php echo (int) $crop_left; ?>, <?php echo (int) $crop_top; ?>, <?php echo (int) $crop_right; ?>, <?php echo (int) $crop_bottom; ?> ]
    9697                        });
    97                         updateCoords({x: <?php echo $crop_left; ?>, y: <?php echo $crop_top; ?>, w: <?php echo $crop_right; ?>, h: <?php echo $crop_bottom; ?>});
     98                        updateCoords({x: <?php echo (int) $crop_left; ?>, y: <?php echo (int) $crop_top; ?>, w: <?php echo (int) $crop_right; ?>, h: <?php echo (int) $crop_bottom; ?>});
    9899                });
    99100
     
    107108                function showPreview(coords) {
    108109                        if ( parseInt(coords.w) > 0 ) {
    109                                 var fw = <?php echo $full_width; ?>;
    110                                 var fh = <?php echo $full_height; ?>;
     110                                var fw = <?php echo (int) $full_width; ?>;
     111                                var fh = <?php echo (int) $full_height; ?>;
    111112                                var rx = fw / coords.w;
    112113                                var ry = fh / coords.h;
    113114
    114115                                jQuery( '#avatar-crop-preview' ).css({
    115                                         width: Math.round(rx * <?php echo $image[0]; ?>) + 'px',
    116                                         height: Math.round(ry * <?php echo $image[1]; ?>) + 'px',
     116                                        width: Math.round(rx * <?php echo (int) $image[0]; ?>) + 'px',
     117                                        height: Math.round(ry * <?php echo (int) $image[1]; ?>) + 'px',
    117118                                        marginLeft: '-' + Math.round(rx * coords.x) + 'px',
    118119                                        marginTop: '-' + Math.round(ry * coords.y) + 'px'
Note: See TracChangeset for help on using the changeset viewer.