/**
  * 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);
 }
示例#2
0
 /**
  * Gets the module templates
  * @param FrontendModule $module The frontend module
  * @return string[] Returns the template files 
  */
 protected function ModuleTemplates($module)
 {
     $folder = PathUtil::ModuleCustomTemplatesFolder($module);
     if (!Folder::Exists($folder)) {
         return array();
     }
     $templates = Folder::GetFiles($folder);
     $result = array();
     foreach ($templates as $template) {
         if (Path::Extension($template) == 'phtml') {
             $result[] = Path::RemoveExtension($template);
         }
     }
     return $result;
 }
示例#3
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();
 }
示例#4
0
 /**
  * Sorts files by version
  * @param string[] $files The files
  * @return string[] Returns the sorted files
  */
 private function SortFilesByVersion(array $files)
 {
     $result = array();
     $foreignKeysFile = '';
     foreach ($files as $file) {
         if ($file == 'foreign-keys.sql') {
             $foreignKeysFile = $file;
             continue;
         }
         $version = Path::RemoveExtension($file);
         if ($this->installedVersion && version_compare($version, $this->installedVersion) <= 0) {
             continue;
         }
         $result[$version] = $file;
     }
     uksort($result, "version_compare");
     if ($foreignKeysFile) {
         $result[] = $foreignKeysFile;
     }
     return $result;
 }
示例#5
0
 /**
  * Gets the translations folder for a module
  * @param ModuleBase $module
  * @return string Returns the folder of the module translationss
  */
 static function ModuleTranslationsFolder(ModuleBase $module)
 {
     $class = new \ReflectionClass($module);
     $classFile = String::Replace('\\', '/', $class->getFileName());
     return String::Replace('/Modules/', '/Translations/', Path::RemoveExtension($classFile));
 }