本文整理汇总了PHP中Artists类的典型用法代码示例。如果您正苦于以下问题:PHP Artists类的具体用法?PHP Artists怎么用?PHP Artists使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Artists类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sidebar
function sidebar()
{
$return .= "\n\t<h4>Music Library</h4>\n\t<dl>\n\t\t<dt>Tracks</dt>\n\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t<dt>Artists</dt>\n\t\t<dd>" . number_format(Artists::count()) . "</dd>\n\t\t<dt>Albums</dt>\n\t\t<dd>" . number_format(Albums::count()) . "</dd>\n\t</dl>";
function bytes($a)
{
$unim = array("B", "KB", "MB", "GB", "TB", "PB");
$c = 0;
while ($a >= 1024) {
$c++;
$a = $a / 1024;
}
return number_format($a, $c ? 2 : 0, ".", ",") . " " . $unim[$c];
}
$return .= "\n\t<h4>Archive Storage</h4>\n\t<dl>";
foreach (Archives::get_all() as $archive) {
$pc = (int) (100 - $archive->get_free_space() / $archive->get_total_space() * 100);
if ($archive->get_free_space() > 536870912000.0) {
$colour = "success";
} else {
if ($archive->get_free_space() > 214748364800.0) {
$colour = "warning";
} else {
$colour = "danger";
}
}
$return .= "\n\t\t<dt>" . $archive->get_name() . "</dt>\n\t\t<dd><div class=\"progress\" style=\"margin: 3px 0px; \"><div class=\"progress-bar progress-bar-" . $colour . "\" style=\"width: " . $pc . "%;\"></div></div></dd>\n\t\t<dd>" . bytes($archive->get_free_space()) . " free of " . bytes($archive->get_total_space()) . "</dd>";
}
$return .= "</dl>";
return $return;
}
示例2: actionArtistas
public function actionArtistas()
{
$this->pageTitle = 'Artistas - ' . $this->pageTitle;
$this->pageDescription = 'Ven y disfruta en familia de lo mejor de la salsa, el merengue, el vallenato y mucho más en las ferias de Duitama 2016.';
$this->tagImage = '/images/facebook-artistas.png';
$artists = Artists::model()->findAllByAttributes(array('status_artist' => 1));
$this->render('artistas', array('artists' => $artists));
}
示例3: loadModel
public function loadModel($id)
{
$model = Artists::model()->findByAttributes(array('id_artist' => $id, 'status_artist' => 1));
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例4: del_artists
public function del_artists($artists)
{
if (!is_array($artists)) {
$tmp = $artists;
$artists = array($tmp);
}
foreach ($artists as $artist) {
$object = Artists::get_by_name($artist);
$object->del_from_track($this);
}
}
示例5: index
public function index()
{
//Set keyword to proper format using Str::lower - it's the same as strtolower
$keyword = Str::lower(Input::get('keyword'));
//Use Query builder to look for the keyword in various category
$data['comics'] = Comicbooks::where('book_name', 'LIKE', '%' . $keyword . '%')->select('book_name')->distinct()->get();
$data['characters'] = Characters::where('character_name', 'LIKE', '%' . $keyword . '%')->select('character_name')->distinct()->get();
$data['authors'] = Authors::where('author_name', 'LIKE', '%' . $keyword . '%')->select('author_name')->distinct()->get();
$data['artists'] = Artists::where('artist_name', 'LIKE', '%' . $keyword . '%')->select('artist_name')->distinct()->get();
$data['publishers'] = Publishers::where('publisher_name', 'LIKE', '%' . $keyword . '%')->select('publisher_name')->distinct()->get();
$this->layout->content = View::make('search', $data);
}
示例6: loadLogos
function loadLogos($dir)
{
if (!is_dir($dir)) {
echo "Invalid directory";
} else {
global $nbInsert;
global $_PATH;
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
///---Extraction
$parts = explode('.', $file);
$ext = array_pop($parts);
///---Valid formats
if (!($ext == 'gif' || $ext == 'jpg' || $ext == 'png')) {
continue;
}
///---Name repack
$name = join(".", $parts);
$name = str_replace('__', '.', $name);
$name = str_replace('_', '%', $name);
///---Extra Validations
//Check for special caracters not encoded
if (strpos($name, '_') !== false || strpos($name, ' ') !== false) {
echo "<b>" . $name . " sould be rename to " . str_replace(array('_', ' '), array('+', '+'), $name) . ".</b><br/>";
continue;
} else {
if (strpos($name, '%') === false) {
$nameCheck = urlencode(str_replace(array('+'), array(''), $name));
//Char excludes
//Some caracter are not support yet
if (strpos($nameCheck, '%') !== false) {
echo "<b>" . $name . " is not properly parse.</b><br/>";
continue;
}
}
}
$prev = $name;
///---Insert in db
if (artistExist($name)) {
continue;
}
echo $name . " - ";
$newDate = filemtime(Config::FOLDER_LOGOS . $file);
//Date of modification (new file)
$newArtist = new Artist($name, $file, "", -1, $newDate);
Artists::addArtist($newArtist);
$nbInsert++;
}
closedir($handle);
}
}
}
示例7: show
/**
* Output the image with the logos of each artist
*/
public function show()
{
if (count($this->artists) == 0) {
throw new Exception("Missing some informations (artists).");
}
$totalHeight = array(self::$marginTop, self::$marginTop);
$listImageRessources = array(array(), array());
$forcedWidth = self::$width / 2 - self::$seperation / 2;
foreach ($this->artists as $name) {
if (count($listImageRessources[0]) + count($listImageRessources[1]) == $this->nbArtists) {
break;
}
$a = Artists::getArtistByName($name);
if ($a != null) {
$image = Artists::imageFromArtist($a);
if (isset($image)) {
$i = $totalHeight[1] < $totalHeight[0] ? 1 : 0;
$x = imagesx($image);
$y = imagesy($image);
$newHeight = floor($y * $forcedWidth / $x);
$totalHeight[$i] += $newHeight + self::$seperation;
array_push($listImageRessources[$i], $image);
}
}
}
$container = imagecreatetruecolor(self::$width, max($totalHeight));
//Some colors needed
$colWhite = imagecolorallocate($container, 255, 255, 255);
//Background color
imagefilledrectangle($container, 0, 0, self::$width, max($totalHeight), $colWhite);
$currentHeight = array(self::$marginTop, self::$marginTop);
for ($l = 0; $l < count($listImageRessources); $l++) {
$list = $listImageRessources[$l];
foreach ($list as $image) {
$x = imagesx($image);
$y = imagesy($image);
$newHeight = floor($y * $forcedWidth / $x);
$resized = imagecreatetruecolor($forcedWidth, $newHeight);
imagecopyresampled($resized, $image, 0, 0, 0, 0, $forcedWidth, $newHeight, $x, $y);
imagecopymerge($container, $resized, ($forcedWidth + self::$seperation) * $l, $currentHeight[$l], 0, 0, $forcedWidth, $newHeight, 100);
//echo $currentHeight[$l] . "-";
$currentHeight[$l] += $newHeight + self::$seperation;
}
}
ImageUtil::applyFilter($container, $this->color);
imagepng($container);
}
示例8: show
/**
* Output the image with the logos of each artist
*/
public function show()
{
if (count($this->artists) == 0) {
throw new Exception("Missing some informations (artists).");
}
$totalHeight = 0;
$listImageRessources = array();
foreach ($this->artists as $name) {
if (count($listImageRessources) == $this->nbArtists) {
break;
}
$a = Artists::getArtistByName($name);
if ($a != null) {
$image = Artists::imageFromArtist($a);
if (isset($image)) {
$totalHeight += imagesy($image) + self::$seperation;
array_push($listImageRessources, $image);
}
}
}
//echo $totalHeight;
$totalHeight += self::$marginTop;
$container = imagecreatetruecolor(self::$width, $totalHeight);
//Some colors needed
$colWhite = imagecolorallocate($container, 255, 255, 255);
//Background color
imagefilledrectangle($container, 0, 0, self::$width, $totalHeight, $colWhite);
$expectWidth = self::$width - 2 * self::$marginSide;
$currentHeight = self::$marginTop;
foreach ($listImageRessources as $image) {
$widthImg = imagesx($image);
//echo $this->width."-2 * ".self::$marginSide);
//echo $widthImg."--".$expectWidth."<br/>";
imagecopymerge($container, $image, self::$marginSide + ($widthImg < $expectWidth ? ($expectWidth - $widthImg) * 0.5 : 0), $currentHeight, 0, 0, imagesx($image), imagesy($image), 100);
$currentHeight += imagesy($image) + self::$seperation;
}
ImageUtil::applyFilter($container, $this->color);
imagepng($container);
}
示例9: getBrowse
public function getBrowse($category)
{
//Get browse category
$category_filtered = strtoupper(trim($category));
//Page Title
$data['title'] = $category_filtered;
//Switch to get appropriate data, redirect to error if options aren't listed
switch ($category_filtered) {
case 'SERIES':
$data['comics'] = Comicbooks::orderBy('book_name', 'asc')->get();
break;
case 'AUTHORS':
$data['comics'] = Authors::select('author_name')->orderBy('author_name', 'asc')->distinct()->get();
break;
case 'ARTISTS':
$data['comics'] = Artists::select('artist_name')->orderBy('artist_name', 'asc')->distinct()->get();
break;
case 'CHARACTERS':
$data['comics'] = Characters::select('character_name')->orderBy('character_name', 'asc')->distinct()->get();
break;
case 'PUBLISHERS':
$data['comics'] = Publishers::select('publisher_name')->orderBy('publisher_name', 'asc')->distinct()->get();
break;
case 'GENRES':
$data['comics'] = Genres::orderBy('genre_name', 'asc')->get();
break;
case 'YEARS':
//This needed to be a raw query because of the date
$data['comics'] = Comicissues::select(DB::raw('year(published_date) as year'))->orderBy('published_date', 'asc')->distinct()->get();
break;
default:
return Redirect::to('error');
break;
}
$this->layout->content = View::make('browse', $data);
}
示例10: generate_torrent_json
function generate_torrent_json($Caption, $Tag, $Details, $Limit)
{
global $LoggedUser, $Categories;
$results = array();
foreach ($Details as $Detail) {
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TorrentTags, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
$Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
$TruncArtist = substr($Artist, 0, strlen($Artist) - 3);
$TagList = array();
if ($TorrentTags != '') {
$TorrentTags = explode(' ', $TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_', '.', $TagName);
$TagList[] = $TagName;
}
}
// Append to the existing array.
$results[] = array('torrentId' => (int) $TorrentID, 'groupId' => (int) $GroupID, 'artist' => $TruncArtist, 'groupName' => $GroupName, 'groupCategory' => (int) $GroupCategory, 'groupYear' => (int) $GroupYear, 'remasterTitle' => $RemasterTitle, 'format' => $Format, 'encoding' => $Encoding, 'hasLog' => $HasLog == 1, 'hasCue' => $HasCue == 1, 'media' => $Media, 'scene' => $Scene == 1, 'year' => (int) $Year, 'tags' => $TagList, 'snatched' => (int) $Snatched, 'seeders' => (int) $Seeders, 'leechers' => (int) $Leechers, 'data' => (int) $Data, 'size' => (int) $Size);
}
return array('caption' => $Caption, 'tag' => $Tag, 'limit' => (int) $Limit, 'results' => $results);
}
示例11: foreach
if (check_paranoia_here('snatched')) {
$DB->query("\n\t\tSELECT\n\t\t\tg.ID,\n\t\t\tg.Name,\n\t\t\tg.WikiImage\n\t\tFROM xbt_snatched AS s\n\t\t\tINNER JOIN torrents AS t ON t.ID = s.fid\n\t\t\tINNER JOIN torrents_group AS g ON t.GroupID = g.ID\n\t\tWHERE s.uid = '{$UserID}'\n\t\t\tAND g.CategoryID = '1'\n\t\t\tAND g.WikiImage != ''\n\t\tGROUP BY g.ID\n\t\tORDER BY s.tstamp DESC\n\t\tLIMIT {$Limit}");
$RecentSnatches = $DB->to_array(false, MYSQLI_ASSOC);
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentSnatches as $Key => $SnatchInfo) {
$RecentSnatches[$Key]['artists'][] = $Artists[$SnatchInfo['ID']];
$RecentSnatches[$Key]['ID'] = (int) $RecentSnatches[$Key]['ID'];
}
$Results['snatches'] = $RecentSnatches;
} else {
$Results['snatches'] = "hidden";
}
if (check_paranoia_here('uploads')) {
$DB->query("\n\t\tSELECT\n\t\t\tg.ID,\n\t\t\tg.Name,\n\t\t\tg.WikiImage\n\t\tFROM torrents_group AS g\n\t\t\tINNER JOIN torrents AS t ON t.GroupID = g.ID\n\t\tWHERE t.UserID = '{$UserID}'\n\t\t\tAND g.CategoryID = '1'\n\t\t\tAND g.WikiImage != ''\n\t\tGROUP BY g.ID\n\t\tORDER BY t.Time DESC\n\t\tLIMIT {$Limit}");
$RecentUploads = $DB->to_array(false, MYSQLI_ASSOC);
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['artists'][] = $Artists[$UploadInfo['ID']];
$RecentUploads[$Key]['ID'] = (int) $RecentUploads[$Key]['ID'];
}
$Results['uploads'] = $RecentUploads;
} else {
$Results['uploads'] = "hidden";
}
json_die("success", $Results);
function check_paranoia_here($Setting)
{
global $Paranoia, $Class, $UserID, $Preview;
if ($Preview == 1) {
return check_paranoia($Setting, $Paranoia, $Class);
} else {
示例12: error
default:
error(0);
}
}
$DownloadsQ = $DB->query("\n\tSELECT\n\t\tt.ID AS TorrentID,\n\t\tDATE_FORMAT({$Month}, '%Y - %m') AS Month,\n\t\tt.GroupID,\n\t\tt.Media,\n\t\tt.Format,\n\t\tt.Encoding,\n\t\tIF(t.RemasterYear = 0, tg.Year, t.RemasterYear) AS Year,\n\t\ttg.Name,\n\t\tt.Size\n\tFROM torrents AS t\n\t\tJOIN torrents_group AS tg ON t.GroupID = tg.ID\n\t{$SQL}\n\tGROUP BY TorrentID");
$Collector = new TorrentsDL($DownloadsQ, "{$Username}'s " . ucfirst($_GET['type']));
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentIDs = array_keys($GroupIDs);
$TorrentFilesQ = $DB->query('
SELECT TorrentID, File
FROM torrents_files
WHERE TorrentID IN (' . implode(',', $TorrentIDs) . ')', false);
if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive
foreach ($TorrentIDs as $TorrentID) {
$Download =& $Downloads[$TorrentID];
$Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
$Collector->fail_file($Download);
}
continue;
}
while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) {
$Download =& $Downloads[$TorrentID];
$Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
$Collector->add_file($TorrentFile, $Download, $Download['Month']);
unset($Download);
}
}
$Collector->finalize(false);
define('SKIP_NO_CACHE_HEADERS', 1);
示例13: store
/**
* Adding a comicbook series into the database
* GET /content/store
*
* @return Response
*/
public function store()
{
//Get string inputs
$inputs = Input::only('book_name', 'publisher_name', 'author_name', 'artist_name');
//Trim string inputs
Input::merge(array_map('trim', $inputs));
//Create session
$this->createSession();
//Set validation rules
$rules = array('book_name' => 'required|alpha_num|unique:comicdb_books', 'publisher_name' => 'required|alpha_num|min:1', 'book_description' => 'max:2000', 'genres' => 'min:1', 'author_name' => 'required|alpha_num|min:1', 'artist_name' => 'required|alpha_num|min:1', 'published_date' => 'required|date_format:yy-m-d', 'cover_image' => 'required|image', 'characters' => 'min:1', 'issue_summary' => 'max:2000');
//Laravel Validation class and make method takes the inputs in the first argument
//then the rules on the data in the second
$validator = Validator::make(Input::all(), $rules);
//Validator instance use the pass method to continue
if ($validator->passes()) {
dd($validator->passes());
//Instance of Comicbook model
$comic = new Comicbooks();
//Instance of Publisher model
$publishers = new Publishers();
//Setting variables
$publisher = strtolower(Input::get('publisher_name'));
$author = strtolower(Input::get('author_name'));
$artist = strtolower(Input::get('artist_name'));
$publisherExists = $publishers->where('publisher_name', $publisher)->select('id')->first();
$authorExists = Authors::where('author_name', $author)->select('id')->first();
$artistExists = Artists::where('artist_name', $artist)->select('id')->first();
//Check if publisher already exist in the database
if (isset($publisherExists->id)) {
//if it does get the id
$publisher_id = $publisherExists->id;
} else {
//else create it in the Publisher table using the instance of publisher model
$publisher_id = $publishers->insertGetId(array('publisher_name' => $publisher));
}
//Check if author already exist in the database
if (isset($authorExists)) {
//if they do get the id
$author_id = $authorExists->id;
} else {
//else create it in the Authors table using the instance of author model
$author_id = Authors::insertGetId(array('author_name' => $author));
}
//Check if artist already exist in the database
if (isset($artistExists)) {
//if they do get the id
$artist_id = $artistExists->id;
} else {
//else create it in the Artists table using the instance of artist model
$artist_id = Artists::insertGetId(array('artist_name' => $artist));
}
//Add book series information to comicdb_books
$comic->book_name = strtolower(Input::get('book_name'));
$comic->book_description = Input::get('book_description');
$comic->publisher_id_FK = $publisher_id;
$comic->save();
//Add genre and book ids in the comicdb_genrebook using Query Builder
foreach (Input::get('genres') as $key => $genre) {
DB::table('comicdb_genrebook')->insert(array('book_id_FK' => $comic->id, 'genre_id_FK' => $genre));
}
//Add cover image to local file and set location string into database
if (Input::hasFile('cover_image')) {
$fileName = strtolower(Input::get('book_name')) . '01_Cov_' . Str::random(10) . '.' . Input::file('cover_image')->getClientOriginalExtension();
$cover_image = Input::file('cover_image')->move('public/img/comic_covers/', $fileName);
}
//Add issue character information into the comicdb_character table and keys into the comicdb_characterbook table using Query Builder
foreach (Input::get('characters') as $key => $character) {
$character_id = Characters::insertGetId(array('character_name' => $character));
DB::table('comicdb_characterbook')->insert(array('book_id_FK' => $comic->id, 'character_id_FK' => $character_id));
}
//Add issues information to comicdb_issues
Comicissues::insert(array('book_id' => $comic->id, 'issue_id' => 1, 'artist_id_FK' => $artist_id, 'author_id_FK' => $author_id, 'summary' => Input::get('issue_summary'), 'published_date' => Input::get('published_date'), 'cover_image' => 'img/comic_covers/' . $fileName, 'created_at' => date('Y-m-d H:i:s', time())));
$this->destorySession();
return Redirect::to('browse')->with('postMsg', 'Thanks for submiting!');
} else {
return Redirect::to('content/series')->with('postMsg', 'Whoops! Looks like you got some errors.')->withErrors($validator);
}
}
示例14: number_format
echo number_format($Torrent['Leechers']);
?>
</td>
</tr>
<?php
}
$TorrentTable .= ob_get_clean();
// Album art
ob_start();
$DisplayName = '';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
} elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1' => $GroupArtists), false);
}
$DisplayName .= $GroupName;
if ($GroupYear > 0) {
$DisplayName = "{$DisplayName} [{$GroupYear}]";
}
$Tags = display_str($TorrentTags->format());
$PlainTags = implode(', ', $TorrentTags->get_tags());
?>
<li class="image_group_<?php
echo $GroupID;
?>
">
<a href="torrents.php?id=<?php
echo $GroupID;
?>
示例15:
<ul>
<li><?php
echo Artists::display_artists($Artists[$OldGroupID], true, false);
?>
- <a href="torrents.php?id=<?php
echo $OldGroupID;
?>
"><?php
echo $Name;
?>
</a></li>
</ul>
<h3>Into the group:</h3>
<ul>
<li><?php
echo Artists::display_artists($Artists[$GroupID], true, false);
?>
- <a href="torrents.php?id=<?php
echo $GroupID;
?>
"><?php
echo $NewName;
?>
</a></li>
</ul>
<input type="submit" value="Confirm" />
</form>
</div>
</div>
<?php
View::show_footer();