Пример #1
0
 /**
  * Check if the template exist and compile it if necessary
  *
  * @param string $template: name of the file of the template
  *
  * @throw \Rain\Tpl\NotFoundException the file doesn't exists
  * @return string: full filepath that php must use to include
  */
 protected function checkTemplate($template)
 {
     // set filename
     $templateName = basename($template);
     $templateBasedir = strpos($template, DIRECTORY_SEPARATOR) ? dirname($template) . DIRECTORY_SEPARATOR : null;
     $templateDirectory = null;
     $templateFilepath = null;
     $parsedTemplateFilepath = null;
     // Make directories to array for multiple template directory
     $templateDirectories = $this->config['tpl_dir'];
     if (!is_array($templateDirectories)) {
         $templateDirectories = array($templateDirectories);
     }
     $isFileNotExist = true;
     foreach ($templateDirectories as $templateDirectory) {
         $templateDirectory .= $templateBasedir;
         $templateFilepath = $templateDirectory . $templateName . '.' . $this->config['tpl_ext'];
         $parsedTemplateFilepath = $this->config['cache_dir'] . $templateName . "." . md5($templateDirectory . serialize($this->config['checksum'])) . '.rtpl.php';
         // For check templates are exists
         if (file_exists($templateFilepath)) {
             $isFileNotExist = false;
             break;
         }
     }
     // if the template doesn't exsist throw an error
     if ($isFileNotExist === true) {
         $e = new NotFoundException('Template ' . $templateName . ' not found!');
         throw $e->templateFile($templateFilepath);
     }
     // Compile the template if the original has been updated
     if ($this->config['debug'] || !file_exists($parsedTemplateFilepath) || filemtime($parsedTemplateFilepath) < filemtime($templateFilepath)) {
         $this->compileFile($templateName, $templateBasedir, $templateDirectory, $templateFilepath, $parsedTemplateFilepath);
     }
     return $parsedTemplateFilepath;
 }
 /**
  * Create a new presenter not found exception.
  *
  * @param string      $class
  * @param string|null $message
  *
  * @return void
  */
 public function __construct($class, $message = null)
 {
     if (!$message) {
         $message = "The presenter class '{$class}' was not found.";
     }
     parent::__construct($class, $message);
 }
 private function addTwigTemplatePath($twigTemplatePath)
 {
     if (!file_exists($twigTemplatePath)) {
         throw NotFoundException::twigTemplatePathNotFound();
     }
     $this->twigTemplatePaths[] = (string) $twigTemplatePath;
 }
 /**
  * Create a new method not found exception.
  *
  * @param string      $class
  * @param string      $method
  * @param string|null $message
  *
  * @return void
  */
 public function __construct($class, $method, $message = null)
 {
     $this->method = $method;
     if (!$message) {
         $message = "The method '{$method}' was not found on the presenter class '{$class}'.";
     }
     parent::__construct($class, $message);
 }
 public function __construct($pageName, $repoPath, $prevException = null)
 {
     parent::__construct(sprintf("Wiki page '%s' not found in '%s'.", $repoPath, $pageName), 1, $prevException);
 }
Пример #6
0
 /**
  * Check if the template exist and compile it if necessary
  *
  * @param string $filePath: the path to the template file
  *
  * @throw \Rain\NotFoundException the file doesn't exists
  */
 protected function checkTemplate($filePath)
 {
     $db = new Db();
     $filePath = $this->config['tpl_dir'] . $filePath . '.' . $this->config['tpl_ext'];
     // get template from Db
     list($html, $md5_stored) = $db->getTemplate($filePath);
     // in case of production option is true, the actual templates are not required
     // it is one step from here to removing templates after compilation
     if (!$this->config['production']) {
         // Check if template exists
         if (!file_exists($filePath)) {
             $e = new NotFoundException('Template ' . $filePath . ' not found!');
             throw $e->templateFile($filePath);
         }
         // Compile the template if the original has been updated
         $md5_current = md5_file($filePath);
         if ($this->config['debug'] || $md5_stored != $md5_current) {
             // compile the template
             $html = (new Parser())->compileFile($this->config, $filePath);
             // store the update in Db
             $db->storeTemplate($html, $filePath, $md5_current);
         }
     }
     return $html;
 }
 public function __construct($id, $code = null, $previous = null)
 {
     parent::__construct($id, 'Protocol', $code, $previous);
 }
Пример #8
0
 /**
  * @param string $id The users id
  * @param string $region The users region
  */
 public function __construct($id = '(Unknown id)', $region = '(Unknown region)')
 {
     parent::__construct($id, $region);
 }
 public function __construct($id, $code = null, $previous = null)
 {
     parent::__construct($id, 'Config', $code, $previous);
 }
Пример #10
0
 function __construct($controllerName, $code = 404)
 {
     $message = sprintf('Controller "%s" could not be found, or is not accessible.', $controllerName);
     parent::__construct($message, $code);
 }
Пример #11
0
 function __construct($name)
 {
     parent::__construct("Method not found: {$name}");
 }
Пример #12
0
 /**
  * @param RequesterInterface $requester
  * @param ResourceInterface  $resource
  */
 public function __construct(RequesterInterface $requester, ResourceInterface $resource)
 {
     parent::__construct(sprintf('Unable to find any permission where requester is "%s" and resource is "%s"', $requester->getAclRequesterIdentifier(), $resource->getAclResourceIdentifier()));
 }
Пример #13
0
 /**
  * @param string $type
  */
 public function __construct($type, $code = 0, Exception $previous = null)
 {
     $this->type = strtolower($type);
     $message = "The specified {$this->type} could not be found";
     parent::__construct($message, $code, $previous);
 }
 function __construct($paramName)
 {
     parent::__construct("Section: '{$paramName}' was not found");
 }
Пример #15
0
 public function __construct($message, $code = 0, $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
 public function __construct($wikiPageType, $wikiPageName)
 {
     parent::__construct(sprintf("Invalid page type: %s (page name: %s)", $wikiPageType, $wikiPageName));
 }