示例#1
0
 public function __construct($user, Habrometr_Model $h = null)
 {
     parent::__construct($user, self::WIDTH, self::HEIGHT, $h);
 }
示例#2
0
    $width = 425;
}
if (isset($_GET['h'])) {
    $height = $_GET['h'];
    if (!ctype_digit($height)) {
        Habrometr_Informer::showError("Height must be an integer ({$height} given)", $width, 120);
    }
} else {
    $height = 120;
}
$className = "Habrometr_Informer_{$width}x{$height}";
$fileName = "./lib/Habrometr/Informer/{$width}x{$height}.php";
if (file_exists($fileName)) {
    require_once $fileName;
} else {
    Habrometr_Informer::showError("Informer of size {$width}x{$height} is not exists", $width, $height);
}
$informer = new $className($user);
/* @var $informer Habrometr_Informer */
// Is user's habrometr cached?
if ($informer->existsInCache()) {
    Log::info(sprintf('informer.php: informer `%s` loaded from cache', $className));
    $informer->printFromCache();
    exit;
}
if (!$informer->prepare()) {
    Log::err('Informer preparing failed');
    throw new Exception('Informer preparing failed');
}
if (!$informer->build()) {
    Log::err('Informer building failed');