/**
  * 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);
 }
 function Parse($file)
 {
     $contents = File::GetContents($file);
     foreach ($this->replacements as $placeholder => $text) {
         $contents = String::Replace($this->phStart . $placeholder . $this->phEnd, $text, $contents);
     }
     return $contents;
 }
 /**
  * Set the current content to retrieve customized wording texts
  * @param Content $content The content
  */
 public function SetContent(Content $content)
 {
     $this->texts = array();
     $wordings = ContentWording::Schema()->FetchByContent(false, $content);
     foreach ($wordings as $wording) {
         $prefix = String::Replace('-', '.', $content->GetType());
         $this->texts[$prefix . '.' . $wording->GetPlaceholder()] = $wording->GetText();
     }
 }
Example #4
0
 private function WordingFieldName($name)
 {
     return String::Replace('.', '-', $name);
 }
Example #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));
 }