Ejemplo n.º 1
0
 /**
  * Gets the csv file path for the given language
  * @param string $basePath
  * @return string
  */
 private function LanguageCsvFile($basePath)
 {
     $ext = IO\Path::Extension($basePath);
     $baseFile = IO\Path::RemoveExtension($basePath);
     $langFile = IO\Path::AddExtension($baseFile, $this->language);
     return IO\Path::AddExtension($langFile, $ext);
 }
Ejemplo n.º 2
0
 /**
  * Returns the template file
  * @return string
  */
 protected function TemplateFile()
 {
     $class = new \ReflectionClass($this);
     $classFile = String::Replace('\\', '/', $class->getFileName());
     $templatePath = String::Replace('/Snippets/', '/Templates/Snippets/', $classFile);
     return Path::AddExtension($templatePath, 'phtml', true);
 }
Ejemplo n.º 3
0
 /**
  * The template file
  * @return string
  */
 public function TemplateFile()
 {
     if (!$this->AllowCustomTemplates() || !$this->content || !$this->content->GetTemplate()) {
         return $this->BuiltInTemplateFile();
     }
     $file = Path::Combine(PathUtil::ModuleCustomTemplatesFolder($this), $this->content->GetTemplate());
     return Path::AddExtension($file, 'phtml');
 }
Ejemplo n.º 4
0
 /**
  * Renders a block by name
  * @param string $block
  * @return string
  */
 public function RenderBlock($block)
 {
     $templateFile = $this->BuiltInTemplateFile();
     $blockFile = Path::AddExtension($templateFile, $block, true);
     $blockFileExt = Path::AddExtension($blockFile, 'phtml');
     if (!File::Exists($blockFileExt)) {
         return '';
     }
     ob_start();
     require $blockFileExt;
     return ob_get_clean();
 }
Ejemplo n.º 5
0
 /**
  * Checks if the file given in the value doesn't exist yet
  * @param string $value The value to check
  * @return boolean True id check passed
  */
 public function Check($value)
 {
     $this->error = '';
     if ($this->currentFile && $value == $this->currentFile) {
         return true;
     }
     if (!Folder::Exists($this->folder)) {
         return true;
     }
     $files = Folder::GetFiles($this->folder);
     if ($this->fileExtension) {
         $value = Path::AddExtension($value, $this->fileExtension);
     }
     if (in_array($value, $files)) {
         $this->error = self::ExistsInFolder;
     }
     return $this->error == '';
 }
Ejemplo n.º 6
0
 private function CalcFile($template)
 {
     return Path::AddExtension(Path::Combine($this->folder, $template), 'phtml');
 }
Ejemplo n.º 7
0
 private function RemoveTemplate()
 {
     $id = Request::PostData('delete');
     if (!$id) {
         return false;
     }
     $idParts = \explode('/', $id);
     $module = $this->RemovalTemplateModule($idParts);
     $templateName = trim($idParts[1]);
     if (!$module || !$templateName) {
         return false;
     }
     $logger = new Logger(self::Guard()->GetUser());
     $logger->ReportTemplateAction($module->MyType(), $templateName, Action::Delete());
     $folder = PathUtil::ModuleCustomTemplatesFolder($module);
     $template = Path::Combine($folder, Path::AddExtension($templateName, 'phtml'));
     if (File::Exists($template)) {
         File::Delete($template);
     }
     $this->DeleteUsages($module, $templateName);
     return true;
 }
Ejemplo n.º 8
0
 /**
  * Renderst necessary javascript
  * @return string Returns javascript for html output
  */
 function RenderScript()
 {
     $templateFile = Path::RemoveExtension($this->TemplateFile());
     $scriptFile = Path::AddExtension($templateFile, 'Script');
     ob_start();
     require Path::AddExtension($scriptFile, 'phtml');
     return ob_get_clean();
 }
Ejemplo n.º 9
0
 /**
  * The name of the cache file
  * @param FrontendModule $module
  * @return string The name of the cache file, it needn't exist yet
  * @throws \Exception Raises an error in case the cache key is not alphanumeric
  */
 static function ContentCacheFile(FrontendModule $module)
 {
     $file = $module->Content()->GetID();
     $cacheKey = $module->CacheKey();
     if ($cacheKey) {
         if (!ctype_alnum($cacheKey)) {
             throw new \Exception(Trans('Core.CacheKey.Error.NotAlphaNumeric'));
         }
         $file .= '-' . $cacheKey;
     }
     $cacheFolder = Path::Combine(PHINE_PATH, 'Cache/Content');
     return Path::AddExtension(Path::Combine($cacheFolder, $file), 'phtml');
 }
Ejemplo n.º 10
0
 /**
  * Redirects to the next step
  */
 function GotoNext()
 {
     $next = Page::NextStep($this->Step());
     Response::Redirect(Path::AddExtension($next, 'php'));
 }