plugin_url . "bp-core/js/confirm{$min}.js", array( 'jquery' ), bp_get_version() ); wp_localize_script( 'bp-confirm', 'BP_Confirm', array( 'are_you_sure' => __( 'Are you sure?', 'buddypress' ), ) ); } add_action( 'wp_enqueue_scripts', 'bp_core_confirmation_js' ); add_action( 'admin_enqueue_scripts', 'bp_core_confirmation_js' ); /** * Enqueues jCrop library and hooks BP's custom cropper JS. */ function bp_core_add_jquery_cropper() { wp_enqueue_style( 'jcrop' ); wp_enqueue_script( 'jcrop', array( 'jquery' ) ); add_action( 'wp_head', 'bp_core_add_cropper_inline_js' ); add_action( 'wp_head', 'bp_core_add_cropper_inline_css' ); } /** * Output the inline JS needed for the cropper to work on a per-page basis. */ function bp_core_add_cropper_inline_js() { // Bail if no image was uploaded $image = apply_filters( 'bp_inline_cropper_image', getimagesize( bp_core_avatar_upload_path() . buddypress()->avatar_admin->image->dir ) ); if ( empty( $image ) ) return; // $full_height = bp_core_avatar_full_height(); $full_width = bp_core_avatar_full_width(); // Calculate Aspect Ratio if ( !empty( $full_height ) && ( $full_width != $full_height ) ) { $aspect_ratio = $full_width / $full_height; } else { $aspect_ratio = 1; } // Default cropper coordinates $crop_left = round( $image[0] / 4 ); $crop_top = round( $image[1] / 4 ); $crop_right = $image[0] - $crop_left; $crop_bottom = $image[1] - $crop_top; ?>