ASong2U_Web/wp-content/themes/score/video-slider.php

329 lines
16 KiB
PHP
Raw Normal View History

<!--Begin Slider-->
<?php
require(ghostpool_inc . 'options.php');
$_ishome = (is_home() OR is_front_page());
if ( is_user_logged_in() ):
global $gp_settings;
global $current_user, $bp;
get_currentuserinfo();
?>
<?php
if ($_ishome || ( $bp->current_component == BP_DEDICATION_SLUG )) {
$posts_per_page = $theme_video_slides;
$dedication_orderby = "date";
$dedication_order = "DESC";
$category_name = 'dedication';
$post_status = array('publish', 'private');
$args = array(
'post_type' => array('post'),
'order' => $dedication_order,
'orderby' => $dedication_orderby,
'posts_per_page' => -1,
'post_status' => $post_status,
'category_name' => $category_name,
);
query_posts($args);
}
if (is_singular()) {
//
}
if (have_posts()) {
$slide_counter = 0;
$urls_video = array();
?>
<!--Begin Slider Wrapper-->
<div id="slider-wrapper">
<div id="dedicationTitle_container"><h2 id="dedicationTitle"></h2></div>
<div id="componentWrapper">
<div class="mediaWrapper">
<div class="youtubeHolder"></div>
<div class="vimeoHolder"></div>
</div>
<div class="thumbHolder">
<div class="thumbContainer"><div class="thumbInnerContainer"></div></div>
<div class="thumbBackward"><img src="<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_backward_v.png" alt="" width="31" height="21" /></div>
<div class="thumbForward"><img src="<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_forward_v.png" alt="" width="31" height="21" /></div>
</div>
<div class="mediaPreloader"></div>
<div class="componentPlaylist">
<ul id='playlist'>
<?php
while (have_posts()) : the_post(); include('loop-dedication-data.php');
// Si ya hemos visto más de 'posts_per_page' dedicatorias, salgo del buble
if ($slide_counter == $posts_per_page) {
break;
}
/*$from_user_id = get_the_author_meta('ID');
$to_user_id = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
$to_user = get_user_by('id', $to_user_id);
$to_user_email = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);*/
$displayed_id = bp_displayed_user_id();
// Perfil del usuario: sólo mostrar las dedicadas por él y para él. El resto se descartan.
if ( $bp->current_component == BP_DEDICATION_SLUG ) {
if (($displayed_id != $gp_settings['from_user_id']) && ($displayed_id != $gp_settings['to_user_id'])) {
continue; // me salto esta dedicatoria
}
}
// Página de inicio / página del video: Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') {
if (($current_user->ID != $gp_settings['from_user_id']) && ($current_user->ID != $gp_settings['to_user_id'])) {
continue; // me salto esta dedicatoria
}
}
/*$video = get_post_meta($post->ID, 'ghostpool_dedication_url', true);
$artist = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
$song = get_post_meta($post->ID, 'ghostpool_dedication_song', true);*/
$video = $gp_settings['video'];
if ($_ishome) {
if ($theme_homepage_not_repeat_videos) {
// Si la URL del video ya ha salido en una dedicatoria anterior, me la salto
if (in_array($video, $urls_video)) {
continue;
}
}
}
$urls_video[] = $video;
// Video Type
$vimeo = strpos($video, "vimeo.com");
$yt1 = strpos($video, "youtube.com");
$yt2 = strpos($video, "youtu.be");
if (($vimeo) OR ($yt1) OR ($yt2)) {
if ($yt2) { //youtu.be
$video_id = substr(parse_url($video, PHP_URL_PATH), 1);
$data_type = 'youtube_single';
$data_path = 'http://gdata.youtube.com/feeds/api/videos/' . $video_id . '?v=2&amp;alt=jsonc';
}
if ($yt1) { //youtube.com
$video = parse_str(parse_url($video, PHP_URL_QUERY), $my_array_of_vars);
$video_id = $my_array_of_vars['v'];
$data_type = 'youtube_single';
$data_path = 'http://gdata.youtube.com/feeds/api/videos/' . $video_id . '?v=2&amp;alt=jsonc';
}
if ($vimeo) { //vimeo.com
$video_id = substr(parse_url($video, PHP_URL_PATH), 1);
$data_type = 'vimeo_single';
$data_path = 'http://vimeo.com/api/v2/video/' . $video_id . '.json';
}
?>
<li data-type='<?php echo $data_type; ?>' data-path='<?php echo $data_path; ?>'>
<span id="postdata-id-<?php echo $slide_counter; ?>"><?php the_ID(); ?></span>
<span id="postdata-title-<?php echo $slide_counter; ?>"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span>
<span id="postdata-artist-<?php echo $slide_counter; ?>"><?php echo $gp_settings['artist']; ?></span>
<span id="postdata-song-<?php echo $slide_counter; ?>"><?php echo $gp_settings['song']; ?></span>
<span id="postdata-comments-<?php echo $slide_counter; ?>">
<?php require('home-comments.php'); ?>
</span>
<span id="postdata-from-to-<?php echo $slide_counter; ?>">
<?php echo $gp_settings['from_flag']; ?><span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>&nbsp;
<?php echo $gp_settings['to_flag']; ?><span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</span>
</li>
<?php } $slide_counter++; ?>
<?php endwhile; ?>
</ul>
</div> <!-- componentPlaylist -->
<div class="slideshow_controls">
<?php if ($slide_counter > 1) { ?>
<div class="controls_prev"><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/backward.png' width='11' height='16' alt='controls_prev'/></div>
<div class="controls_playlist_toggle"><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/close.png' width='16' height='16' alt='controls_playlist_toggle'/></div>
<div class="controls_next"><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/forward.png' width='11' height='16' alt='controls_next'/></div>
<?php } ?>
<div class="player_share"><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/share.png' width='40' height='40' alt=''/></div>
<div id="shareHolder">
<div id="shareHolderInner">
<div id="fb-root"></div>
<div id="shareme" data-url="" data-text="Make your sharing widget with Sharrre"></div>
<div id='fsbbtn'><a href="https://www.facebook.com/" target='_blank'><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/facebook.png' width='20' height='20' alt='facebook'/></a></div>
<div id='twtbtn'><a href="https://www.twitter.com/" target='_blank'><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/twitter.png' width='20' height='20' alt='twitter'/></a></div>
<div id='gpsbtn'><a href="https://plus.google.com/" target='_blank'><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/google_plus.png' width='20' height='20' alt='google'/></a></div>
<div id='mysbtn'><a href="https://myspace.com/" target='_blank'><img src='<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/myspace.png' width='20' height='20' alt='google'/></a></div>
</div>
</div>
</div>
</div>
<div id="dedicationFooter_container">
<div class="columns two first text-left">
<h3 id="dedicationArtits"></h3>
<h4 id="dedicationSong"></h4>
</div>
<div class="columns two last">
<?php if(function_exists('bp_is_active')) { ?>
<a id="dedicate_this_song_button" href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button" title="Dedicate this song">Dedicate this song</a>
<a href="<?php echo bp_loggedin_user_domain() . bp_get_dedication_slug() ?>/new-dedication/" class="button" title="Dedicate a song">Dedicate a song</a>
<?php } ?>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/lib/scripts/jquery.jtypewriter.js"></script>
<script type="text/javascript">
var aIndex=-1;
var oUrl='';
jQuery.noConflict();
jQuery(window).load(function() {
jQuery('#componentWrapper').videoGallery({
componentFixedSize: true,
animateVideoSizeOnPlaylistClose: true,
thumbOrientation: 'vertical',
activePlaylist:'playlist',
activeVideo:0,
autoPlay:true,
loopingOn:true,
randomPlay:false,
autoAdvanceToNextVideo:true,
youtubeChromeless:true,
thumbWidth: 120,
thumbHeight: 90,
thumbsScrollValue: 150,
autoOpenPlaylist: false,
closePlaylistOnVideoSelect: false,
thumbBackgroundColor: '#fff',
iconLoader: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/loader.gif',
iconClose: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/close.png',
iconCloseOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/close_on.png',
iconOpen: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/open.png',
iconOpenOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/open_on.png',
iconBackwardOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/backward_on.png',
iconBackward: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/backward.png',
iconForwardOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/forward_on.png',
iconForward: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/forward.png',
iconShare: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/share.png',
iconShareOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/share_on.png',
iconThumbForward: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_forward.png',
iconThumbForwardV: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_forward_v.png',
iconThumbForwardOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_forward_on.png',
iconThumbForwardVOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_forward_v_on.png',
iconThumbBackward: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_backward.png',
iconThumbBackwardV: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_backward_v.png',
iconThumbBackwardOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_backward_on.png',
iconThumbBackwardVOn: '<?php echo get_template_directory_uri(); ?>/lib/scripts/videoslider/data/icons/thumb_backward_v_on.png'
});
setInterval("updateInfo()", 500);
});
function updateInfo() {
var id = jQuery.fn.videoGallery.getMediaID();
if ((aIndex != id) && (id >= 0)) {
aIndex = id;
if (oUrl == '') {
oUrl = jQuery('#dedicate_this_song_button').attr("href");
}
var the_id = jQuery('#postdata-id-' + id).text();
var new_title = jQuery('#postdata-title-' + id).html();
var from_to = jQuery('#postdata-from-to-' + id).html();
var artist = jQuery('#postdata-artist-' + id).html();
var song = jQuery('#postdata-song-' + id).html();
var comments = jQuery('#postdata-comments-' + id).html();
var nUrl = oUrl + 'id/' + the_id;
jQuery('#dedicate_this_song_button').attr("href", nUrl);
jQuery('#dedication-data-panel').hide('fast');
jQuery('#dedication-data-panel').slideUp(
'fast',
function() { jQuery('#dedication-data-panel').html(from_to); }
);
jQuery('#dedication-data-panel').slideDown();
jQuery('#dedicationFooter_container').slideUp(
'fast',
function() {
jQuery('#dedicationArtits').html(artist);
jQuery('#dedicationSong').html(song);
}
);
jQuery('#dedicationFooter_container').slideDown(
'fast',
function() {}
);
jQuery('#dedicationTitle').html(new_title);
shrinkTitle();
jQuery('#dedicationTitle a').jTypeWriter();
jQuery('#dedicationComments_container').slideUp(
'fast',
function() { jQuery('#dedicationComments_container').html(comments); }
);
jQuery('#dedicationComments_container').slideDown();
}
}
function shrinkTitle()
{
var textH1 = document.getElementById("dedicationTitle");
var textDiv = document.getElementById("dedicationTitle_container");
textH1.style.fontSize = 42+"px";
while(textH1.offsetWidth > textDiv.offsetWidth)
{
size = parseInt(textH1.style.fontSize.replace("px",""));
size -= 1;
textH1.style.fontSize = size+"px";
}
textH1.style.fontSize -= 10+"px";
}
jQuery('#shareme').sharrre({
share: {
googlePlus: true,
facebook: true,
twitter: true
},
buttons: {
googlePlus: {size: 'medium'},
facebook: {layout: 'button_count'},
twitter: {count: 'horizontal'}
},
enableHover: false,
enableCounter: false,
enableTracking: false
});
</script>
<?php } ?>
<!--End Slider-->
<?php endif; ?>