Ejemplo n.º 1
0
 public function testGetAvailable()
 {
     $themeName = 'seasons';
     $themes = Theme::getAllThemes();
     $this->assertTrue(is_array($themes));
     $theme = Theme::getTheme($themeName);
     $this->assertTrue($theme instanceof Theme);
     $this->assertEquals($themeName, $theme->directory);
 }
Ejemplo n.º 2
0
 public function browseAction()
 {
     $csrfForm = new Omeka_Form_SessionCsrf();
     $themes = apply_filters('browse_themes', Theme::getAllThemes());
     $public = get_option(Theme::PUBLIC_THEME_OPTION);
     $this->view->themes = $themes;
     $this->view->current = $themes[$public];
     $this->view->csrf = $csrfForm;
 }
Ejemplo n.º 3
0
 private function _addThemeInfo(&$info)
 {
     $themes = Theme::getAllThemes();
     $currentTheme = get_option('public_theme');
     $info['Themes'] = array();
     foreach ($themes as $name => $theme) {
         $themeInfo = @$theme->version;
         if ($name == $currentTheme) {
             $themeInfo .= ' (current)';
         }
         $info['Themes'][$name] = $themeInfo;
     }
     ksort($info['Themes']);
 }
 public function init()
 {
     // No cache for auto-refresh uploaded logo
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     parent::init();
     $this->can_display_themes = !Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP;
     libxml_use_internal_errors(true);
     // Download user themes from Addons
     if ($this->logged_on_addons) {
         $this->downloadAddonsThemes();
     }
     // Employee languages used for link and utm_source
     $lang = new Language($this->context->language->id);
     $iso_lang_uc = strtoupper($lang->iso_code);
     $this->fields_options = array('appearance' => array('title' => $this->l('Your current theme'), 'icon' => 'icon-html5', 'tabs' => array('logo' => $this->l('Logo'), 'logo2' => $this->l('Invoice & Email Logos'), 'icons' => $this->l('Icons'), 'mobile' => $this->l('Mobile')), 'fields' => array('PS_LOGO' => array('title' => $this->l('Header logo'), 'hint' => $this->l('Will appear on main page. Recommended height: 52px. Maximum height on default theme: 65px.'), 'type' => 'file', 'name' => 'PS_LOGO', 'tab' => 'logo', 'thumb' => _PS_IMG_ . Configuration::get('PS_LOGO')), 'PS_LOGO_MOBILE' => array('title' => $this->l('Header logo for mobile'), 'desc' => Configuration::get('PS_LOGO_MOBILE') === false ? '<span class="light-warning">' . $this->l('Warning: No mobile logo has been defined. The header logo will be used instead.') . '</span><br />' : '', 'hint' => $this->l('Will appear on the main page of your mobile template. If left undefined, the header logo will be used.'), 'type' => 'file', 'name' => 'PS_LOGO_MOBILE', 'tab' => 'mobile', 'thumb' => Configuration::get('PS_LOGO_MOBILE') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE')) ? _PS_IMG_ . Configuration::get('PS_LOGO_MOBILE') : _PS_IMG_ . Configuration::get('PS_LOGO')), 'PS_LOGO_MAIL' => array('title' => $this->l('Mail logo'), 'desc' => Configuration::get('PS_LOGO_MAIL') === false ? '<span class="light-warning">' . $this->l('Warning: if no email logo is available, the main logo will be used instead.') . '</span><br />' : '', 'hint' => $this->l('Will appear on email headers. If undefined, the header logo will be used.'), 'type' => 'file', 'name' => 'PS_LOGO_MAIL', 'tab' => 'logo2', 'thumb' => Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MAIL')) ? _PS_IMG_ . Configuration::get('PS_LOGO_MAIL') : _PS_IMG_ . Configuration::get('PS_LOGO')), 'PS_LOGO_INVOICE' => array('title' => $this->l('Invoice logo'), 'desc' => Configuration::get('PS_LOGO_INVOICE') === false ? '<span class="light-warning">' . $this->l('Warning: if no invoice logo is available, the main logo will be used instead.') . '</span><br />' : '', 'hint' => $this->l('Will appear on invoice headers.') . ' ' . $this->l('Warning: you can use a PNG file for transparency, but it can take up to 1 second per page for processing. Please consider using JPG instead.'), 'type' => 'file', 'name' => 'PS_LOGO_INVOICE', 'tab' => 'logo2', 'thumb' => Configuration::get('PS_LOGO_INVOICE') !== false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE')) ? _PS_IMG_ . Configuration::get('PS_LOGO_INVOICE') : _PS_IMG_ . Configuration::get('PS_LOGO')), 'PS_FAVICON' => array('title' => $this->l('Favicon'), 'hint' => $this->l('Will appear in the address bar of your web browser.'), 'type' => 'file', 'name' => 'PS_FAVICON', 'tab' => 'icons', 'thumb' => _PS_IMG_ . Configuration::get('PS_FAVICON')), 'PS_STORES_ICON' => array('title' => $this->l('Store icon'), 'hint' => $this->l('Will appear on the store locator (inside Google Maps).') . '<br />' . $this->l('Suggested size: 30x30, transparent GIF.'), 'type' => 'file', 'name' => 'PS_STORES_ICON', 'tab' => 'icons', 'thumb' => _PS_IMG_ . Configuration::get('PS_STORES_ICON')), 'PS_ALLOW_MOBILE_DEVICE' => array('title' => $this->l('Enable the mobile theme'), 'hint' => $this->l('Allows visitors browsing on mobile devices to view a lighter version of your website.'), 'type' => 'radio', 'required' => true, 'validation' => 'isGenericName', 'tab' => 'mobile', 'choices' => array(0 => $this->l('I\'d like to disable it.'), 1 => $this->l('I\'d like to enable it only on smartphones.'), 2 => $this->l('I\'d like to enable it only on tablets.'), 3 => $this->l('I\'d like to enable it on both smartphones and tablets.')))), 'after_tabs' => array('cur_theme' => Theme::getThemeInfo($this->context->shop->id_theme)), 'submit' => array('title' => $this->l('Save')), 'buttons' => array('storeLink' => array('title' => $this->l('Visit the theme catalog'), 'icon' => 'process-icon-themes', 'href' => 'http://addons.prestashop.com/en/3-templates-prestashop' . '?utm_source=back-office&utm_medium=theme-button' . '&utm_campaign=back-office-' . $iso_lang_uc . '&utm_content=' . (defined('_PS_HOST_MODE_') ? 'cloud' : 'download'), 'js' => 'return !window.open(this.href)'))));
     $installed_theme = Theme::getAllThemes(array($this->context->shop->id_theme));
     $non_installed_theme = $this->context->mode == Context::MODE_HOST ? array() : Theme::getNonInstalledTheme();
     if (count($installed_theme) || !empty($non_installed_theme)) {
         $this->fields_options['theme'] = array('title' => sprintf($this->l('Select a theme for the "%s" shop'), $this->context->shop->name), 'description' => !$this->can_display_themes ? $this->l('You must select a shop from the above list if you wish to choose a theme.') : '', 'fields' => array('theme_for_shop' => array('type' => 'theme', 'themes' => $installed_theme, 'not_installed' => $non_installed_theme, 'id_theme' => $this->context->shop->id_theme, 'can_display_themes' => $this->can_display_themes, 'no_multishop_checkbox' => true)));
     }
 }
/**
 * Get an array of available themes
 *
 * @return array
 */
function exhibit_builder_get_themes()
{
    $themeNames = array();
    $themes = apply_filters('browse_themes', Theme::getAllThemes());
    foreach ($themes as $themeDir => $theme) {
        $title = !empty($theme->title) ? $theme->title : $themeDir;
        $themeNames[$themeDir] = $title;
    }
    return $themeNames;
}
Ejemplo n.º 6
0
</dd>
		</dl>
	</div>
</div>

<div class="box clearfix">
	<div class="box-title">
		<h3><?php 
_e('Available Themes');
?>
</h3>
		<span></span>
	</div>
	<div class="box-content">
	<?php 
$themes = Theme::getAllThemes();
foreach ($themes as $theme) {
    if ($theme == $default) {
        continue;
    }
    $info = Theme::getInfo($theme);
    ?>
		<dl class="box-theme">
			<dt><a href="#" onclick="setTheme('<?php 
    echo $theme;
    ?>
'); return false;" title="应用该主题"><img src="<?php 
    echo $info['screenshot'];
    ?>
"></a></dt>
			<dd class="theme_name"><?php