本文整理汇总了PHP中Theme::getThemes方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getThemes方法的具体用法?PHP Theme::getThemes怎么用?PHP Theme::getThemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::getThemes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_module_1_3_2_11
function upgrade_module_1_3_2_11($object)
{
$themes = Theme::getThemes();
$theme_meta_value = array();
foreach ($object->controllers as $controller) {
$page = 'module-' . $object->name . '-' . $controller;
$result = Db::getInstance()->getValue('SELECT * FROM ' . _DB_PREFIX_ . 'meta WHERE page="' . pSQL($page) . '"');
if ((int) $result > 0) {
continue;
}
$meta = new Meta();
$meta->page = $page;
$meta->configurable = 0;
$meta->save();
if ((int) $meta->id > 0) {
foreach ($themes as $theme) {
$theme_meta_value[] = array('id_theme' => $theme->id, 'id_meta' => $meta->id, 'left_column' => (int) $theme->default_left_column, 'right_column' => (int) $theme->default_right_column);
}
} else {
$object->_errors[] = sprintf(Tools::displayError('Unable to install controller: %s'), $controller);
}
}
if (count($theme_meta_value) > 0) {
return Db::getInstance()->insert('theme_meta', $theme_meta_value);
}
return true;
}
示例2: getAvailable
/**
* return an array of all available theme (installed or not)
*
* @param boolean $installed_only
* @return array string (directory)
*/
public static function getAvailable($installed_only = true)
{
static $dirlist = array();
$available_theme = array();
if (empty($dirlist)) {
$themes = scandir(_PS_ALL_THEMES_DIR_);
foreach ($themes as $theme) {
if (is_dir(_PS_ALL_THEMES_DIR_ . DIRECTORY_SEPARATOR . $theme) && $theme[0] != '.') {
$dirlist[] = $theme;
}
}
}
if ($installed_only) {
$themes = Theme::getThemes();
foreach ($themes as $theme_obj) {
$themes_dir[] = $theme_obj->directory;
}
foreach ($dirlist as $theme) {
if (false !== array_search($theme, $themes_dir)) {
$available_theme[] = $theme;
}
}
} else {
$available_theme = $dirlist;
}
return $available_theme;
}
示例3: getSubThemes
function getSubThemes($theme_id) {
$query= <<< EOF
select a.*, b.layer_count from
(SELECT * FROM "Theme" where parent_id = %d AND theme_id <> parent_id and status = 1 order by theme_name) as a
left join
(select theme_id, count(*) as layer_count from "Theme_Layer_Mapping", "Meta_Layer" where "Theme_Layer_Mapping".layer_id = "Meta_Layer".layer_id and "Meta_Layer".status = 1 group by theme_id) as b
on a.theme_id = b.theme_id
EOF;
return Theme::getThemes($query, $theme_id);
}
示例4: renderForm
public function renderForm()
{
$getAvailableThemes = Theme::getAvailable(false);
$available_theme_dir = array();
$selected_theme_dir = null;
if ($this->object) {
$selected_theme_dir = $this->object->directory;
}
foreach ($getAvailableThemes as $k => $dirname) {
$available_theme_dir[$k]['value'] = $dirname;
$available_theme_dir[$k]['label'] = $dirname;
$available_theme_dir[$k]['id'] = $dirname;
}
$this->fields_form = array('tinymce' => false, 'legend' => array('title' => $this->l('Theme'), 'image' => '../img/admin/themes.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name of the theme:'), 'name' => 'name', 'size' => 48, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
// adding a new theme, you can create a directory, and copy from an existing theme
if ($this->display == 'add' || !$this->object->id) {
$this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Name of the theme\'s directory:'), 'name' => 'directory', 'required' => true, 'desc' => $this->l('If the directory does not exists, it will be created.'));
$theme_query = Theme::getThemes();
$this->fields_form['input'][] = array('type' => 'select', 'name' => 'based_on', 'label' => $this->l('Copy missing files from existing theme:'), 'desc' => $this->l('If you create a new theme, it\'s recommended to use default theme files.'), 'options' => array('id' => 'id', 'name' => 'name', 'default' => array('value' => 0, 'label' => ' - '), 'query' => $theme_query));
} else {
$this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Directory:'), 'name' => 'directory', 'required' => true, 'br' => true, 'class' => 't', 'values' => $available_theme_dir, 'selected' => $selected_theme_dir, 'desc' => $this->l('Please select a valid theme directory.'));
}
return parent::renderForm();
}
示例5: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_ && Tools::isSubmit('submitOptionsmeta') && (Tools::getValue('domain') != Configuration::get('PS_SHOP_DOMAIN') || Tools::getValue('domain_ssl') != Configuration::get('PS_SHOP_DOMAIN_SSL'))) {
$this->errors[] = Tools::displayError('This functionality has been disabled.');
return;
}
if (Tools::isSubmit('submitAddmeta')) {
$default_language = Configuration::get('PS_LANG_DEFAULT');
if (Tools::getValue('page') != 'index') {
$defaultLangIsValidated = Validate::isLinkRewrite(Tools::getValue('url_rewrite_' . $default_language));
$englishLangIsValidated = Validate::isLinkRewrite(Tools::getValue('url_rewrite_1'));
} else {
// index.php can have empty rewrite rule
$defaultLangIsValidated = !Tools::getValue('url_rewrite_' . $default_language) || Validate::isLinkRewrite(Tools::getValue('url_rewrite_' . $default_language));
$englishLangIsValidated = !Tools::getValue('url_rewrite_1') || Validate::isLinkRewrite(Tools::getValue('url_rewrite_1'));
}
if (!$defaultLangIsValidated && !$englishLangIsValidated) {
$this->errors[] = Tools::displayError('The URL rewrite field must be filled in either the default or English language.');
return false;
}
foreach (Language::getIDs(false) as $id_lang) {
$current = Tools::getValue('url_rewrite_' . $id_lang);
if (strlen($current) == 0) {
// Prioritize default language first
if ($defaultLangIsValidated) {
$_POST['url_rewrite_' . $id_lang] = Tools::getValue('url_rewrite_' . $default_language);
} else {
$_POST['url_rewrite_' . $id_lang] = Tools::getValue('url_rewrite_1');
}
}
}
Hook::exec('actionAdminMetaSave');
} elseif (Tools::isSubmit('submitRobots')) {
$this->generateRobotsFile();
}
if (Tools::isSubmit('PS_ROUTE_product_rule')) {
Tools::clearCache($this->context->smarty);
}
if (Tools::isSubmit('deletemeta') && (int) Tools::getValue('id_meta') > 0) {
Db::getInstance()->delete('theme_meta', 'id_meta=' . (int) Tools::getValue('id_meta'));
}
$ret = parent::postProcess();
if (Tools::isSubmit('submitAddmeta') && Validate::isLoadedObject($ret)) {
/** @var Theme $ret */
$themes = Theme::getThemes();
$theme_meta_value = array();
foreach ($themes as $theme) {
/** @var Theme $theme */
$theme_meta_value[] = array('id_theme' => (int) $theme->id, 'id_meta' => (int) $ret->id, 'left_column' => (int) $theme->default_left_column, 'right_column' => (int) $theme->default_right_column);
}
if (count($theme_meta_value) > 0) {
Db::getInstance()->insert('theme_meta', $theme_meta_value, false, true, DB::INSERT_IGNORE);
}
}
return $ret;
}
示例6: clearXMLCache
/**
* Clear XML cache folder
*/
public static function clearXMLCache()
{
$themes = array();
foreach (Theme::getThemes() as $theme) {
$themes[] = $theme->directory;
}
foreach (scandir(_PS_ROOT_DIR_ . '/config/xml') as $file) {
$path_info = pathinfo($file, PATHINFO_EXTENSION);
if ($path_info == 'xml' && $file != 'default.xml' && !in_array(basename($file, '.' . $path_info), $themes)) {
self::deleteFile(_PS_ROOT_DIR_ . '/config/xml/' . $file);
}
}
}
示例7: initContent
public function initContent()
{
if ($this->display == 'list') {
$this->display = '';
}
if (isset($this->display) && method_exists($this, 'render' . $this->display)) {
$this->content .= $this->initPageHeaderToolbar();
$this->content .= $this->{'render' . $this->display}();
$this->context->smarty->assign(array('content' => $this->content, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
} else {
$themes = array();
foreach (Theme::getThemes() as $theme) {
$themes[] = $theme->directory;
}
foreach (scandir(_PS_ALL_THEMES_DIR_) as $theme_dir) {
if ($theme_dir[0] != '.' && Validate::isDirName($theme_dir) && is_dir(_PS_ALL_THEMES_DIR_ . $theme_dir) && file_exists(_PS_ALL_THEMES_DIR_ . $theme_dir . '/preview.jpg') && !in_array($theme_dir, $themes)) {
$config_file = false;
$default_config = _PS_ROOT_DIR_ . '/config/xml/themes/default.xml';
$theme_config = _PS_ROOT_DIR_ . '/config/xml/themes/' . $theme_dir . '.xml';
if (file_exists($theme_config)) {
$config_file = $theme_config;
} elseif (file_exists($default_config)) {
$config_file = $default_config;
}
if ($config_file) {
$this->importThemeXmlConfig(simplexml_load_file($config_file), $theme_dir);
}
}
}
$content = '';
if (Configuration::hasKey('PS_LOGO') && trim(Configuration::get('PS_LOGO')) != '' && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'))) {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'));
Configuration::updateValue('SHOP_LOGO_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_WIDTH', (int) round($width));
}
if (file_exists(_PS_IMG_DIR_ . 'logo_mobile.jpg') && Configuration::get('PS_LOGO_MOBILE') && trim(Configuration::get('PS_LOGO_MOBILE')) != '') {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE'));
Configuration::updateValue('SHOP_LOGO_MOBILE_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_MOBILE_WIDTH', (int) round($width));
}
$this->content .= $content;
return parent::initContent();
}
}
示例8: displayAjaxGetKpi
//.........这里部分代码省略.........
break;
case 'avg_msg_response_time':
$value = sprintf($this->l('%.1f hours', null, null, false), AdminStatsController::getAverageMessageResponseTime(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))));
ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME', $value);
ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME_EXPIRE', strtotime('+4 hour'));
break;
case 'messages_per_thread':
$value = round(AdminStatsController::getMessagesPerThread(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))), 1);
ConfigurationKPI::updateValue('MESSAGES_PER_THREAD', $value);
ConfigurationKPI::updateValue('MESSAGES_PER_THREAD_EXPIRE', strtotime('+12 hour'));
break;
case 'newsletter_registrations':
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'customer`
WHERE newsletter = 1
' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
if (Module::isInstalled('blocknewsletter')) {
$value += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'newsletter`
WHERE active = 1
' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
}
ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS', $value);
ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS_EXPIRE', strtotime('+6 hour'));
break;
case 'enabled_languages':
$value = Language::countActiveLanguages();
ConfigurationKPI::updateValue('ENABLED_LANGUAGES', $value);
ConfigurationKPI::updateValue('ENABLED_LANGUAGES_EXPIRE', strtotime('+1 min'));
break;
case 'frontoffice_translations':
$themes = Theme::getThemes();
$languages = Language::getLanguages();
$total = $translated = 0;
foreach ($themes as $theme) {
foreach ($languages as $language) {
$kpi_key = substr(strtoupper($theme->name . '_' . $language['iso_code']), 0, 16);
$total += ConfigurationKPI::get('TRANSLATE_TOTAL_' . $kpi_key);
$translated += ConfigurationKPI::get('TRANSLATE_DONE_' . $kpi_key);
}
}
$value = 0;
if ($translated) {
$value = round(100 * $translated / $total, 1);
}
$value .= '%';
ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS', $value);
ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', strtotime('+2 min'));
break;
case 'main_country':
if (!($row = AdminStatsController::getMainCountry(date('Y-m-d', strtotime('-30 day')), date('Y-m-d')))) {
$value = $this->l('No orders', null, null, false);
} else {
$country = new Country($row['id_country'], $this->context->language->id);
$value = sprintf($this->l('%d%% %s', null, null, false), $row['orders'], $country->name);
}
ConfigurationKPI::updateValue('MAIN_COUNTRY', array($this->context->language->id => $value));
ConfigurationKPI::updateValue('MAIN_COUNTRY_EXPIRE', array($this->context->language->id => strtotime('+1 day')));
break;
case 'orders_per_customer':
$value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'customer` c
WHERE active = 1
示例9: initContent
public function initContent()
{
$this->checkMobileNeeds();
$themes = array();
foreach (Theme::getThemes() as $theme) {
$themes[] = $theme->directory;
}
foreach (scandir(_PS_ALL_THEMES_DIR_) as $theme_dir) {
if ($theme_dir[0] != '.' && Validate::isDirName($theme_dir) && is_dir(_PS_ALL_THEMES_DIR_ . $theme_dir) && file_exists(_PS_ALL_THEMES_DIR_ . $theme_dir . '/preview.jpg') && !in_array($theme_dir, $themes)) {
$theme = new Theme();
$theme->name = $theme->directory = $theme_dir;
$theme->add();
}
}
$content = '';
if (file_exists(_PS_IMG_DIR_ . 'logo.jpg')) {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'));
Configuration::updateValue('SHOP_LOGO_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_WIDTH', (int) round($width));
}
$this->content .= $content;
return parent::initContent();
}
示例10: renderForm
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$this->fields_form = array('legend' => array('title' => $this->l('Shop'), 'icon' => 'icon-shopping-cart'), 'input' => array(array('type' => 'text', 'label' => $this->l('Shop name'), 'desc' => array($this->l('This field does not refer to the shop name visible in the front office.'), sprintf($this->l('Follow %sthis link%s to edit the shop name used on the Front Office.'), '<a href="' . $this->context->link->getAdminLink('AdminStores') . '#store_fieldset_general">', '</a>')), 'name' => 'name', 'required' => true)));
$display_group_list = true;
if ($this->display == 'edit') {
$group = new ShopGroup($obj->id_shop_group);
if ($group->share_customer || $group->share_order || $group->share_stock) {
$display_group_list = false;
}
}
if ($display_group_list) {
$options = array();
foreach (ShopGroup::getShopGroups() as $group) {
if ($this->display == 'edit' && ($group->share_customer || $group->share_order || $group->share_stock) && ShopGroup::hasDependency($group->id)) {
continue;
}
$options[] = array('id_shop_group' => $group->id, 'name' => $group->name);
}
if ($this->display == 'add') {
$group_desc = $this->l('Warning: You won\'t be able to change the group of this shop if this shop belongs to a group with one of these options activated: Share Customers, Share Quantities or Share Orders.');
} else {
$group_desc = $this->l('You can only move your shop to a shop group with all "share" options disabled -- or to a shop group with no customers/orders.');
}
$this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Shop group'), 'desc' => $group_desc, 'name' => 'id_shop_group', 'options' => array('query' => $options, 'id' => 'id_shop_group', 'name' => 'name'));
} else {
$this->fields_form['input'][] = array('type' => 'hidden', 'name' => 'id_shop_group', 'default' => $group->name);
$this->fields_form['input'][] = array('type' => 'textShopGroup', 'label' => $this->l('Shop group'), 'desc' => $this->l('You can\'t edit the shop group because the current shop belongs to a group with the "share" option enabled.'), 'name' => 'id_shop_group', 'value' => $group->name);
}
$categories = Category::getRootCategories($this->context->language->id);
$this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Category root'), 'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,') . ' <a href="' . $this->context->link->getAdminLink('AdminCategories') . '&addcategoryroot" target="_blank">' . $this->l('Please click here') . '</a>', 'name' => 'id_category', 'options' => array('query' => $categories, 'id' => 'id_category', 'name' => 'name'));
if (Tools::isSubmit('id_shop')) {
$shop = new Shop((int) Tools::getValue('id_shop'));
$id_root = $shop->id_category;
} else {
$id_root = $categories[0]['id_category'];
}
$id_shop = (int) Tools::getValue('id_shop');
self::$currentIndex = self::$currentIndex . '&id_shop_group=' . (int) (Tools::getValue('id_shop_group') ? Tools::getValue('id_shop_group') : (isset($obj->id_shop_group) ? $obj->id_shop_group : Shop::getContextShopGroupID()));
$shop = new Shop($id_shop);
$selected_cat = Shop::getCategories($id_shop);
if (empty($selected_cat)) {
// get first category root and preselect all these children
$root_categories = Category::getRootCategories();
$root_category = new Category($root_categories[0]['id_category']);
$children = $root_category->getAllChildren($this->context->language->id);
$selected_cat[] = $root_categories[0]['id_category'];
foreach ($children as $child) {
$selected_cat[] = $child->id;
}
}
if (Shop::getContext() == Shop::CONTEXT_SHOP && Tools::isSubmit('id_shop')) {
$root_category = new Category($shop->id_category);
} else {
$root_category = new Category($id_root);
}
$this->fields_form['input'][] = array('type' => 'categories', 'name' => 'categoryBox', 'label' => $this->l('Associated categories'), 'tree' => array('id' => 'categories-tree', 'selected_categories' => $selected_cat, 'root_category' => $root_category->id, 'use_search' => true, 'use_checkbox' => true), 'desc' => $this->l('By selecting associated categories, you are choosing to share the categories between shops. Once associated between shops, any alteration of this category will impact every shop.'));
/*$this->fields_form['input'][] = array(
'type' => 'switch',
'label' => $this->l('Enabled'),
'name' => 'active',
'required' => true,
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1
),
array(
'id' => 'active_off',
'value' => 0
)
),
'desc' => $this->l('Enable or disable your store?')
);*/
$themes = Theme::getThemes();
if (!isset($obj->id_theme)) {
foreach ($themes as $theme) {
if (isset($theme->id)) {
$id_theme = $theme->id;
break;
}
}
}
$this->fields_form['input'][] = array('type' => 'theme', 'label' => $this->l('Theme'), 'name' => 'theme', 'values' => $themes);
$this->fields_form['submit'] = array('title' => $this->l('Save'));
if (Shop::getTotalShops() > 1 && $obj->id) {
$disabled = array('active' => false);
} else {
$disabled = false;
}
$import_data = array('carrier' => $this->l('Carriers'), 'cms' => $this->l('CMS pages'), 'contact' => $this->l('Contact information'), 'country' => $this->l('Countries'), 'currency' => $this->l('Currencies'), 'discount' => $this->l('Discount prices'), 'employee' => $this->l('Employees'), 'image' => $this->l('Images'), 'lang' => $this->l('Languages'), 'manufacturer' => $this->l('Manufacturers'), 'module' => $this->l('Modules'), 'hook_module' => $this->l('Module hooks'), 'meta_lang' => $this->l('Meta'), 'product' => $this->l('Products'), 'product_attribute' => $this->l('Combinations'), 'scene' => $this->l('Scenes'), 'stock_available' => $this->l('Available quantities for sale'), 'store' => $this->l('Stores'), 'warehouse' => $this->l('Warehouses'), 'webservice_account' => $this->l('Webservice accounts'), 'attribute_group' => $this->l('Attribute groups'), 'feature' => $this->l('Features'), 'group' => $this->l('Customer groups'), 'tax_rules_group' => $this->l('Tax rules groups'), 'supplier' => $this->l('Suppliers'), 'referrer' => $this->l('Referrers/affiliates'), 'zone' => $this->l('Zones'), 'cart_rule' => $this->l('Cart rules'));
// Hook for duplication of shop data
$modules_list = Hook::getHookModuleExecList('actionShopDataDuplication');
if (is_array($modules_list) && count($modules_list) > 0) {
foreach ($modules_list as $m) {
$import_data['Module' . ucfirst($m['module'])] = Module::getModuleName($m['module']);
}
//.........这里部分代码省略.........
示例11: _getThemesList
/**
* Return an array of theme
*
* @return array([theme dir] => array('name' => [theme name]))
* @deprecated 1.5.5.0
*/
protected function _getThemesList()
{
Tools::displayAsDeprecated();
static $themes = array();
if (empty($themes)) {
$installed_themes = Theme::getThemes();
foreach ($installed_themes as $theme) {
/** @var Theme $theme */
$themes[$theme->directory] = array('name' => $theme->name);
}
}
return $themes;
}
示例12: displayForm1
private function displayForm1()
{
$installed_themes = '<option value="" >' . $this->l('select a theme to export') . '</option>';
if (_PS_VERSION_ < '1.5') {
$theme_list = $this->getThemes14();
foreach ($theme_list as $row) {
$installed_themes .= '<option value="' . $row . '" ' . ($row == _THEME_NAME_ ? 'selected="selected"' : '') . '>' . $row . '</option>';
}
} else {
$theme_list = Theme::getThemes();
foreach ($theme_list as $theme) {
$installed_themes .= '<option value="' . $theme->id . '" >' . $theme->name . '</option>';
}
}
if (count($theme_list) > 0) {
$this->_html .= '
<fieldset>
<legend>' . $this->l('Export a theme') . '</legend>
<label>' . $this->l('Select a theme') . '</label>';
$this->_html .= '<form action="' . $this->action_form . '" method="post" enctype="multipart/form-data">';
$this->_html .= '<div class="margin-form">
<select style="width:350px" name="id_theme">' . $installed_themes . '</select>
</div>
<input type="submit" class="button" name="exportTheme"
value="' . $this->l('Export this theme') . '"
onclick="if (!$(\'select[name=\\\'id_theme\\\']\').val().length) { alert(\'' . htmlentities($this->l('Please select a theme'), ENT_QUOTES, 'utf-8') . '\'); return false; } "/>';
$this->_html .= '</form>';
$this->_html .= '</fieldset>
<div class="clear"> </div>';
}
$this->_html .= '
<fieldset>
<legend>' . $this->l('Import from your computer') . '</legend>
<form action="' . $this->action_form . '" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
<label for="themearchive">' . $this->l('Archive File') . '</label>
<div class="margin-form">
<input type="file" id="themearchive" name="themearchive" />
<p class="clear">' . $this->l('Where is your zip file?') . '</p>
</div>
<input type="submit" class="button" name="submitImport1" value="' . $this->l('Next') . '" />
</form>
</fieldset>
<div class="clear"> </div>
';
$link_url = Tools::getValue('linkurl') ? Tools::safeOutput(Tools::getValue('linkurl')) : 'http://';
$this->_html .= '
<fieldset>
<legend>' . $this->l('Import from the web') . '</legend>
<form action="' . $this->action_form . '" method="post" enctype="multipart/form-data">
<label for="linkurl">' . $this->l('Archive URL') . '</label>
<div class="margin-form">
<input type="text" id="linkurl" name="linkurl" value="' . $link_url . '"/>
</div>
<input type="submit" class="button" name="submitImport2" value="' . $this->l('Next') . '" />
</form>
</fieldset>
<div class="clear"> </div>';
// Import folder is located in the module directory
$import_dir = scandir(_IMPORT_FOLDER_);
$list = array();
foreach ($import_dir as $row) {
if (substr(_IMPORT_FOLDER_ . $row, -4) == '.zip') {
$list[] = $row;
}
}
$import_dir = '';
foreach ($list as $row) {
$import_dir .= '<option value="' . $row . '">' . $row . '</option>';
}
$this->_html .= '
<fieldset>
<legend>' . $this->l('Import from FTP') . '</legend>
<form action="' . $this->action_form . '" method="post" enctype="multipart/form-data">
<label for="linkurl">' . $this->l('Select archive') . '</label>
<div class="margin-form">
<select name="ArchiveName" style="width:350px">
' . $import_dir . '
</select>
<p>' . sprintf($this->l('Select the ZIP file you want to use (it should have been uploaded to your %s directory).'), '<b>modules/themeinstallator/import/</b>') . '</p>
</div>
<input type="submit" class="button" name="submitImport3" value="' . $this->l('Next') . '" />
</form>
</fieldset>
<div class="clear"> </div>';
}
示例13: isThemeInstalled
protected function isThemeInstalled($theme_name)
{
$themes = Theme::getThemes();
foreach ($themes as $theme_object) {
/** @var Theme $theme_object */
if ($theme_object->name == $theme_name) {
return true;
}
}
return false;
}
示例14: searchHooksInThemes
private function searchHooksInThemes()
{
$themes = Theme::getThemes();
$not_found_hooks = array();
foreach ($themes as $theme) {
if (!$theme->isUsed()) {
continue;
}
$this->searchHooksInTheme($theme->directory, $not_found_hooks);
}
return $not_found_hooks;
}
示例15: isThemeInstalled
public function isThemeInstalled($theme_name)
{
$themes = Theme::getThemes();
foreach ($themes as $theme_object) {
if ($theme_object->name == $theme_name) {
return true;
}
}
return false;
}