本文整理汇总了PHP中Search::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::format方法的具体用法?PHP Search::format怎么用?PHP Search::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::format方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: T_
</th>
<th class="cel_owner optional"><?php
echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=smartplaylist&sort=user', T_('Owner'), 'playlist_sort_owner');
?>
</th>
<th class="cel_action essential"><?php
echo T_('Actions');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($object_ids as $playlist_id) {
$libitem = new Search($playlist_id, 'song');
$libitem->format();
?>
<tr class="<?php
echo UI::flip_class();
?>
" id="smartplaylist_row_<?php
echo $libitem->id;
?>
">
<?php
require AmpConfig::get('prefix') . UI::find_template('show_search_row.inc.php');
?>
</tr>
<?php
}
// end foreach ($playlists as $playlist)
示例2: Search
break;
case 'delete_playlist':
// If we made it here, we didn't have sufficient rights.
UI::access_denied();
break;
case 'show_playlist':
$playlist = new Search($_REQUEST['playlist_id'], 'song');
$playlist->format();
$object_ids = $playlist->get_items();
require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
break;
case 'update_playlist':
$playlist = new Search($_REQUEST['playlist_id'], 'song');
if ($playlist->has_access()) {
$playlist->parse_rules(Search::clean_request($_REQUEST));
$playlist->update();
$playlist->format();
} else {
UI::access_denied();
break;
}
$object_ids = $playlist->get_items();
require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
break;
default:
$object_ids = $playlist->get_items();
require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
break;
}
// switch on the action
UI::show_footer();
示例3: databases
/**
* databases
*/
public static function databases($input)
{
// $revision = $_GET['revision-number'];
$o = '';
// Database list
if (count($input) == 0) {
self::check_session('daap.serverdatabases');
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$o .= self::tlv('dmap.specifiedtotalcount', 1);
$o .= self::tlv('dmap.returnedcount', 1);
$r = self::tlv('dmap.itemid', 1);
$r .= self::tlv('dmap.persistentid', 1);
$r .= self::tlv('dmap.itemname', 'Ampache');
$counts = Catalog::count_medias();
$r .= self::tlv('dmap.itemcount', $counts['songs']);
$r .= self::tlv('dmap.containercount', count(Playlist::get_playlists()));
$r = self::tlv('dmap.listingitem', $r);
$o .= self::tlv('dmap.listing', $r);
$o = self::tlv('daap.serverdatabases', $o);
} elseif (count($input) == 2) {
if ($input[1] == 'items') {
// Songs list
self::check_session('daap.databasesongs');
$o = self::catalog_songs();
$o = self::tlv('daap.databasesongs', $o);
} elseif ($input[1] == 'containers') {
// Playlist list
self::check_session('daap.databaseplaylists');
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$playlists = Playlist::get_playlists();
$searches = Search::get_searches();
$o .= self::tlv('dmap.specifiedtotalcount', count($playlists) + count($searches) + 1);
$o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches) + 1);
$l = self::base_library();
foreach ($playlists as $playlist_id) {
$playlist = new Playlist($playlist_id);
$playlist->format();
$l .= self::tlv_playlist($playlist);
}
foreach ($searches as $search_id) {
$playlist = new Search($search_id, 'song');
$playlist->format();
$l .= self::tlv_playlist($playlist);
}
$o .= self::tlv('dmap.listing', $l);
$o = self::tlv('daap.databaseplaylists', $o);
}
} elseif (count($input) == 3) {
// Stream
if ($input[1] == 'items') {
$finfo = explode('.', $input[2]);
if (count($finfo) == 2) {
$id = intval($finfo[0]);
$type = $finfo[1];
$params = '';
$headers = apache_request_headers();
$client = $headers['User-Agent'];
if (!empty($client)) {
$params .= '&client=' . $client;
}
$params .= '&transcode_to=' . $type;
$url = Song::play_url($id, $params, 'api', true);
self::follow_stream($url);
exit;
}
}
} elseif (count($input) == 4) {
// Playlist
if ($input[1] == 'containers' && $input[3] == 'items') {
$id = intval($input[2]);
self::check_session('daap.playlistsongs');
if ($id == Daap_Api::BASE_LIBRARY) {
$o = self::catalog_songs();
$o = self::tlv('daap.playlistsongs', $o);
} else {
if ($id > Daap_Api::AMPACHEID_SMARTPL) {
$id -= Daap_Api::AMPACHEID_SMARTPL;
$playlist = new Search($id, 'song');
} else {
$playlist = new Playlist($id);
}
if ($playlist->id) {
$meta = explode(',', strtolower($_GET['meta']));
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$items = $playlist->get_items();
$song_ids = array();
foreach ($items as $item) {
if ($item['object_type'] == 'song') {
$song_ids[] = $item['object_id'];
}
}
if (AmpConfig::get('memory_cache')) {
Song::build_cache($song_ids);
}
//.........这里部分代码省略.........
示例4: Radio
case 'playlist_title':
$key = 'playlist_row_' . $_POST['id'];
if (isset($playlist)) {
$playlist->update($_POST);
$playlist->format();
$count = $playlist->get_song_count();
}
break;
case 'smartplaylist_row':
case 'smartplaylist_title':
$key = 'smartplaylist_row_' . $_POST['id'];
if (isset($smartpl)) {
$smartpl->name = $_POST['name'];
$smartpl->type = $_POST['pl_type'];
$smartpl->update();
$smartpl->format();
}
break;
case 'live_stream_row':
$key = 'live_stream_' . $_POST['id'];
Radio::update($_POST);
$radio = new Radio($_POST['id']);
$radio->format();
break;
case 'channel_row':
$key = 'channel_row_' . $_POST['id'];
$channel = new Channel($_POST['id']);
$channel->update($_POST);
break;
case 'broadcast_row':
$key = 'broadcast_row_' . $_POST['id'];
示例5: _musicChilds
public static function _musicChilds($prmPath, $prmQuery, $start, $count)
{
$mediaItems = array();
$maxCount = 0;
$queryData = array();
parse_str($prmQuery, $queryData);
$parent = 'amp://music' . $prmPath;
$pathreq = explode('/', $prmPath);
if ($pathreq[0] == '' && count($pathreq) > 0) {
array_shift($pathreq);
}
switch ($pathreq[0]) {
case 'artists':
switch (count($pathreq)) {
case 1:
// Get artists list
//$artists = Catalog::get_artists();
//list($maxCount, $artists) = self::_slice($artists, $start, $count);
$artists = Catalog::get_artists(null, $count, $start);
list($maxCount, $artists) = array(999999, $artists);
foreach ($artists as $artist) {
$artist->format();
$mediaItems[] = self::_itemArtist($artist, $parent);
}
break;
case 2:
// Get artist's albums list
$artist = new Artist($pathreq[1]);
if ($artist->id) {
$album_ids = $artist->get_albums();
list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
foreach ($album_ids as $album_id) {
$album = new Album($album_id);
$album->format();
$mediaItems[] = self::_itemAlbum($album, $parent);
}
}
break;
}
break;
case 'albums':
switch (count($pathreq)) {
case 1:
// Get albums list
//!!$album_ids = Catalog::get_albums();
//!!list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
$album_ids = Catalog::get_albums($count, $start);
list($maxCount, $album_ids) = array(999999, $album_ids);
foreach ($album_ids as $album_id) {
$album = new Album($album_id);
$album->format();
$mediaItems[] = self::_itemAlbum($album, $parent);
}
break;
case 2:
// Get album's songs list
$album = new Album($pathreq[1]);
if ($album->id) {
$song_ids = $album->get_songs();
list($maxCount, $song_ids) = self::_slice($song_ids, $start, $count);
foreach ($song_ids as $song_id) {
$song = new Song($song_id);
$song->format();
$mediaItems[] = self::_itemSong($song, $parent);
}
}
break;
}
break;
case 'songs':
switch (count($pathreq)) {
case 1:
// Get songs list
$catalogs = Catalog::get_catalogs();
foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$songs = $catalog->get_songs();
list($maxCount, $songs) = self::_slice($songs, $start, $count);
foreach ($songs as $song) {
$song->format();
$mediaItems[] = self::_itemSong($song, $parent);
}
}
break;
}
break;
case 'playlists':
switch (count($pathreq)) {
case 1:
// Get playlists list
$pl_ids = Playlist::get_playlists();
list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
foreach ($pl_ids as $pl_id) {
$playlist = new Playlist($pl_id);
$playlist->format();
$mediaItems[] = self::_itemPlaylist($playlist, $parent);
}
break;
case 2:
// Get playlist's songs list
//.........这里部分代码省略.........