Changeset 373 for trunk/bp-core/bp-core-cssjs.php
- Timestamp:
- 10/07/2008 07:16:51 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-cssjs.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-cssjs.php
r309 r373 10 10 */ 11 11 function bp_core_add_js() { 12 echo '<script type="text/javascript">var ajaxurl = "' . get_option('siteurl') . '/wp-admin/admin-ajax.php";</script>'; 13 echo "<script type='text/javascript' src='" . get_option('siteurl') . "/wp-includes/js/jquery/jquery.js?ver=1.2.3'></script>"; 14 echo " 15 <script type='text/javascript' src='" . get_option('siteurl') . "/wp-content/mu-plugins/bp-core/js/jquery/jquery.livequery.pack.js'></script>"; 12 wp_enqueue_script( 'jquery' ); 13 wp_enqueue_script( 'jquery-livequery-pack', site_url() . "/wp-content/mu-plugins/bp-core/js/jquery/jquery.livequery.pack.js", 'jquery' ); 14 wp_enqueue_script( 'bp-general-js', site_url() . '/wp-content/mu-plugins/bp-core/js/general.js' ); 15 } 16 add_action( 'template_redirect', 'bp_core_add_js' ); 16 17 17 echo '<script src="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/js/general.js" type="text/javascript"></script>'; 18 /** 19 * bp_core_add_ajax_js() 20 * 21 * Add the reference to ajaxurl used by all ajax functionality in BuddyPress. 22 * 23 * @package BuddyPress Core 24 * @uses get_option() Selects a site setting from the DB. 25 */ 26 function bp_core_add_ajax_js() { 27 echo '<script type="text/javascript">var ajaxurl = "' . site_url() . '/wp-admin/admin-ajax.php";</script>'; 18 28 } 19 add_action( 'wp_head', 'bp_core_add_ js' );29 add_action( 'wp_head', 'bp_core_add_ajax_js' ); 20 30 21 31 /** … … 28 38 */ 29 39 function bp_core_add_css() { 30 if ( bp_core_user_has_home() && is_user_logged_in() ) 31 echo '<link rel="stylesheet" href="' . get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/admin-bar.css" type="text/css" />'; 40 if ( is_user_logged_in() ) { 41 wp_enqueue_style( 'bp-admin-bar', site_url() . '/wp-content/mu-plugins/bp-core/css/admin-bar.css' ); 42 wp_print_styles(); 43 } 32 44 } 33 45 add_action( 'wp_head', 'bp_core_add_css' ); 34 46 47 48 /** 49 * bp_core_add_admin_js() 50 * 51 * Add the JS needed for all components in the admin area. 52 * 53 * @package BuddyPress Core 54 * @uses get_option() Selects a site setting from the DB. 55 */ 35 56 function bp_core_add_admin_js() { 36 57 if ( strpos( $_GET['page'], 'bp-core' ) !== false ) { 37 wp_enqueue_script( 'bp-account-admin-js', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/js/account-admin.js' );58 wp_enqueue_script( 'bp-account-admin-js', site_url() . '/wp-content/mu-plugins/bp-core/js/account-admin.js' ); 38 59 } 39 } 40 add_action( 'admin_menu', 'bp_core_add_admin_js' ); 41 42 function bp_core_enqueue_admin_js() { 60 43 61 if ( strpos( $_GET['page'], 'bp-core/admin-mods' ) !== false ) { 44 62 wp_enqueue_script('password-strength-meter'); … … 46 64 47 65 if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) { 66 wp_enqueue_script('prototype'); 67 wp_enqueue_script('scriptaculous-root'); 68 wp_enqueue_script('cropper'); 48 69 add_action( 'admin_head', 'bp_core_add_cropper_js' ); 49 70 } 50 71 } 51 add_action( 'admin_menu', 'bp_core_ enqueue_admin_js' );72 add_action( 'admin_menu', 'bp_core_add_admin_js' ); 52 73 53 function bp_core_enqueue_admin_css() { 74 75 /** 76 * bp_core_add_admin_css() 77 * 78 * Add the CSS needed for all components in the admin area. 79 * 80 * @package BuddyPress Core 81 * @uses get_option() Selects a site setting from the DB. 82 */ 83 function bp_core_add_admin_css() { 54 84 if ( strpos( $_GET['page'], 'bp-core/homebase-creation' ) !== false ) { 55 wp_enqueue_style( 'bp-core-home-base-css', get_option('siteurl') . '/wp-content/mu-plugins/bp-core/css/home-base.css' );85 wp_enqueue_style( 'bp-core-home-base-css', site_url() . '/wp-content/mu-plugins/bp-core/css/home-base.css' ); 56 86 } 57 87 } 58 add_action( 'admin_menu', 'bp_core_enqueue_admin_css' ); 88 add_action( 'admin_menu', 'bp_core_add_admin_css' ); 89 90 91 /** 92 * bp_core_add_cropper_js() 93 * 94 * Adds the JS needed for general avatar cropping. 95 * 96 * @package BuddyPress Core 97 */ 98 function bp_core_add_cropper_js() { 99 ?> 100 <script type="text/javascript"> 101 function cropAndContinue() { 102 jQuery('#avatar_v1').slideUp(); 103 jQuery('#avatar_v2').slideDown('normal', function(){ 104 v2Cropper(); 105 }); 106 } 107 108 function v1Cropper() { 109 v1Crop = new Cropper.ImgWithPreview( 110 'crop-v1-img', 111 { 112 ratioDim: { x: <?php echo round(CORE_AVATAR_V1_W / CORE_AVATAR_V1_H, 5); ?>, y: 1 }, 113 minWidth: <?php echo CORE_AVATAR_V1_W; ?>, 114 minHeight: <?php echo CORE_AVATAR_V1_H; ?>, 115 prevWidth: <?php echo CORE_AVATAR_V1_W; ?>, 116 prevHeight: <?php echo CORE_AVATAR_V1_H; ?>, 117 onEndCrop: onEndCropv1, 118 previewWrap: 'crop-preview-v1' 119 } 120 ); 121 } 122 123 function onEndCropv1(coords, dimensions) { 124 jQuery('#v1_x1').val(coords.x1); 125 jQuery('#v1_y1').val(coords.y1); 126 jQuery('#v1_x2').val(coords.x2); 127 jQuery('#v1_y2').val(coords.y2); 128 jQuery('#v1_w').val(dimensions.width); 129 jQuery('#v1_h').val(dimensions.height); 130 } 131 132 <?php if (CORE_AVATAR_V2_W !== false && CORE_AVATAR_V2_H !== false) { ?> 133 function v2Cropper() { 134 v1Crop = new Cropper.ImgWithPreview( 135 'crop-v2-img', 136 { 137 ratioDim: { x: <?php echo round(CORE_AVATAR_V2_W / CORE_AVATAR_V2_H, 5); ?>, y: 1 }, 138 minWidth: <?php echo CORE_AVATAR_V2_W; ?>, 139 minHeight: <?php echo CORE_AVATAR_V2_H; ?>, 140 prevWidth: <?php echo CORE_AVATAR_V2_W; ?>, 141 prevHeight: <?php echo CORE_AVATAR_V2_H; ?>, 142 onEndCrop: onEndCropv2, 143 previewWrap: 'crop-preview-v2' 144 } 145 ); 146 } 147 <?php } ?> 148 149 function onEndCropv2(coords, dimensions) { 150 jQuery('#v2_x1').val(coords.x1); 151 jQuery('#v2_y1').val(coords.y1); 152 jQuery('#v2_x2').val(coords.x2); 153 jQuery('#v2_y2').val(coords.y2); 154 jQuery('#v2_w').val(dimensions.width); 155 jQuery('#v2_h').val(dimensions.height); 156 } 157 </script> 158 <?php 159 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)