本文整理汇总了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);
}