当前位置: 首页>>代码示例>>PHP>>正文


PHP Stream::set_session方法代码示例

本文整理汇总了PHP中Stream::set_session方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::set_session方法的具体用法?PHP Stream::set_session怎么用?PHP Stream::set_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream::set_session方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Stream_Playlist constructor
  * If an ID is passed, it should be a stream session ID.
  */
 public function __construct($id = null)
 {
     if ($id != -1) {
         if ($id) {
             Stream::set_session($id);
         }
         $this->id = Stream::$session;
         if (!Session::exists('stream', $this->id)) {
             debug_event('stream_playlist', 'Session::exists failed', 2);
             return false;
         }
         $this->user = intval($GLOBALS['user']->id);
         $sql = 'SELECT * FROM `stream_playlist` WHERE `sid` = ? ORDER BY `id`';
         $db_results = Dba::read($sql, array($this->id));
         while ($row = Dba::fetch_assoc($db_results)) {
             $this->urls[] = new Stream_URL($row);
         }
     }
     return true;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:24,代码来源:stream_playlist.class.php

示例2: songs

 /**
  * songs
  *
  * This returns an xml document from an array of song ids.
  * (Spiffy isn't it!)
  */
 public static function songs($songs, $playlist_data = '')
 {
     if (count($songs) > self::$limit or self::$offset > 0) {
         $songs = array_slice($songs, self::$offset, self::$limit);
     }
     Song::build_cache($songs);
     Stream::set_session($_REQUEST['auth']);
     $string = "";
     // Foreach the ids!
     foreach ($songs as $song_id) {
         $song = new Song($song_id);
         // If the song id is invalid/null or disabled
         if (!$song->id || !$song->enabled) {
             continue;
         }
         $song->format();
         $playlist_track_string = self::playlist_song_tracks_string($song, $playlist_data);
         $tag_string = self::tags_string(Tag::get_top_tags('song', $song_id));
         $rating = new Rating($song_id, 'song');
         $art_url = Art::url($song->album, 'album', $_REQUEST['auth']);
         $string .= "<song id=\"" . $song->id . "\">\n" . "\t<title><![CDATA[" . $song->title . "]]></title>\n" . "\t<artist id=\"" . $song->artist . '"><![CDATA[' . $song->get_artist_name() . "]]></artist>\n" . "\t<album id=\"" . $song->album . '"><![CDATA[' . $song->get_album_name() . "]]></album>\n";
         if ($song->albumartist) {
             $string .= "\t<albumartist id=\"" . $song->albumartist . "\"><![CDATA[" . $song->get_album_artist_name() . "]]></albumartist>\n";
         }
         $string .= $tag_string . "\t<filename><![CDATA[" . $song->file . "]]></filename>\n" . "\t<track>" . $song->track . "</track>\n" . $playlist_track_string . "\t<time>" . $song->time . "</time>\n" . "\t<year>" . $song->year . "</year>\n" . "\t<bitrate>" . $song->bitrate . "</bitrate>\n" . "\t<rate>" . $song->rate . "</rate>\n" . "\t<mode>" . $song->mode . "</mode>\n" . "\t<mime>" . $song->mime . "</mime>\n" . "\t<url><![CDATA[" . Song::play_url($song->id, '', 'api') . "]]></url>\n" . "\t<size>" . $song->size . "</size>\n" . "\t<mbid>" . $song->mbid . "</mbid>\n" . "\t<album_mbid>" . $song->album_mbid . "</album_mbid>\n" . "\t<artist_mbid>" . $song->artist_mbid . "</artist_mbid>\n" . "\t<albumartist_mbid>" . $song->albumartist_mbid . "</albumartist_mbid>\n" . "\t<art><![CDATA[" . $art_url . "]]></art>\n" . "\t<preciserating>" . ($rating->get_user_rating() ?: 0) . "</preciserating>\n" . "\t<rating>" . ($rating->get_user_rating() ?: 0) . "</rating>\n" . "\t<averagerating>" . ($rating->get_average_rating() ?: 0) . "</averagerating>\n" . "\t<composer>" . $song->composer . "</composer>\n" . "\t<channels>" . $song->channels . "</channels>\n" . "\t<comment><![CDATA[" . $song->comment . "]]></comment>\n";
         $string .= "\t<publisher><![CDATA[" . $song->label . "]]></publisher>\n" . "\t<language>" . $song->language . "</language>\n" . "\t<replaygain_album_gain>" . $song->replaygain_album_gain . "</replaygain_album_gain>\n" . "\t<replaygain_album_peak>" . $song->replaygain_album_peak . "</replaygain_album_peak>\n" . "\t<replaygain_track_gain>" . $song->replaygain_track_gain . "</replaygain_track_gain>\n" . "\t<replaygain_track_peak>" . $song->replaygain_track_peak . "</replaygain_track_peak>\n";
         foreach ($song->tags as $tag) {
             $string .= "\t<genre><![CDATA[" . $tag['name'] . "]]></genre>\n";
         }
         $string .= "</song>\n";
     }
     // end foreach
     return self::_header() . $string . self::_footer();
 }
开发者ID:cheese1,项目名称:ampache,代码行数:40,代码来源:xml_data.class.php

示例3: songs

 /**
  * songs
  *
  * This returns an xml document from an array of song ids.
  * (Spiffy isn't it!)
  */
 public static function songs($songs)
 {
     if (count($songs) > self::$limit or self::$offset > 0) {
         $songs = array_slice($songs, self::$offset, self::$limit);
     }
     Song::build_cache($songs);
     Stream::set_session($_REQUEST['auth']);
     $string = "";
     // Foreach the ids!
     foreach ($songs as $song_id) {
         $song = new Song($song_id);
         // If the song id is invalid/null
         if (!$song->id) {
             continue;
         }
         $tag_string = self::tags_string(Tag::get_top_tags('song', $song_id));
         $rating = new Rating($song_id, 'song');
         $art_url = Art::url($song->album, 'album', $_REQUEST['auth']);
         $string .= "<song id=\"" . $song->id . "\">\n" . "\t<title><![CDATA[" . $song->title . "]]></title>\n" . "\t<artist id=\"" . $song->artist . '"><![CDATA[' . $song->get_artist_name() . "]]></artist>\n" . "\t<album id=\"" . $song->album . '"><![CDATA[' . $song->get_album_name() . "]]></album>\n" . $tag_string . "\t<filename><![CDATA[" . $song->file . "]]></filename>\n" . "\t<track>" . $song->track . "</track>\n" . "\t<time>" . $song->time . "</time>\n" . "\t<year>" . $song->year . "</year>\n" . "\t<bitrate>" . $song->bitrate . "</bitrate>\n" . "\t<mode>" . $song->mode . "</mode>\n" . "\t<mime>" . $song->mime . "</mime>\n" . "\t<url><![CDATA[" . Song::play_url($song->id) . "]]></url>\n" . "\t<size>" . $song->size . "</size>\n" . "\t<mbid>" . $song->mbid . "</mbid>\n" . "\t<album_mbid>" . $song->album_mbid . "</album_mbid>\n" . "\t<artist_mbid>" . $song->artist_mbid . "</artist_mbid>\n" . "\t<art><![CDATA[" . $art_url . "]]></art>\n" . "\t<preciserating>" . $rating->get_user_rating() . "</preciserating>\n" . "\t<rating>" . $rating->get_user_rating() . "</rating>\n" . "\t<averagerating>" . $rating->get_average_rating() . "</averagerating>\n" . "</song>\n";
     }
     // end foreach
     return self::_header() . $string . self::_footer();
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:29,代码来源:xml_data.class.php


注:本文中的Stream::set_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。