本文整理匯總了PHP中CoreUtils::notFound方法的典型用法代碼示例。如果您正苦於以下問題:PHP CoreUtils::notFound方法的具體用法?PHP CoreUtils::notFound怎麽用?PHP CoreUtils::notFound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CoreUtils
的用法示例。
在下文中一共展示了CoreUtils::notFound方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderPreviewSVG
static function renderPreviewSVG($AppearanceID)
{
global $CGPath, $CGDb;
$OutputPath = str_replace('#', $AppearanceID, self::PREVIEW_SVG_PATH);
$FileRelPath = "{$CGPath}/v/{$AppearanceID}p.svg";
if (file_exists($OutputPath)) {
Image::outputSVG(null, $OutputPath, $FileRelPath);
}
$SVG = '';
$colors = array();
$ColorQuery = $CGDb->rawQuery('SELECT c.hex FROM colors c
LEFT JOIN colorgroups cg ON c.groupid = cg.groupid
WHERE cg.ponyid = ?
ORDER BY cg."order" ASC, c."order" ASC
LIMIT 4', array($AppearanceID));
if (empty($ColorQuery)) {
CoreUtils::notFound();
}
usort($ColorQuery, function ($a, $b) {
return CoreUtils::yiq($b['hex']) <=> CoreUtils::yiq($a['hex']);
});
switch (count($ColorQuery)) {
case 1:
$SVG .= "<rect x='0' y='0' width='2' height='2' fill='{$ColorQuery[0]['hex']}'/>";
break;
case 3:
$SVG .= <<<XML
<rect x='0' y='0' width='2' height='2' fill='{$ColorQuery[0]['hex']}'/>
<rect x='0' y='1' width='1' height='1' fill='{$ColorQuery[1]['hex']}'/>
<rect x='1' y='1' width='1' height='1' fill='{$ColorQuery[2]['hex']}'/>
XML;
break;
case 2:
case 4:
$x = 0;
$y = 0;
foreach ($ColorQuery as $c) {
$w = $x % 2 == 0 ? 2 : 1;
$h = $y % 2 == 0 ? 2 : 1;
$SVG .= "<rect x='{$x}' y='{$y}' width='{$w}' height='{$h}' fill='{$c['hex']}'/>";
$x++;
if ($x > 1) {
$x = 0;
$y = 1;
}
}
break;
}
$SVG = "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2' enable-background='new 0 0 2 2' xml:space='preserve' preserveAspectRatio='xMidYMid slice'>{$SVG}</svg>";
Image::outputSVG($SVG, $OutputPath, $FileRelPath);
}