Example #1
0
 /**
  * Render the slideshow.
  *
  * @return void
  */
 public function render()
 {
     $id = $this->_markupId == '' ? 'thb-slideshow-' . THB_Shortcode::$instance_number : $this->_markupId;
     $template = new THB_Template($this->getBaseTemplate() . '/slideshow', array('slideshow' => $this, 'meta' => $this->getMeta(), 'id' => $id));
     $template->render();
 }
 /**
  * Set the page content.
  *
  * @param string $templatePath The path to the page content template.
  * @param array $data=array() The array of data passed to the page.
  * @return void
  */
 public function setContent($templatePath, array $data = array())
 {
     $data = thb_array_extend($data, array('page' => $this));
     $page_content = new THB_Template($templatePath, $data);
     $this->_content = $page_content->render(true);
 }
 /**
  * Display the changelo page content.
  *
  * @return void
  */
 public function _themeVersionPage()
 {
     $page = new THB_Template(THB_RESOURCES_DIR . '/admin/pages/thb_theme_updates');
     $page->render();
 }
 function thb_comment($comment, $args, $depth)
 {
     $comment_template = new THB_Template(get_template_directory() . '/comment', array('comment' => $comment, 'args' => $args, 'depth' => $depth));
     $comment_template->render();
 }
?>
</p>
		<?php 
if (is_child_theme()) {
    ?>
			<p><?php 
    _e('Parent theme version', 'thb_text_domain');
    ?>
 <?php 
    echo THB_PARENT_THEME_VERSION;
    ?>
</p>
		<?php 
}
?>
	</div>

	<?php 
echo thb_translated_admin_resource('messages/update');
?>

	<div class="thb-page-content">
		<?php 
$installationDetails = thb_theme()->getAdmin()->getInstallationDetails();
$changelog = $installationDetails['updates']['changelog'];
$theme_changelog = new THB_Template(THB_RESOURCES_DIR . '/admin/pages/thb_theme_changelog', array('changelog' => $changelog));
$theme_changelog->render();
?>
	</div>

</div>
 /**
  * Render the field.
  *
  * @return void
  */
 public function render()
 {
     $this->preRender();
     if (empty($this->_data)) {
         wp_die('Empty field data.');
     }
     $field_name = $this->calculateFieldName($this->_name);
     $field_label = new THB_TemplateLoader('admin/fields/label', array('label_text' => $this->_label, 'label_for' => $field_name));
     if (empty($this->_label)) {
         $this->addClass('no-label');
     }
     if ($this->isComplex()) {
         $this->addClass('complex');
     }
     $field_help = new THB_TemplateLoader('admin/fields/help', array('help_text' => $this->_help));
     // Optionally load a subtemplate
     $field_template = $this->_template;
     if (!empty($this->_meta['subtemplate'])) {
         $field_template .= '_' . $this->_meta['subtemplate'];
     }
     if (!$this->_specificTemplatePath) {
         $field_template_class = $this->_template;
         $field_content = new THB_TemplateLoader("admin/fields/field_{$field_template}", array('field_name' => $field_name, 'field' => $this) + $this->_data);
     } else {
         $field_template_class = basename($field_template);
         $field_content = new THB_Template($field_template, array('field_name' => $field_name, 'field' => $this) + $this->_data);
     }
     $field_container = new THB_TemplateLoader('admin/fields/field', array('field_template' => $this->_template, 'field_template_class' => $field_template_class, 'field_name' => $this->_name, 'field_label' => $field_label->render(true), 'field_help' => $field_help->render(true), 'field_content' => $field_content->render(true), 'is_duplicable' => $this->isDuplicable(), 'field_class' => implode(' ', $this->_classes)) + $this->_meta);
     $field_container->render();
 }
 function thb_translated_admin_resource($key)
 {
     $thb_theme = thb_theme();
     $thb_admin_language = $thb_theme->getAdmin()->getLanguage();
     $thb_admin_default_language = $thb_theme->getAdmin()->getDefaultLanguage();
     if (file_exists(THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/admin/resources/' . $key . '.php')) {
         // $file = THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/admin/resources/' . $key;
         $thb_valid_language = $thb_admin_language;
     } else {
         // $file = THB_LANGUAGES_DIR . '/' . $thb_admin_default_language . '/admin/resources/' . $key;
         $thb_valid_language = $thb_admin_default_language;
     }
     $file = $thb_valid_language . '/admin/resources/' . $key;
     if (file_exists(THB_THEME_TEMPLATES_DIR . '/languages/' . $file . '.php')) {
         $file = THB_THEME_TEMPLATES_DIR . '/languages/' . $file;
     } else {
         $file = THB_LANGUAGES_DIR . '/' . $file;
     }
     $resource = new THB_Template($file);
     return $resource->render(true);
 }
 function thb_return_module_template_part($module, $path, $data = array())
 {
     $regular_path = THB_THEME_MODULES . '/' . $module . '/templates/' . $path;
     $alt_path = THB_THEME_TEMPLATES_DIR . '/modules/' . $module . '/' . $path;
     if (file_exists($alt_path . '.' . THB_Template::$extension)) {
         $template = new THB_Template($alt_path, $data);
     } else {
         $template = new THB_Template($regular_path, $data);
     }
     return $template->render(true);
 }
 /**
  * __toString()
  *
  */
 public function __toString()
 {
     return $this->_template->render(true);
 }