Example #1
0
    function start($category = FALSE, $args = '', $inline = FALSE)
    {
        global $wpdb;
        static $instance = '0';
        // Increases for every instance since multiple instances are allowed
        if ($category != FALSE) {
            $category = $wpdb->get_var('SELECT `id`, `random`, `autostart` FROM `' . xspf_player::table_categories() . "` WHERE `name` = '{$category}'");
            if (is_null($category)) {
                // If the category does not exists, "ALL" is selected (using FALSE)
                $category = FALSE;
                $random = 0;
                $autostart = get_option('xspf_player_autostart');
            } else {
                $random = $wpdb->get_var(NULL, 1);
                $autostart = $wpdb->get_var(NULL, 2);
            }
        } else {
            $autostart = get_option('xspf_player_autostart');
        }
        if (($width = get_option('xspf_player_width')) == '') {
            $width = 176;
            // Default Width
        }
        if (($height = get_option('xspf_player_height')) == '') {
            $height = 176;
            // Default Height
        }
        $playlist_url = get_option('siteurl') . '/wp-content/plugins/xspf_player/playlist.php';
        $order = '';
        $bgcolor = get_option('xspf_player_bgcolor');
        $fgcolor = get_option('xspf_player_fgcolor');
        $mode = get_option('xspf_player_mode');
        if ($mode == '') {
            // Not defined
            $mode = '1';
        }
        if ($mode == '1') {
            $width = $height = 17;
        }
        if ($mode == '2') {
            $height = 15;
        }
        $sep = '';
        // Separator for params (initially '', but later becomes '&'
        $params = '';
        // List of params parsed: 'param1=value&param2=value&...'
        $url = get_option('siteurl') . '/wp-content/plugins/xspf_player/';
        switch ($mode) {
            case '0':
                $url = get_option('xspf_player_url');
                // Override $url values, and use user settings
                break;
            case '1':
                $url .= 'musicplayer.swf';
                break;
            case '2':
                $url .= 'xspf_player_slim.swf';
                break;
            case '3':
                $url .= 'xspf_player.swf';
                break;
            case '4':
                $url .= 'musicplayer_menu_f6.swf';
                $params .= $sep . 'container_id=xspf_player' . $instance;
                $sep = '&';
                break;
        }
        parse_str($args, $tmpvars);
        foreach ($tmpvars as $varname => $varval) {
            ${$varname} = $varval;
        }
        if ($mode != get_option('xspf_player_mode')) {
            // Player mode has changed?
            $url = get_option('siteurl') . '/wp-content/plugins/xspf_player/';
            switch ($mode) {
                case '0':
                    $url = get_option('xspf_player_url');
                    // Override $url values, and use user settings
                    break;
                case '1':
                    $url .= 'musicplayer.swf';
                    if (!isset($tmpvars['height'])) {
                        // user didn't redefine height, use default button's
                        $height = 17;
                    }
                    if (!isset($tmpvars['width'])) {
                        // user didn't redefine height, use default button's
                        $width = 17;
                    }
                    break;
                case '2':
                    $url .= 'xspf_player_slim.swf';
                    if (!isset($tmpvars['height'])) {
                        // user didn't redefine height, use default slim's
                        $height = 15;
                    }
                    break;
                case '3':
                    $url .= 'xspf_player.swf';
                    break;
                case '4':
                    $url .= 'musicplayer_menu_f6.swf';
                    $params .= $sep . 'container_id=xspf_player' . $instance;
                    $sep = '&';
                    break;
            }
        }
        if ($order != '') {
            $playlist_url .= '?order=' . $order;
        }
        if ($fgcolor != '') {
            $params .= $sep . 'b_fgcolor=' . $fgcolor;
            $sep = '&';
        }
        if ($bgcolor != '') {
            $params .= $sep . 'b_bgcolor=' . $bgcolor;
            $sep = '&';
        }
        if ($autoresume == '1') {
            $params .= $sep . 'autoresume=1';
            $sep = '&';
        }
        if ('4' == $mode) {
            $params .= "&button_width=17&button_height=17&menu_width={$width}&menu_height={$height}";
            $width = $height = '100%';
        }
        ?>
 	 <!-- Wordpress XSPF_Player Plugin v. <?php 
        echo xspf_player::_version();
        ?>
, by Boriel :-) -->
	 <?php 
        if (4 == $mode && !$inline) {
            echo '<div id="xspf_player_margin', $instance, '" style="width:17px; height:17px; position:relative;">', "\n";
        }
        ?>
	  <span id="xspf_player<?php 
        echo $instance;
        ?>
"<?php 
        if (4 == $mode) {
            echo ' style="width:17px; height:17px; position:absolute;"';
        }
        ?>
>
		<object	type="application/x-shockwave-flash" data="<?php 
        xspf_player::echo_player_params($url, $playlist_url, $category, $random, $autostart, $params);
        ?>
" 
		   <?php 
        echo 'width="', $width, '" height="', $height, '"';
        ?>
 codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
			<param name="movie" value="<?php 
        xspf_player::echo_player_params($url, $playlist_url, $category, $random, $autostart, $params);
        ?>
" />
			<param name="allowScriptAccess" value="sameDomain" />
		 	<param name="quality" value="high" />
			<?php 
        if ('4' != $mode && '1' != $mode && $bgcolor != '') {
            echo '<param name="bgcolor" value="#', $bgcolor, '" />' . "\n";
        } else {
            echo '<param name="wmode" value="transparent" />' . "\n";
        }
        ?>
		</object>
	   </span> 
	    <?php 
        if (4 == $mode && !$inline) {
            echo '</div>', "\n";
        }
        $instance++;
    }
Example #2
0
require_once '../../../wp-config.php';
require_once '../../../wp-settings.php';
require_once 'xspf_player_class.php';
echo ' -->', "\n";
$charset = get_option('blog_charset');
?>
<playlist version="0" xmlns = "http://xspf.org/ns/0/">
  <title>XSPF Player</title>
  <annotation>http://musicplayer.sourceforge.net</annotation>
 <trackList>
<?php 
$query = 'SELECT * FROM `' . xspf_player::table() . '` a';
if (isset($_GET['cat']) || isset($_GET['order'])) {
    if (isset($_GET['cat'])) {
        $query .= ' INNER JOIN `' . xspf_player::table_cat_rel() . '` b ' . "ON (a.`id` = b.`idtrack`) WHERE `idcat` = '" . $wpdb->escape($_GET['cat']) . "'";
        $random = $wpdb->get_var('SELECT `random`, `order` FROM `' . xspf_player::table_categories() . "` WHERE `id` = '" . $wpdb->escape($_GET['cat']) . "'");
        if (!$random) {
            $order = $wpdb->get_var(NULL, 1);
        }
    }
    if (isset($_GET['order'])) {
        $order = $_GET['order'];
    }
    if ($order != '') {
        if (isset($_GET['cat'])) {
            $query .= ' AND ';
        } else {
            $query .= ' WHERE ';
        }
        $tracks = xspf_player::order_list($query, $order);
    }