public function viewOriginalAction() { $theme_id = waRequest::get('theme_id'); $template = $this->getConfig()->getRootPath() . '/wa-system/design/templates/DesignViewOriginal.html'; $file = array(); if ($theme_id && ($f = waRequest::get('file'))) { $app_id = $this->getAppId(); $theme = new waTheme($theme_id, $app_id); $file = $theme->getFile($f); if ($file['parent']) { $theme = $theme->parent_theme; $theme_id = $theme->id; $app_id = $theme->app_id; } $theme_path = wa()->getAppPath('themes/' . $theme_id, $app_id) . '/'; $path = $theme_path . $f; if ($theme['type'] == waTheme::OVERRIDDEN && file_exists($path)) { $file = $theme->getFile($f); $file['id'] = $f; $file['content'] = file_get_contents($path); $file['theme_path'] = str_replace(wa()->getConfig()->getRootPath(), '', $theme_path); } } $this->display(array('file' => $file), $template); }
/** * @param waTheme $theme * @param string $template * @return bool */ public function setThemeTemplate($theme, $template) { $this->assign('wa_active_theme_path', $theme->path); $this->assign('wa_active_theme_url', $theme->url); $file = $theme->getFile($template); if ($parent_theme = $theme->parent_theme) { if ($file['parent']) { $theme = $parent_theme; } else { $this->assign('wa_parent_theme_url', $parent_theme->url); } } $this->assign('wa_theme_url', $theme->url); $this->setTemplateDir($theme->path); return file_exists($theme->path . '/' . $template); }
/** * Set template directory and global valiables. * * @param waTheme $theme Instance of theme object * @param string $template Path to template or resource string specifying template * @return bool */ public function setThemeTemplate($theme, $template) { $this->assign('wa_active_theme_path', $theme->path); $this->assign('wa_active_theme_url', $this->getStaticUrl($theme->url)); $theme_settings = $theme->getSettings(true); $theme_settings_config = $theme->getSettings(); $locales = $theme->getLocales(); $version = $theme->version(true); $file = $theme->getFile($template); if ($parent_theme = $theme->parent_theme) { $edition = $theme->edition + $parent_theme->edition; if (!empty($file['parent'])) { if ($parent_theme->version($edition) > $version) { $version = $parent_theme->version($edition); } else { $version = $theme->version($edition); } $theme = $parent_theme; } $this->assign('wa_parent_theme_url', $this->getStaticUrl($parent_theme->url)); $this->assign('wa_parent_theme_path', $parent_theme->path); if ($parent_settings = $parent_theme->getSettings(true)) { $theme_settings = $theme_settings + $parent_settings; foreach ($parent_theme->getSettings() as $k => $v) { if (!isset($theme_settings_config[$k])) { $v['parent'] = 1; $theme_settings_config[$k] = $v; } } } if ($parent_theme->getLocales()) { $locales += $parent_theme->getLocales(); } } $this->assign('wa_theme_version', $version); waLocale::setStrings($locales); $this->assign('theme_settings', $theme_settings); $this->assign('theme_settings_config', $theme_settings_config); $this->assign('wa_theme_url', $this->getStaticUrl($theme->url)); $this->assign('wa_real_theme_url', $theme->url); $this->setTemplateDir($theme->path); return file_exists($theme->path . '/' . $template); }
/** * Set template directory and global valiables. * * @param waTheme $theme Instance of theme object * @param string $template Path to template or resource string specifying template * @return bool */ public function setThemeTemplate($theme, $template) { $this->assign('wa_active_theme_path', $theme->path); $this->assign('wa_active_theme_url', $theme->url); $this->assign('wa_theme_version', $theme->version()); $theme_settings = $theme->getSettings(true); $locales = $theme->getLocales(); $file = $theme->getFile($template); if ($parent_theme = $theme->parent_theme) { if (!empty($file['parent'])) { $theme = $parent_theme; } $this->assign('wa_parent_theme_url', $parent_theme->url); $this->assign('wa_parent_theme_path', $parent_theme->path); if ($parent_settings = $parent_theme->getSettings(true)) { $theme_settings = $theme_settings + $parent_settings; } if ($parent_theme->getLocales()) { $locales += $parent_theme->getLocales(); } } waLocale::setStrings($locales); $this->assign('theme_settings', $theme_settings); $this->assign('wa_theme_url', $theme->url); $this->setTemplateDir($theme->path); return file_exists($theme->path . '/' . $template); }