本文整理汇总了PHP中Artists::addArtist方法的典型用法代码示例。如果您正苦于以下问题:PHP Artists::addArtist方法的具体用法?PHP Artists::addArtist怎么用?PHP Artists::addArtist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artists
的用法示例。
在下文中一共展示了Artists::addArtist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}