EstudioJuridicoAlmagro_Web/www/wpv_common/helpers/head.php
2013-03-01 18:06:10 +00:00

105 lines
4.3 KiB
PHP

<?php
// put all javascript that has to be included in a separate <script> tag here
// everything else put in combine.php
function wpv_enqueue_scripts() {
$move_bottom = wpv_get_option('javascript_move_bottom', true);
if(!is_admin()) {
if(!wpv_is_login()) {
// modernizr should be on top
wp_enqueue_script( 'modernizr', WPV_JS .'modernizr-1.7.min.js');
if(wpv_get_option('gmap_api_key')) {
wp_enqueue_script('gmap-api', 'http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . wpv_get_option('gmap_api_key'), array(), false, $move_bottom);
wp_enqueue_script('jquery-gmap', WPV_JS .'jquery.gmap-1.1.0-min.js', array('jquery'), THEME_VERSION, $move_bottom);
}
if ( is_singular() && comments_open() ) {
wp_enqueue_script( 'comment-reply', false, false, false, $move_bottom );
}
wp_enqueue_script('jquery-ui-core', false, false, false, $move_bottom);
wp_enqueue_script('jquery-ui-widget', false, false, false, $move_bottom);
wp_enqueue_script('jquery-ui-tabs', false, false, false, $move_bottom);
wp_enqueue_script('jquery-effects-core', false, false, false, $move_bottom);
wp_enqueue_script('video-js', 'http://vjs.zencdn.net/c/video.js', array('jquery'), THEME_VERSION, $move_bottom);
$wpv_js = array(
'wpvslider.uncompressed',
'wpvslider.fx',
'jquery.jplayer.min',
'jquery.swfobject.1-1-1.min',
'jquery.easing.1.3',
'jquery.colorbox-min',
'validator',
'jquery.tweet',
'jquery.ui.accordion',
'jail',
'widgets/contact_form',
'jquery.corner',
'jquery.ui.tabs.rotate',
'wpv_common',
);
foreach($wpv_js as $file) {
wp_enqueue_script( 'front-'.$file, WPV_JS .$file.'.js', array('jquery'), THEME_VERSION, $move_bottom);
}
wp_enqueue_script( 'wpv-theme', WPV_THEME_JS .'wpv_theme.js', array('jquery'), THEME_VERSION, $move_bottom);
}
}
else {
wp_enqueue_script( 'jquery-colorbox', WPV_JS .'jquery.colorbox-min.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'common');
wp_enqueue_script( 'editor');
wp_enqueue_script( 'jquery-ui-sortable');
wp_enqueue_script( 'jquery-ui-draggable');
wp_enqueue_script( 'jquery-ui-tabs');
wp_enqueue_script( 'jquery-ui-range', WPV_ADMIN_ASSETS_URI .'js/jquery.ui.range.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'jquery-ui-slider', WPV_ADMIN_ASSETS_URI .'js/jquery.ui.slider.js', array('jquery', 'jquery-ui-mouse'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'thickbox');
wp_enqueue_script( 'wpv_admin', WPV_ADMIN_ASSETS_URI .'js/wpv_admin.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'ibutton', WPV_ADMIN_ASSETS_URI .'js/jquery.ibutton.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'tools.forms', 'http://cdn.jquerytools.org/1.2.5/form/jquery.tools.min.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'wpv-shortcode', WPV_ADMIN_ASSETS_URI . 'js/shortcode.js', array('jquery'), THEME_VERSION, $move_bottom);
wp_enqueue_script( 'farbtastic' );
if (isset($_GET['gallery_edit_image'])) {
wp_enqueue_script('theme-gallery-edit-image', WPV_ADMIN_ASSETS_URI . 'js/gallery-edit-image.js', array('jquery', 'wpv-back'), THEME_VERSION, $move_bottom);
}
}
}
add_action('init', 'wpv_enqueue_scripts');
// put all css that has to be included in a separate <link> tag here
// everything else put in combine.php
function wpv_enqueue_styles() {
if(!is_admin()) {
if(!wpv_is_login()) {
$css_files = include WPV_THEME_CSS_DIR . 'list.php';
foreach($css_files as $file) {
wp_enqueue_style( 'front-'.$file, WPV_THEME_CSS . $file . '.css', array(), THEME_VERSION);
}
wp_enqueue_style('videojs', 'http://vjs.zencdn.net/c/video-js.css');
}
}
else {
wp_enqueue_style( 'thickbox');
wp_enqueue_style( 'colorbox', WPV_THEME_CSS . 'colorbox/colorbox.css');
wp_enqueue_style( 'wpv_admin', WPV_ADMIN_ASSETS_URI . 'css/wpv_admin.css');
wp_enqueue_style( 'farbtastic' );
if(stristr($_SERVER['HTTP_USER_AGENT'], "msie 7") || stristr($_SERVER['HTTP_USER_AGENT'], "msie 8") ) {
wp_enqueue_style( 'wpv-ie78', WPV_ADMIN_ASSETS_URI . 'css/ie78.css');
}
}
}
add_action('init', 'wpv_enqueue_styles');