Exemplo n.º 1
0
 /**
  * Check if a template with the given name exists in the 'pages' sub-directory of the templates
  * directory.
  * @param $templateName
  * @return bool|string false if the template does not exist, otherwise the normalised name
  * of the template.
  */
 private function templateExists($templateName)
 {
     if (substr($templateName, -1) === '/') {
         $templateName .= "index";
     }
     $templateName = str_replace('..', '', $templateName);
     $templateNormalisedName = 'pages' . $templateName;
     $templatePathname = $this->jigConfig->getTemplatePath($templateNormalisedName);
     if (file_exists($templatePathname) === true) {
         return $templateNormalisedName;
     }
     $indexName = $templateNormalisedName . "/index";
     $templatePathname = $this->jigConfig->getTemplatePath($indexName);
     if (file_exists($templatePathname) === true) {
         return $indexName;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Check if a template with the given name exists in the 'pages' sub-directory of the templates
  * directory.
  * @param $templateName
  * @return bool|string false if the template does not exist, otherwise the normalised name
  * of the template.
  */
 private function templateExists($templateName)
 {
     if (substr($templateName, -1) === '/') {
         $templateName .= "index";
     }
     $templateName = str_replace('..', '', $templateName);
     $templateNormalisedName = 'pages' . $templateName;
     $templatePathname = $this->jigConfig->getTemplatePath($templateNormalisedName);
     // Does the path match the file name of a template?
     if (file_exists($templatePathname) === true) {
         return $templateNormalisedName;
     }
     // Does the path with '/index' added match the file name of a template?
     $indexName = $templateNormalisedName . "/index";
     $templatePathname = $this->jigConfig->getTemplatePath($indexName);
     if (file_exists($templatePathname) === true) {
         return $indexName;
     }
     return false;
 }
Exemplo n.º 3
0
Arquivo: Jig.php Projeto: PeeHaa/Jig
 /**
  * @param $templateFilename
  * @return bool
  */
 public function isGeneratedFileOutOfDate($templateFilename)
 {
     $templateFullFilename = $this->jigConfig->getTemplatePath($templateFilename);
     $classPath = Jig::getCompiledFilenameInternal($templateFilename, $this->jigConverter, $this->jigConfig);
     $classPath = str_replace('\\', '/', $classPath);
     $templateTime = @filemtime($templateFullFilename);
     $classTime = @filemtime($classPath);
     if ($classTime < $templateTime) {
         return true;
     }
     return false;
 }