本文整理汇总了PHP中Theme::getThemeInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getThemeInfo方法的具体用法?PHP Theme::getThemeInfo怎么用?PHP Theme::getThemeInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::getThemeInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
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)));
}
}
示例2: hookDisplayHeader
public function hookDisplayHeader($params)
{
$this->context->controller->removeJS('/granada/js/jquery/plugins/jqzoom/jquery.jqzoom.js');
$id_shop = (int) $this->context->shop->id;
$current_id_option = Configuration::get('OVIC_CURRENT_OPTION', null, null, $id_shop);
$current_option = new Options($current_id_option);
$current_theme = Theme::getThemeInfo($this->context->shop->id_theme);
if (strtolower($current_option->theme) != strtolower($current_theme['theme_name'])) {
Configuration::deleteByName('OVIC_CURRENT_OPTION');
Configuration::deleteByName('OVIC_LAYOUT_COLUMN');
Configuration::deleteByName('OVIC_CURRENT_DIR');
$current_id_option = null;
}
$emptyOption = false;
if (!$current_id_option || !Validate::isUnsignedId($current_id_option) || !OvicLayoutControl::isAvailablebyId($current_id_option)) {
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'ovic_options` o
WHERE LCASE(o.`theme`) =\'' . strtolower($current_theme['theme_name']) . '\'';
$options = Db::getInstance()->executeS($sql);
if ($options && is_array($options) && sizeof($options) > 0) {
foreach ($options as $option) {
$current_option = new Options($option['id_option']);
Configuration::updateValue('OVIC_CURRENT_OPTION', $option['id_option'], false, null, $id_shop);
Configuration::updateValue('OVIC_CURRENT_DIR', str_replace(' ', '_', $current_option->alias), false, null, $id_shop);
$current_id_option = $option['id_option'];
break;
}
} else {
$emptyOption = true;
}
}
if (!$emptyOption) {
$current_option = new Options($current_id_option);
if (strtolower($current_option->theme) == strtolower($current_theme['theme_name'])) {
$selected_layout = Configuration::get('OVIC_LAYOUT_COLUMN', null, null, $id_shop);
if (!$selected_layout || substr_count($current_option->column, $selected_layout) < 1) {
if (strlen($current_option->column) > 0) {
$selected_layout = (int) substr($current_option->column, 0, 1);
Configuration::updateValue('OVIC_LAYOUT_COLUMN', $selected_layout, false, null, $id_shop);
$this->ProcessLayoutColumn();
}
}
} else {
$emptyOption = true;
}
}
if ($emptyOption) {
$this->context->smarty->assign(array('emptyOption' => Tools::displayError('There is no Option, please add new Option from Layout Builder menu.')));
return '';
}
$output = '';
global $smarty;
$optionStyle = $this->getOptionStyle($current_option->theme, $current_option->alias);
$fonts = array();
if ($optionStyle['font'] && is_array($optionStyle['font']) && sizeof($optionStyle['font']) > 0) {
foreach ($optionStyle['font'] as $key => $font) {
$start = strpos($font, 'family');
$fontName = substr_replace($font, '', 0, $start + 7);
$start = strpos($fontName, "'");
$fontName = substr_replace($fontName, '', $start, strlen($fontName));
if (strpos($fontName, ":") > 0) {
$start = strpos($fontName, ":");
$fontName = substr_replace($fontName, '', $start, strlen($fontName));
}
$fontName = str_replace('+', ' ', $fontName);
if (strlen($font) > 0) {
$start = strpos($font, 'http');
$substr = substr_replace($font, '', $start, strlen($font) - $start);
$start = strpos($font, ':');
$font = substr_replace($font, '', 0, $start);
$font = $substr . (empty($_SERVER['HTTPS']) ? 'http' : 'https') . $font;
}
$fonts[] = array('fontname' => $fontName, 'linkfont' => $font);
}
}
if ($optionStyle['color'] && is_array($optionStyle['color']) && sizeof($optionStyle['color']) > 0) {
$grbacolor = $this->hex2rgba($optionStyle['color']['main']);
}
$current_id_option = Configuration::get('OVIC_CURRENT_OPTION', null, null, $id_shop);
$current_dir = trim(Configuration::get('OVIC_CURRENT_DIR', null, null, $id_shop));
if (Dispatcher::getInstance()->getController() == 'contact') {
$default_country = new Country((int) Tools::getCountry());
//$a = 'http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'://maps.google.com/maps/api/js?sensor=true®ion='.substr($default_country->iso_code, 0, 2);
$this->context->controller->addJS('http' . (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE') ? 's' : '') . '://maps.google.com/maps/api/js?sensor=true®ion=' . substr($default_country->iso_code, 0, 2));
$this->context->controller->addJS(_THEME_JS_DIR_ . 'contact.js');
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distanceUnit, array('km', 'mi'))) {
$distanceUnit = 'km';
}
$this->context->smarty->assign(array('mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'defaultLat' => (double) Configuration::get('PS_STORES_CENTER_LAT'), 'defaultLong' => (double) Configuration::get('PS_STORES_CENTER_LONG'), 'searchUrl' => $this->context->link->getPageLink('stores'), 'logo_store' => Configuration::get('PS_STORES_ICON'), 'distanceUnit' => $distanceUnit, 'hasStoreIcon' => file_exists(_PS_IMG_DIR_ . Configuration::get('PS_STORES_ICON'))));
}
$smarty->assign(array('grbacolor' => isset($grbacolor) ? $grbacolor : '', 'font' => $fonts, 'color' => $optionStyle['color'], 'current_id_option' => $current_id_option, 'current_dir' => $current_dir, 'BEFORE_LOGO' => Hook::exec('displayBeforeLogo'), 'HOOK_HOME_TOP_COLUMN' => Hook::exec('displayHomeTopColumn'), 'HOME_BOTTOM_CONTENT' => Hook::exec('displayHomeBottomContent'), 'HOME_BOTTOM_COLUMN' => Hook::exec('displayHomeBottomColumn'), 'HOME_TOP_CONTENT' => Hook::exec('displayHomeTopContent'), 'BOTTOM_COLUMN' => Hook::exec('displayBottomColumn')));
return $this->display(__FILE__, 'multistyle.tpl');
}
示例3: renderList
public function renderList()
{
$view = Tools::getValue('view', 'default');
$id_lang = $this->context->language->id;
$id_shop = $this->context->shop->id;
if ($view == 'default') {
$languages = Language::getLanguages(false);
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$tpl = $this->createTemplate('oviclayout.tpl');
$id_tab = (int) Tools::getValue('id_tab', 0);
$current_id_option = Configuration::get('OVIC_CURRENT_OPTION', null, null, $id_shop);
$check_option = new Options($current_id_option);
$current_theme = Theme::getThemeInfo($this->context->shop->id_theme);
if (strtolower($check_option->theme) != strtolower($current_theme['theme_name'])) {
Configuration::deleteByName('OVIC_CURRENT_OPTION');
Configuration::deleteByName('OVIC_LAYOUT_COLUMN');
Configuration::deleteByName('OVIC_CURRENT_DIR');
$current_id_option = null;
}
$emptyOption = false;
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'ovic_options` o
WHERE LCASE(o.`theme`) =\'' . strtolower($current_theme['theme_name']) . '\'';
$options = Db::getInstance()->executeS($sql);
if ($options && is_array($options) && sizeof($options) > 0) {
if (!$current_id_option || !Validate::isUnsignedId($current_id_option) || !OvicLayoutControl::isAvailablebyId($current_id_option)) {
foreach ($options as $option) {
$current_option = new Options($option['id_option']);
Configuration::updateValue('OVIC_CURRENT_OPTION', $option['id_option'], false, null, $id_shop);
Configuration::updateValue('OVIC_CURRENT_DIR', str_replace(' ', '_', $current_option->alias), false, null, $id_shop);
$current_id_option = $option['id_option'];
break;
}
}
} else {
$emptyOption = true;
}
if ($options && is_array($options) && sizeof($options) > 0) {
$current_option = new Options($current_id_option);
}
if (!$emptyOption) {
$selected_layout = Configuration::get('OVIC_LAYOUT_COLUMN', null, null, $id_shop);
if (!$selected_layout || substr_count($current_option->column, $selected_layout) < 1) {
if (strlen($current_option->column) > 0) {
$selected_layout = (int) substr($current_option->column, 0, 1);
Configuration::updateValue('OVIC_LAYOUT_COLUMN', $selected_layout, false, null, $id_shop);
$this->ProcessLayoutColumn();
}
}
} else {
$tpl->assign(array('emptyOption' => Tools::displayError('There is no Option, please add new Option from Layout Builder menu.')));
}
//get sidebar infomation
$pagelist = Meta::getMetas();
$sidebarPages = array();
if ($pagelist && is_array($pagelist) && sizeof($pagelist) > 0) {
$theme = new Theme((int) $this->context->shop->id_theme);
foreach ($pagelist as $page) {
$sidebarPage = array();
$meta_object = new Meta($page['id_meta']);
$title = $page['page'];
if (isset($meta_object->title[(int) $id_lang]) && $meta_object->title[(int) $id_lang] != '') {
$title = $meta_object->title[(int) $id_lang];
}
$sidebarPage['id_meta'] = $page['id_meta'];
$sidebarPage['title'] = $title;
$sidebarPage['page_name'] = $page['page'];
$sidebarPage['displayLeft'] = $theme->hasLeftColumn($page['page']) ? 1 : 0;
$sidebarPage['displayRight'] = $theme->hasRightColumn($page['page']) ? 1 : 0;
$sidebarPages[] = $sidebarPage;
}
}
$tpl->assign(array('postUrl' => self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminLayoutSetting'), 'absoluteUrl' => __PS_BASE_URI__ . 'modules/' . $this->module->name, 'id_tab' => $id_tab, 'options' => $options, 'current_option' => isset($current_option) ? $current_option : null, 'selected_layout' => isset($selected_layout) ? $selected_layout : null, 'sidebarPages' => $sidebarPages));
} elseif ($view == 'detail') {
$tpl = $this->createTemplate('sidebarmodule.tpl');
$pagemeta = Tools::getValue('pagemeta');
$meta = Meta::getMetaByPage($pagemeta, $id_lang);
$theme = new Theme((int) $this->context->shop->id_theme);
$LeftModules = array();
$RightModules = array();
if ($theme->hasLeftColumn($pagemeta)) {
$LeftModules = OvicLayoutControl::getSideBarModulesByPage($pagemeta, 'left');
}
if ($theme->hasRightColumn($pagemeta)) {
$RightModules = OvicLayoutControl::getSideBarModulesByPage($pagemeta, 'right');
}
$tpl->assign(array('postUrl' => self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminLayoutSetting'), 'leftModule' => $LeftModules, 'rightModule' => $RightModules, 'pagemeta' => $pagemeta, 'pagename' => $meta['title'], 'displayLeft' => $theme->hasLeftColumn($pagemeta), 'displayRight' => $theme->hasRightColumn($pagemeta), 'templatePath' => $this->getTemplatePath(), 'moduleDir' => _MODULE_DIR_));
}
return $tpl->fetch();
}
示例4: postProcess
/**
* Process posting data
*/
public function postProcess()
{
$languages = Language::getLanguages(false);
$current_theme = Theme::getThemeInfo($this->context->shop->id_theme);
//$theme_arr['theme_id'] = $theme->id;
// $theme_arr['theme_name'] = $theme->name;
// $theme_arr['theme_directory'] = $theme->directory;
if (Tools::isSubmit('submitnewOption')) {
$id_option = Tools::getValue('id_option');
if ($id_option && Validate::isUnsignedId($id_option)) {
$option = new Options($id_option);
$addaction = false;
} else {
$option = new Options();
$addaction = true;
}
$option->column = Tools::getValue('colselected');
$option->theme = strtolower($current_theme['theme_name']);
$option->alias = Tools::getValue('alias');
$option->active = (int) Tools::getValue('active');
$name_set = false;
$option_name = Tools::getValue('option_name');
if (strlen($option_name) > 0) {
$name_set = true;
$option->name = $option_name;
}
if (!$name_set) {
$lang_title = Language::getLanguage($this->context->language->id);
$this->errors[] = Tools::displayError('This item title field is required');
}
if (strlen($option->alias) > 0) {
if (OvicLayoutControl::isAvailablebyAlias($option->alias) > 0) {
$this->errors[] = Tools::displayError('Alias is avaiable in database');
}
} else {
$this->errors[] = Tools::displayError('This item alias field is required');
}
if (isset($_FILES['option_img']) && strlen($_FILES['option_img']['name']) > 0) {
$img_name = time() . $_FILES['option_img']['name'];
$img_name = preg_replace('/[^A-Za-z0-9\\-.]/', '', $img_name);
// Removes special chars.
//_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $this->name .DIRECTORY_SEPARATOR
$main_name = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'oviclayoutcontrol' . DIRECTORY_SEPARATOR . 'thumbnails' . DIRECTORY_SEPARATOR . $img_name;
if (!move_uploaded_file($_FILES['option_img']['tmp_name'], $main_name)) {
$this->errors[] = Tools::displayError('An error occurred during the image upload.');
} else {
$option->image = $img_name;
if (Tools::getValue('old_img') != '') {
$filename = Tools::getValue('old_img');
if (file_exists(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename)) {
@unlink(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename);
}
}
}
} else {
$option->image = Tools::getValue('old_img');
}
if (!count($this->errors)) {
if ($addaction) {
if (!$option->add()) {
$this->errors[] = Tools::displayError('An error occurred while saving data.');
} else {
if (Tools::getIsset('id_copy_option')) {
$id_copy_option = (int) Tools::getValue('id_copy_option');
$source_option = new Options($id_copy_option);
OvicLayoutControl::copyHookModule($source_option, $option);
OvicLayoutControl::copyOptionStyle($source_option, $option);
} else {
OvicLayoutControl::registerDefaultHookModule($option->id);
}
}
} else {
if (!$option->update()) {
$this->errors[] = Tools::displayError('An error occurred while update data.');
}
}
if (!count($this->errors)) {
Tools::redirectAdmin(self::$currentIndex . '&conf=3&token=' . Tools::getValue('token'));
}
}
} elseif (Tools::isSubmit('changeactive')) {
$id_option = Tools::getValue('id_option');
if ($id_option && Validate::isUnsignedId($id_option)) {
$option = new Options($id_option);
$option->active = !$option->active;
if (!$option->update()) {
$this->errors[] = Tools::displayError('Could not change');
} else {
Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getValue('token'));
}
}
} elseif (Tools::isSubmit('removeoption')) {
$id_option = Tools::getValue('id_option');
if ($id_option && Validate::isUnsignedId($id_option)) {
$option = new Options($id_option);
if (!$option->delete()) {
$this->errors[] = Tools::displayError('An error occurred during deletion');
//.........这里部分代码省略.........
示例5: getThemeInfo
/**
* Retrieves theme information
*
* Returns the field value or false on failure.
*
* @param string $key The theme info key
*
* @return string|false
*/
public function getThemeInfo($key)
{
return $this->theme->getThemeInfo($key);
}