本文整理汇总了PHP中Artist::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::format方法的具体用法?PHP Artist::format怎么用?PHP Artist::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_favorites
/**
* get_favorites
* returns an array of your $type favorites
*/
public function get_favorites($type)
{
$results = Stats::get_user(AmpConfig::get('popular_threshold'), $type, $this->id, 1);
$items = array();
foreach ($results as $r) {
/* If its a song */
if ($type == 'song') {
$data = new Song($r['object_id']);
$data->count = $r['count'];
$data->format();
$data->f_link;
$items[] = $data;
} elseif ($type == 'album') {
$data = new Album($r['object_id']);
//$data->count = $r['count'];
$data->format();
$items[] = $data;
} elseif ($type == 'artist') {
$data = new Artist($r['object_id']);
//$data->count = $r['count'];
$data->format();
$data->f_name = $data->f_link;
$items[] = $data;
} elseif ($type == 'genre') {
$data = new Genre($r['object_id']);
//$data->count = $r['count'];
$data->format();
$data->f_name = $data->f_link;
$items[] = $data;
}
}
// end foreach
return $items;
}
示例2: foreach
?>
</label>
<?php
foreach ($artists as $a) {
?>
<div class="np_cell cel_similar_artist">
<?php
if (is_null($a['id'])) {
if (AmpConfig::get('wanted') && $a['mbid']) {
echo "<a class=\"missing_album\" href=\"" . AmpConfig::get('web_path') . "/artists.php?action=show_missing&mbid=" . $a['mbid'] . "\" title=\"" . scrub_out($a['name']) . "\">" . scrub_out($a['name']) . "</a>";
} else {
echo scrub_out($a['name']);
}
} else {
$artist = new Artist($a['id']);
$artist->format();
echo $artist->f_link;
}
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
<?php
if ($songs) {
示例3: load_latest_artist
/**
* load_latest_artist
* This loads in the latest added artists
* @return array
*/
public static function load_latest_artist()
{
$ids = Stats::get_newest('artist', 10);
$results = array();
foreach ($ids as $id) {
$artist = new Artist($id);
$artist->format();
$xml_array = array('title' => $artist->f_name, 'link' => $artist->link, 'description' => $artist->summary, 'image' => Art::url($artist->id, 'artist', null, 2), 'comments' => '', 'pubDate' => '');
$results[] = $xml_array;
}
// end foreach
return $results;
}
示例4: library_metadata
public static function library_metadata($params)
{
$r = Plex_XML_Data::createLibContainer();
$n = count($params);
$litem = null;
$createMode = $_SERVER['REQUEST_METHOD'] == 'POST';
$editMode = $_SERVER['REQUEST_METHOD'] == 'PUT';
if ($n > 0) {
$key = $params[0];
$id = Plex_XML_Data::getAmpacheId($key);
if ($editMode) {
self::check_access(50);
}
if ($n == 1) {
// Should we check that files still exists here?
$checkFiles = $_REQUEST['checkFiles'];
$extra = $_REQUEST['includeExtra'];
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addArtist($r, $litem);
} elseif (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addAlbum($r, $litem);
} elseif (Plex_XML_Data::isTrack($key)) {
$litem = new Song($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addSong($r, $litem);
} elseif (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null, 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addTVShow($r, $litem);
} elseif (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::addTVShowSeason($r, $litem);
} elseif (Plex_XML_Data::isVideo($key)) {
$litem = Video::create_from_id($id);
if ($editMode) {
$dmap = array('title' => null, 'year' => null, 'originallyAvailableAt' => 'release_date', 'originalTitle' => 'original_name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
$litem->format();
$subtype = strtolower(get_class($litem));
if ($subtype == 'tvshow_episode') {
Plex_XML_Data::addEpisode($r, $litem, true);
} elseif ($subtype == 'movie') {
Plex_XML_Data::addMovie($r, $litem, true);
}
} elseif (Plex_XML_Data::isPlaylist($key)) {
$litem = new Playlist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name');
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addPlaylist($r, $litem);
}
} else {
$subact = $params[1];
if ($subact == "children") {
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
Plex_XML_Data::setArtistRoot($r, $litem);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
Plex_XML_Data::setAlbumRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
Plex_XML_Data::setTVShowRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::setTVShowSeasonRoot($r, $litem);
}
}
}
//.........这里部分代码省略.........
示例5: array
$search = $_REQUEST['search'];
$target = $_REQUEST['target'];
$limit = $_REQUEST['limit'] ?: 5;
$results = array();
if ($target == 'anywhere' || $target == 'artist') {
$searchreq = array('limit' => $limit, 'type' => 'artist', 'rule_1_input' => $search, 'rule_1_operator' => '2', 'rule_1' => 'name');
$sres = Search::run($searchreq);
// Litmit not reach, new search with another operator
if (count($sres) < $limit) {
$searchreq['limit'] = $limit - count($sres);
$searchreq['rule_1_operator'] = '0';
$sres = array_unique(array_merge($sres, Search::run($searchreq)));
}
foreach ($sres as $id) {
$artist = new Artist($id);
$artist->format(false);
$results[] = array('type' => T_('Artists'), 'link' => $artist->link, 'label' => $artist->name, 'value' => $artist->name, 'rels' => '', 'image' => Art::url($artist->id, 'artist', null, 10));
}
}
if ($target == 'anywhere' || $target == 'album') {
$searchreq = array('limit' => $limit, 'type' => 'album', 'rule_1_input' => $search, 'rule_1_operator' => '2', 'rule_1' => 'title');
$sres = Search::run($searchreq);
// Litmit not reach, new search with another operator
if (count($sres) < $limit) {
$searchreq['limit'] = $limit - count($sres);
$searchreq['rule_1_operator'] = '0';
$sres = array_unique(array_merge($sres, Search::run($searchreq)));
}
foreach ($sres as $id) {
$album = new Album($id);
$album->format(true);
示例6: format
/**
* Format data.
*/
public function format()
{
if ($this->artist) {
$artist = new Artist($this->artist);
$artist->format();
$this->f_artist_link = $artist->f_link;
} else {
$wartist = Wanted::get_missing_artist($this->artist_mbid);
$this->f_artist_link = $wartist['link'];
}
$this->link = AmpConfig::get('web_path') . "/albums.php?action=show_missing&mbid=" . $this->mbid . "&artist=" . $this->artist . "&artist_mbid=" . $this->artist_mbid . "\" title=\"" . $this->name;
$this->f_link = "<a href=\"" . $this->link . "\">" . $this->name . "</a>";
$user = new User($this->user);
$user->format();
$this->f_user = $user->f_name;
}
示例7: _setCustomView
protected static function _setCustomView(SimpleXMLElement $xml, $data)
{
foreach ($data as $key => $value) {
foreach ($value as $id) {
if ($key == 'artist') {
$artist = new Artist($id);
$artist->format();
self::addArtist($xml, $artist);
} elseif ($key == 'album') {
$album = new Album($id);
$album->format();
self::addAlbum($xml, $album);
} elseif ($key == 'song') {
$song = new Song($id);
$song->format();
self::addSong($xml, $song);
}
}
}
}
示例8: Artist
</tr>
</thead>
<tbody>
<?php
// Cache the ratings we are going to use
if (AmpConfig::get('ratings')) {
Rating::build_cache('artist', $object_ids);
}
// Cache the userflags we are going to use
if (AmpConfig::get('userflags')) {
Userflag::build_cache('artist', $object_ids);
}
/* Foreach through every artist that has been passed to us */
foreach ($object_ids as $artist_id) {
$libitem = new Artist($artist_id);
$libitem->format();
?>
<tr id="artist_<?php
echo $libitem->id;
?>
" class="<?php
echo UI::flip_class();
?>
">
<?php
require AmpConfig::get('prefix') . '/templates/show_artist_row.inc.php';
?>
</tr>
<?php
}
?>
示例9: get_artist_info
/**
* get_artist_info
* Returns artist information
*/
public static function get_artist_info($artist_id, $fullname = '')
{
$artist = null;
if ($artist_id) {
$artist = new Artist($artist_id);
$artist->format();
$fullname = $artist->f_full_name;
// Data newer than 6 months, use it
if ($artist->last_update + 15768000 > time()) {
$results = array();
$results['summary'] = $artist->summary;
$results['placeformed'] = $artist->placeformed;
$results['yearformed'] = $artist->yearformed;
$results['largephoto'] = Art::url($artist->id, 'artist');
$results['megaphoto'] = $results['largephoto'];
return $results;
}
}
$query = 'artist=' . rawurlencode($fullname);
$xml = self::get_lastfm_results('artist.getinfo', $query);
$results = array();
$results['summary'] = strip_tags(preg_replace("#<a href=([^<]*)Last\\.fm</a>.#", "", (string) $xml->artist->bio->summary));
$results['placeformed'] = (string) $xml->artist->bio->placeformed;
$results['yearformed'] = (string) $xml->artist->bio->yearformed;
$results['largephoto'] = $xml->artist->image[2];
$results['megaphoto'] = $xml->artist->image[4];
if ($artist) {
if (!empty($results['summary']) || !empty($results['megaphoto'])) {
$artist->update_artist_info($results['summary'], $results['placeformed'], $results['yearformed']);
$image = Art::get_from_source(array('url' => $results['megaphoto']), 'artist');
$rurl = pathinfo($results['megaphoto']);
$mime = 'image/' . $rurl['extension'];
$art = new Art($artist->id, 'artist');
$art->reset();
$art->insert($image, $mime);
$results['largephoto'] = Art::url($artist->id, 'artist');
$results['megaphoto'] = $results['largephoto'];
}
}
return $results;
}
示例10: Artist
</thead>
<tbody>
<?php
// Cache the ratings we are going to use
if (AmpConfig::get('ratings')) {
Rating::build_cache('artist', $object_ids);
}
if (AmpConfig::get('userflags')) {
Userflag::build_cache('artist', $object_ids);
}
$show_direct_play_cfg = AmpConfig::get('directplay');
$directplay_limit = AmpConfig::get('direct_play_limit');
/* Foreach through every artist that has been passed to us */
foreach ($object_ids as $artist_id) {
$libitem = new Artist($artist_id, $_SESSION['catalog']);
$libitem->format(true, $limit_threshold);
$show_direct_play = $show_direct_play_cfg;
$show_playlist_add = Access::check('interface', '25');
if ($directplay_limit > 0) {
$show_playlist_add = $libitem->songs <= $directplay_limit;
if ($show_direct_play) {
$show_direct_play = $show_playlist_add;
}
}
?>
<tr id="artist_<?php
echo $libitem->id;
?>
" class="<?php
echo UI::flip_class();
?>
示例11: library_metadata
public static function library_metadata($params)
{
$r = Plex_XML_Data::createLibContainer();
$n = count($params);
if ($n > 0) {
$key = $params[0];
$id = Plex_XML_Data::getAmpacheId($key);
if ($n == 1) {
// Should we check that files still exists here?
$checkFiles = $_REQUEST['checkFiles'];
if (Plex_XML_Data::isArtist($key)) {
$artist = new Artist($id);
$artist->format();
Plex_XML_Data::addArtist($r, $artist);
} elseif (Plex_XML_Data::isAlbum($key)) {
$album = new Album($id);
$album->format();
Plex_XML_Data::addAlbum($r, $album);
} elseif (Plex_XML_Data::isTrack($key)) {
$song = new Song($id);
$song->format();
Plex_XML_Data::addSong($r, $song);
}
} else {
$subact = $params[1];
if ($subact == "children") {
if (Plex_XML_Data::isArtist($key)) {
$artist = new Artist($id);
$artist->format();
Plex_XML_Data::setArtistRoot($r, $artist);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$album = new Album($id);
$album->format();
Plex_XML_Data::setAlbumRoot($r, $album);
}
}
} elseif ($subact == "thumb") {
if ($n == 3) {
// Ignore thumb id as we can only have 1 thumb
$art = null;
if (Plex_XML_Data::isArtist($key)) {
$art = new Art($id, "artist");
} else {
if (Plex_XML_Data::isAlbum($key)) {
$art = new Art($id, "album");
} else {
if (Plex_XML_Data::isTrack($key)) {
$art = new Art($id, "song");
}
}
}
if ($art != null) {
$art->get_db();
if (!isset($size)) {
self::setHeader($art->raw_mime);
echo $art->raw;
} else {
$dim = array();
$dim['width'] = $size;
$dim['height'] = $size;
$thumb = $art->get_thumb($dim);
self::setHeader($art->thumb_mime);
echo $thumb['thumb'];
}
exit;
}
}
}
}
}
Plex_XML_Data::setContainerSize($r);
self::apiOutput($r->asXML());
}
示例12: _musicMetadata
public static function _musicMetadata($prmPath, $prmQuery = '')
{
$root = 'amp://music';
$pathreq = explode('/', $prmPath);
if ($pathreq[0] == '' && count($pathreq) > 0) {
array_shift($pathreq);
}
$meta = null;
switch ($pathreq[0]) {
case 'artists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/artists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['artists'], 'dc:title' => T_('Artists'), 'upnp:class' => 'object.container');
break;
case 2:
$artist = new Artist($pathreq[1]);
if ($artist->id) {
$artist->format();
$meta = self::_itemArtist($artist, $root . '/artists');
}
break;
}
break;
case 'albums':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/albums', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['albums'], 'dc:title' => T_('Albums'), 'upnp:class' => 'object.container');
break;
case 2:
$album = new Album($pathreq[1]);
if ($album->id) {
$album->format();
$meta = self::_itemAlbum($album, $root . '/albums');
}
break;
}
break;
case 'songs':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/songs', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['songs'], 'dc:title' => T_('Songs'), 'upnp:class' => 'object.container');
break;
case 2:
$song = new Song($pathreq[1]);
if ($song->id) {
$song->format();
$meta = self::_itemSong($song, $root . '/songs');
}
break;
}
break;
case 'playlists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/playlists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['playlists'], 'dc:title' => T_('Playlists'), 'upnp:class' => 'object.container');
break;
case 2:
$playlist = new Playlist($pathreq[1]);
if ($playlist->id) {
$playlist->format();
$meta = self::_itemPlaylist($playlist, $root . '/playlists');
}
break;
}
break;
case 'smartplaylists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/smartplaylists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['smartplaylists'], 'dc:title' => T_('Smart Playlists'), 'upnp:class' => 'object.container');
break;
case 2:
$playlist = new Search($pathreq[1], 'song');
if ($playlist->id) {
$playlist->format();
$meta = self::_itemSmartPlaylist($playlist, $root . '/smartplaylists');
}
break;
}
break;
default:
$meta = array('id' => $root, 'parentID' => '0', 'restricted' => '1', 'childCount' => '5', 'dc:title' => T_('Music'), 'upnp:class' => 'object.container');
break;
}
return $meta;
}
示例13: format
/**
* format
* This is the format function for this object. It sets cleaned up
* album information with the base required
* f_link, f_name
*/
public function format($details = true, $limit_threshold = '')
{
$web_path = AmpConfig::get('web_path');
if ($details) {
/* Pull the advanced information */
$data = $this->_get_extra_info($limit_threshold);
foreach ($data as $key => $value) {
$this->{$key} = $value;
}
if ($this->album_artist) {
$Album_artist = new Artist($this->album_artist);
$Album_artist->format();
$this->album_artist_name = $Album_artist->name;
$this->f_album_artist_name = $Album_artist->f_name;
$this->f_album_artist_link = "<a href=\"" . $web_path . "/artists.php?action=show&artist=" . $this->album_artist . "\" title=\"" . scrub_out($this->album_artist_name) . "\">" . $this->f_album_artist_name . "</a>";
}
$this->tags = Tag::get_top_tags('album', $this->id);
$this->f_tags = Tag::get_display($this->tags, true, 'album');
}
/* Truncate the string if it's to long */
$this->f_name = $this->full_name;
$this->link = $web_path . '/albums.php?action=show&album=' . scrub_out($this->id);
$this->f_link = "<a href=\"" . $this->link . "\" title=\"" . scrub_out($this->full_name) . "\">" . scrub_out($this->f_name);
// Looking if we need to combine or display disks
if ($this->disk && (!$this->allow_group_disks || $this->allow_group_disks && !AmpConfig::get('album_group'))) {
$this->f_link .= " <span class=\"discnb\">[" . T_('Disk') . " " . $this->disk . "]</span>";
}
$this->f_link .= "</a>";
$this->f_title = $this->full_name;
if ($this->artist_count == '1') {
$artist = trim(trim($this->artist_prefix) . ' ' . trim($this->artist_name));
$this->f_artist_name = $artist;
$this->f_artist_link = "<a href=\"{$web_path}/artists.php?action=show&artist=" . $this->artist_id . "\" title=\"" . scrub_out($this->artist_name) . "\">" . $artist . "</a>";
$this->f_artist = $artist;
} else {
$this->f_artist_link = "<span title=\"{$this->artist_count} " . T_('Artists') . "\">" . T_('Various') . "</span>";
$this->f_artist = T_('Various');
$this->f_artist_name = $this->f_artist;
}
if (!$this->year) {
$this->f_year = "N/A";
}
$this->f_release_type = ucwords($this->release_type);
}
示例14: artists
/**
* artists
*
* This takes an array of artists and then returns a pretty xml document with the information
* we want
*
* @param array $artists (description here...)
* @return string return xml
*/
public static function artists($artists)
{
if (count($artists) > self::$limit or self::$offset > 0) {
$artists = array_splice($artists, self::$offset, self::$limit);
}
$string = '';
Rating::build_cache('artist', $artists);
foreach ($artists as $artist_id) {
$artist = new Artist($artist_id);
$artist->format();
$rating = new Rating($artist_id, 'artist');
$tag_string = self::tags_string($artist->tags);
$string .= "<artist id=\"" . $artist->id . "\">\n" . "\t<name><![CDATA[" . $artist->f_full_name . "]]></name>\n" . $tag_string . "\t<albums>" . ($artist->albums ?: 0) . "</albums>\n" . "\t<songs>" . ($artist->songs ?: 0) . "</songs>\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<mbid>" . $artist->mbid . "</mbid>\n" . "\t<summary><![CDATA[" . $artist->summary . "]]></summary>\n" . "\t<yearformed>" . $artist->yearformed . "</yearformed>\n" . "\t<placeformed><![CDATA[" . $artist->placeformed . "]]></placeformed>\n" . "</artist>\n";
}
// end foreach artists
$final = self::_header() . $string . self::_footer();
return $final;
}
示例15: format
/**
* format
* this function takes the object and reformats some values
*/
public function format($details = true)
{
parent::format($details);
if ($details) {
if ($this->artist) {
$artist = new Artist($this->artist);
$artist->format();
$this->f_artist = $artist->link;
}
if ($this->song) {
$song = new Song($this->song);
$song->format();
$this->f_song = $song->f_link;
}
}
return true;
}