Ejemplo n.º 1
0
$in_popup = true;
if ($playlist) {
    $page_title = $playlist->name . ' | ' . get_bloginfo('name');
} else {
    $page_title = get_bloginfo('name');
}
if (isset($_GET['iframe']) && $_GET['iframe'] == 'true') {
    $embed = true;
    $in_popup = false;
}
$bg_color_hex = wolf_get_jplayer_option('bg_color') ? wolf_get_jplayer_option('bg_color') : '#353535';
$bg_color_rgba = wolf_get_jplayer_option('bg_color') ? wolf_jplayer_hex_to_rgb(wolf_get_jplayer_option('bg_color')) : wolf_jplayer_hex_to_rgb('#353535');
$opacity = wolf_get_jplayer_option('bg_opacity') ? intval(wolf_get_jplayer_option('bg_opacity')) / 100 : 1;
$font_color = wolf_get_jplayer_option('font_color') ? wolf_get_jplayer_option('font_color') : '#ffffff';
$max_song_count = wolf_get_jplayer_option('song_count_before_scroll');
$playlist_height = wolf_get_jplayer_option('scrollbar') && $max_song_count ? $max_song_count * 37 : '';
?>
<!DOCTYPE html> 
<html <?php 
language_attributes();
?>
>
<head>
	<title><?php 
echo sanitize_text_field($page_title);
?>
</title>
	<link rel="stylesheet" href="<?php 
echo esc_url(WOLF_JPLAYER_PLUGIN_URL . '/assets/css/min/normalize.min.css');
?>
">
Ejemplo n.º 2
0
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
// debug( $_POST);
$playlist_id = intval($_GET['playlist_id']);
$no_flash = wolf_get_jplayer_option('disable_flash');
if (isset($_POST['manage_song']) && wp_verify_nonce($_POST['save_song_nonce'], 'save_song')) {
    if (empty($_POST['song_id'])) {
        wolf_manage_song($playlist_id);
    } else {
        wolf_manage_song($playlist_id, $_POST['song_id']);
    }
}
if (isset($_POST['wolf-songs-action'])) {
    wolf_delete_selected_songs();
}
if (isset($_GET['delete_song'])) {
    wolf_delete_song($_GET['delete_song']);
    unset($_GET);
}
if (!isset($_GET['song_id'])) {
    wolf_song_form($playlist_id);
} else {
    wolf_song_form($playlist_id, $_GET['song_id']);
}
$wolf_jplayer_table = $wpdb->prefix . 'wolf_jplayer';
$songs = $wpdb->get_results("SELECT * FROM {$wolf_jplayer_table} WHERE playlist_id = '{$playlist_id}' ORDER BY position");
if ($songs) {
Ejemplo n.º 3
0
        /**
         * Output jplayer HTML
         *
         * @param int $playlist_id
         * @param bool $in_popup
         * @param bool $embed
         * @return string
         */
        public function jplayer_show_playlist($playlist_id, $in_popup, $embed = false)
        {
            global $wpdb, $options;
            if (wolf_get_jplayer_option('scrollbar')) {
                wp_enqueue_script('mCustomScrollbar');
            }
            wp_enqueue_script('wolf-jplayer');
            $wolf_jplayer_playlists_table = $wpdb->prefix . 'wolf_jplayer_playlists';
            $wolf_jplayer_table = $wpdb->prefix . 'wolf_jplayer';
            $playlist = $wpdb->get_row("SELECT * FROM {$wolf_jplayer_playlists_table} WHERE id = '{$playlist_id}'");
            $songs = $wpdb->get_results("SELECT * FROM {$wolf_jplayer_table} WHERE playlist_id = '{$playlist_id}' ORDER BY position");
            $autoplay = null;
            if ($playlist) {
                $share_title = $playlist->name . ' | ' . get_bloginfo('name');
            } else {
                $share_title = get_bloginfo('name');
            }
            $id = $playlist_id . rand(1, 999);
            if ($playlist && $songs) {
                $autoplay = $playlist->autoplay;
                $max_song_count = wolf_get_jplayer_option('song_count_before_scroll');
                $count_songs = wolf_get_jplayer_option('scrollbar') && $max_song_count ? $max_song_count : count($songs);
                $player_height = 170 + 35 * $count_songs;
                $logo = null;
                $html = $this->head_script($id, $playlist_id, $songs, $in_popup, $autoplay);
                if ($playlist->logo) {
                    $logo = "background-image : url( '" . $playlist->logo . "' );";
                }
                $mobile_class = wp_is_mobile() ? ' wolf-jplayer-is-mobile' : '';
                $scrollbar_class = wolf_get_jplayer_option('scrollbar') ? '  wolf-jplayer-scrollbar' : '';
                $html .= '<!-- jPlayer -->
				<div class="wolf-jplayer-playlist-container' . $mobile_class . $scrollbar_class . '">
					<div class="wolf-jplayer-loader-overlay"><div class="wolf-jplayer-loader"></div></div>
					<div class="wolf-jplayer-playlist">
					<div class="wolf-jp-overlay">
						<div class="wolf-jp-share-container">
							<div class="wolf-jp-share">
							<div>
								<p><strong>Share</strong></p>
							</div>
							<div class="wolf-share-input">
								<label>url : </label>
								<div>
									<input onclick="this.focus();this.select()" type="text" value="' . esc_url(home_url('/')) . 'player/?playlist_id=' . $playlist_id . '">
								</div>
							</div>
							<div class="wolf-share-input">
								<label>embed : </label>
								<div>
								<input onclick="this.focus();this.select()" type="text" value="&lt;iframe width=&quot;100%&quot; height=&quot;' . $player_height . '&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot; src=&quot;' . esc_url(home_url('/')) . 'player/?playlist_id=' . $playlist_id . '&amp;iframe=true&amp;wmode=transparent&quot;&gt;&lt;/iframe&gt;">
								</div>
							</div>
							<div class="clear"></div>
							<div class="wolf-jp-share-socials">
								<a class="wolf-share-jp-popup" href="http://www.facebook.com/sharer.php?u=' . esc_url(home_url('/')) . 'player/?playlist_id=' . $playlist_id . '&t=' . urlencode($share_title) . '" title="' . __('Share on facebook', 'wolf') . '" target="_blank">
								<span id="wolf-jplayer-facebook-button"></span>
								</a>
								<a class="wolf-share-jp-popup" href="http://twitter.com/home?status=' . urlencode($share_title . ' - ') . esc_url(home_url('/')) . 'player/?playlist_id=' . $playlist_id . '" title="' . __('Share on twitter', 'wolf') . '" target="_blank">
								<span id="wolf-jplayer-twitter-button"></span>
								</a>
							</div>
							<span class="close-wolf-jp-share" title="' . __('close', 'wolf') . '">&times;</span>
						</div>
					</div>
				</div>
				<div id="jplayer_container_' . $id . '" class="jplayer_container">
				<div id="jquery_jplayer_' . $id . '" class="jp-jplayer"></div>
					<div id="jp_container_' . $id . '" class="jp-audio">
					<div class="jp-logo" style="' . $logo . '"></div><span title="' . __('share', 'wolf') . '" class="wolf-jp-share-icon"></span>';
                if (!$in_popup) {
                    $html .= '<a href="' . esc_url(home_url('/')) . 'player/?playlist_id=' . $playlist_id . '&amp;iframe=false" class="wolf-jp-popup" title="popup window"></a>';
                }
                $html .= '<div class="jp-type-playlist">
					<div class="jp-gui jp-interface">
						<ul class="jp-controls">
							<li><a href="javascript:;" class="jp-previous" tabindex="1"></a></li>
							<li><a href="javascript:;" class="jp-play" tabindex="1"></a></li>
							<li><a href="javascript:;" class="jp-pause" tabindex="1"></a></li>
							<li><a href="javascript:;" class="jp-next" tabindex="1"></a></li>
							<li><a href="javascript:;" class="jp-stop" tabindex="1"></a></li>
							<li class="wolf-volume">
								<a href="javascript:;" class="jp-mute" tabindex="1" title="mute"></a>
								<a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute"></a>
							</li>
							<li><a href="javascript:;" class="jp-volume-max wolf-volume" tabindex="1" title="max volume"></a></li>
						</ul>
						<div class="jp-progress">
							<div class="jp-seek-bar">
								<div class="jp-play-bar"></div>
							</div>
						</div>
						<div class="jp-volume-bar wolf-volume">
							<div class="jp-volume-bar-value"></div>
						</div>
						<div class="jp-current-time"></div>
						<div class="jp-duration"></div>
						<ul class="jp-toggles">
							<li><a href="javascript:;" class="jp-shuffle" tabindex="1" title="shuffle"></a></li>
							<li><a href="javascript:;" class="jp-shuffle-off" tabindex="1" title="shuffle off"></a></li>
							<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat"></a></li>
							<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off"></a></li>
						</ul>
					</div>

					<div class="jp-playlist">
						<ul>
							<li></li>
						</ul>
					</div>

					<div class="jp-no-solution">
						<span>Update Required</span>
						To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
					</div>

					</div>
				</div>
			</div>
			</div>
			</div>
			<!-- End jPlayer -->';
            } else {
                if (is_user_logged_in()) {
                    $html = '<p style="text-shadow:none!important"><em>' . __('This playlist does not exist or is empty. Please double check the playlist ID and be sure you have uploaded songs.', 'wolf') . '</em></p>';
                } else {
                    $html = '<p style="text-shadow:none!important"><em>' . __('This playlist does not exist or is empty.', 'wolf') . '</em></p>';
                }
            }
            return $html;
        }
/**
 * Output Song form
 *
 * @param int $playlist_id
 * @param int $sing_id
 */
function wolf_song_form($playlist_id = null, $song_id = null)
{
    global $wpdb;
    $wolf_jplayer_playlists_table = $wpdb->prefix . 'wolf_jplayer_playlists';
    $wolf_jplayer_table = $wpdb->prefix . 'wolf_jplayer';
    $no_flash = wolf_get_jplayer_option('disable_flash');
    $playlist = $wpdb->get_row("SELECT * FROM {$wolf_jplayer_playlists_table} WHERE id = '{$playlist_id}'");
    $song_name = null;
    $artist = null;
    $poster = null;
    $itunes = null;
    $amazon = null;
    $buy = null;
    $free = null;
    $submit_value = __('Submit', 'wolf');
    $ogg = null;
    $mp3 = null;
    if ($song_id) {
        $song_id = intval($song_id);
        $song = $wpdb->get_row("SELECT * FROM {$wolf_jplayer_table} WHERE id = '{$song_id}' AND playlist_id = '{$playlist_id}'");
        $song_name = $song->name;
        $ogg = $song->ogg;
        $mp3 = $song->mp3;
        $artist = $song->artist;
        $poster = $song->poster;
        $itunes = $song->itunes;
        $amazon = $song->amazon;
        $buy = $song->buy;
        $free = $song->free;
        $submit_value = __('Save changes', 'wolf');
        // debug($song);
    }
    if ($song_id == null) {
        ?>
	<h3><?php 
        printf(__('Upload a new song in "%s" playlist', 'wolf'), $playlist->name);
        ?>
</h3>
	<p><em><?php 
        _e('Fields marked with * are required', 'wolf');
        ?>
</em></p>
<?php 
    } else {
        ?>
	<h3><?php 
        _e('Update your song', 'wolf');
        ?>
</h3>
<?php 
    }
    ?>
	<form style="margin:0 20px 20px 0" id="jp-form" action="<?php 
    echo esc_url(admin_url('admin.php?page=wolf-jplayer-panel&amp;playlist_id=' . $playlist_id));
    ?>
" method="post">
			<p>
				<label for="song_name"><?php 
    _e('Song title', 'wolf');
    ?>
 *</label>
				<input type="text" name="song_name" value="<?php 
    echo stripslashes($song_name);
    ?>
">
			</p>
			<p>
				<label for="artist"><?php 
    _e('Artist', 'wolf');
    ?>
 : </label>
				<input type="text" name="artist" value="<?php 
    echo $artist;
    ?>
">
			</p>
			<p>
				<label for="mp3"><?php 
    _e('Mp3 URL', 'wolf');
    ?>
 *<br>
				<em><?php 
    _e('(Enter an URL or choose a song from the media library)', 'wolf');
    ?>
 </em>
				</label>
				<input type="text" name="mp3" value="<?php 
    echo $mp3;
    ?>
">
				<a href="#" class="wolf_jplayer_upload_button button"><?php 
    _e('Choose an mp3 file', 'wolf');
    ?>
</a>
			</p>
			<?php 
    if ($no_flash) {
        ?>
			<p>
				<label for="ogg"><?php 
        _e('Ogg URL', 'wolf');
        ?>
 *<br>
				<em><?php 
        _e('(Optional ogg file for firefox and opera)', 'wolf');
        ?>
 </em>
				</label>
				<input type="text" name="ogg" value="<?php 
        echo $ogg;
        ?>
">
				<a href="#" class="wolf_jplayer_upload_button button"><?php 
        _e('Choose an ogg file', 'wolf');
        ?>
</a>
			</p>
			<?php 
    }
    ?>
			<p>
				<label for="poster"><?php 
    _e('Artwork (jpg or png)', 'wolf');
    ?>
 (80px X 80px)</label>
				<input type="hidden" name="poster" value="<?php 
    echo esc_url($poster);
    ?>
">
				<img <?php 
    if (!$poster) {
        echo 'style="display:none;"';
    }
    ?>
 class="wolf_jplayer_img_preview" src="<?php 
    echo esc_url($poster);
    ?>
" alt="poster">
				<a href="#" class="wolf_jplayer_upload_img_button button"><?php 
    _e('Choose an image', 'wolf');
    ?>
</a>
				<a href="#" class="button wolf_jplayer_reset"><?php 
    _e('Clear', 'wolf');
    ?>
</a>
			</p>
			<p>
				<label for="itunes"><?php 
    _e('Itunes URL', 'wolf');
    ?>
</label>
				<input type="text" name="itunes" value="<?php 
    echo esc_url($itunes);
    ?>
">
			</p>
			<p>
				<label for="amazon"><?php 
    _e('Amazon URL', 'wolf');
    ?>
</label>
				<input type="text" name="amazon" value="<?php 
    echo esc_url($amazon);
    ?>
">
			</p>
			<p>
				<label for="buy"><?php 
    _e('Other "buy" URL', 'wolf');
    ?>
</label>
				<input type="text" name="buy" value="<?php 
    echo esc_url($buy);
    ?>
">
			</p>
			<p>
				<label for="free"><?php 
    _e('Free download', 'wolf');
    ?>
</label>
				<input type="checkbox" name="free" <?php 
    echo $free ? 'checked="checked"' : '';
    ?>
>
				<em><?php 
    _e('Will overwrite the "buy" URLs above', 'wolf');
    ?>
</em>
			</p>
			<input type="hidden" name="playlist_id" value="<?php 
    echo absint($playlist_id);
    ?>
">
			<input type="hidden" name="song_id" value="<?php 
    echo absint($song_id);
    ?>
">
			<p>
				<input type="submit" class="button-primary" name="manage_song" value="<?php 
    echo $submit_value;
    ?>
">
			</p>
			<?php 
    wp_nonce_field('save_song', 'save_song_nonce');
    ?>
			<div class="clear"></div>
	</form>
	<div class="clear"></div>

<?php 
    if ($song_id) {
        ?>
	<p><a class="button" href="<?php 
        echo esc_url(admin_url('admin.php?page=wolf-jplayer-panel&amp;playlist_id=' . $playlist_id));
        ?>
"><?php 
        _e('back to the "add a song" form', 'wolf');
        ?>
</a></p>
<?php 
    } else {
        ?>
	<p><a class="button" href="<?php 
        echo esc_url(admin_url('admin.php?page=wolf-jplayer-panel'));
        ?>
"><?php 
        _e('back to the playlist manager', 'wolf');
        ?>
</a></p>
<?php 
    }
    ?>
<script type="text/javascript">
	function Show( section ) {
		document.getElementById( section ).style.display = 'block';
	}
</script>
<?php 
}