本文整理汇总了PHP中Meta::getMetasByIdLang方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::getMetasByIdLang方法的具体用法?PHP Meta::getMetasByIdLang怎么用?PHP Meta::getMetasByIdLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meta
的用法示例。
在下文中一共展示了Meta::getMetasByIdLang方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_metas
public static function list_metas()
{
$context = Context::getContext();
$table = new Cli\Table();
$table->setHeaders(array('id', 'page', 'title', 'description', 'url_rewrite', 'keywords'));
$metas = Meta::getMetasByIdLang($context->lang->id);
foreach ($metas as $meta) {
$table->addRow(array($meta['id_meta'], $meta['page'], $meta['title'], $meta['description'], $meta['url_rewrite'], $meta['keywords']));
}
$table->display();
return;
}
示例2: generateHtaccess
public static function generateHtaccess($path, $rewrite_settings, $cache_control, $specific = '', $disableMuliviews = false)
{
$tab = array('ErrorDocument' => array(), 'RewriteEngine' => array(), 'RewriteRule' => array());
$multilang = Language::countActiveLanguages() > 1;
// ErrorDocument
$tab['ErrorDocument']['comment'] = '# Catch 404 errors';
$tab['ErrorDocument']['content'] = '404 ' . __PS_BASE_URI__ . '404.php';
// RewriteEngine
$tab['RewriteEngine']['comment'] = '# URL rewriting module activation';
// RewriteRules
$tab['RewriteRule']['comment'] = '# URL rewriting rules';
// Compatibility with the old image filesystem
if (Configuration::get('PS_LEGACY_IMAGES')) {
$tab['RewriteRule']['content']['^([a-z0-9]+)\\-([a-z0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1-$2$3.jpg [L]';
$tab['RewriteRule']['content']['^([0-9]+)\\-([0-9]+)/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1-$2.jpg [L]';
}
// Rewriting for product image id < 100 millions
$tab['RewriteRule']['content']['^([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$1$2.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$1$2$3.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$1$2$3$4.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$1$2$3$4$5.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg [L]';
$tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg [L]';
$tab['RewriteRule']['content']['^c/([0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = 'img/c/$1$2.jpg [L]';
$tab['RewriteRule']['content']['^c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\\.jpg$'] = 'img/c/$1.jpg [L]';
if ($multilang) {
$tab['RewriteRule']['content']['^([a-z]{2})/[a-zA-Z0-9-]*/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$2&isolang=$1&noredirect=1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/content/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms=$2 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/content/category/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms_category=$2 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)__[a-zA-Z0-9-]*'] = 'supplier.php?isolang=$1&id_supplier=$2 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)_[a-zA-Z0-9-]*'] = 'manufacturer.php?isolang=$1&id_manufacturer=$2 [QSA,L]';
}
// PS BASE URI automaticaly prepend the string, do not use PS defines for the image directories
$tab['RewriteRule']['content']['^([0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = 'img/c/$1$2.jpg [L]';
$tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$1 [QSA,L]';
$tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$1 [QSA,L]';
// Notice : the id_category rule has to be after product rules.
// If not, category with number in their name will result a bug
$tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$1&noredirect=1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)__([a-zA-Z0-9-]*)'] = 'supplier.php?id_supplier=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)_([a-zA-Z0-9-]*)'] = 'manufacturer.php?id_manufacturer=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/category/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]';
// Compatibility with the old URLs
if (!Configuration::get('PS_INSTALL_VERSION') or version_compare(Configuration::get('PS_INSTALL_VERSION'), '1.4.0.7') == -1) {
// This is a nasty copy/paste of the previous links, but with "lang-en" instead of "en"
// Do not update it when you add something in the one at the top, it's only for the old links
$tab['RewriteRule']['content']['^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\\-([a-zA-Z0-9-]*)\\.html'] = 'product.php?id_product=$3&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^lang-([a-z]{2})/([0-9]+)\\-([a-zA-Z0-9-]*)\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^lang-([a-z]{2})/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'category.php?id_category=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/category/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]';
}
Language::loadLanguages();
$default_meta = Meta::getMetasByIdLang((int) Configuration::get('PS_LANG_DEFAULT'));
if ($multilang) {
foreach (Language::getLanguages() as $language) {
foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) {
if (!empty($meta['url_rewrite']) and Validate::isLinkRewrite($meta['url_rewrite'])) {
$tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $meta['url_rewrite'] . '$'] = $meta['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]';
} elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') {
$tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $default_meta[$key]['url_rewrite'] . '$'] = $default_meta[$key]['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]';
}
}
$tab['RewriteRule']['content']['^' . $language['iso_code'] . '$'] = $language['iso_code'] . '/ [QSA,L]';
$tab['RewriteRule']['content']['^' . $language['iso_code'] . '/([^?&]*)$'] = '$1?isolang=' . $language['iso_code'] . ' [QSA,L]';
}
} else {
foreach ($default_meta as $key => $meta) {
if (!empty($meta['url_rewrite'])) {
$tab['RewriteRule']['content']['^' . $meta['url_rewrite'] . '$'] = $meta['page'] . '.php [QSA,L]';
} elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') {
$tab['RewriteRule']['content']['^' . $default_meta[$key]['url_rewrite'] . '$'] = $default_meta[$key]['page'] . '.php [QSA,L]';
}
}
}
if (!($writeFd = @fopen($path, 'w'))) {
return false;
}
// PS Comments
fwrite($writeFd, "# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution\n");
fwrite($writeFd, "# WARNING: PLEASE DO NOT MODIFY THIS FILE MANUALLY. IF NECESSARY, ADD YOUR SPECIFIC CONFIGURATION WITH THE HTACCESS GENERATOR IN BACK OFFICE\n");
fwrite($writeFd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n");
if (!empty($specific)) {
fwrite($writeFd, $specific);
}
// RewriteEngine
fwrite($writeFd, "\n<IfModule mod_rewrite.c>\n");
if ($disableMuliviews) {
fwrite($writeFd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
}
fwrite($writeFd, $tab['RewriteEngine']['comment'] . "\nRewriteEngine on\n\n");
fwrite($writeFd, $tab['RewriteRule']['comment'] . "\n");
// Webservice
//.........这里部分代码省略.........
示例3: getContent
public function getContent()
{
/* Store the posted parameters and generate a new Google Sitemap files for the current Shop */
if (Tools::isSubmit('SubmitGsitemap')) {
Configuration::updateValue('GSITEMAP_FREQUENCY', pSQL(Tools::getValue('gsitemap_frequency')));
Configuration::updateValue('GSITEMAP_INDEX_CHECK', '');
Configuration::updateValue('GSITEMAP_CHECK_IMAGE_FILE', pSQL(Tools::getValue('gsitemap_check_image_file')));
$meta = '';
if (Tools::getValue('gsitemap_meta')) {
$meta .= implode(', ', Tools::getValue('gsitemap_meta'));
}
Configuration::updateValue('GSITEMAP_DISABLE_LINKS', $meta);
$this->emptySitemap();
$this->createSitemap();
} elseif (Tools::getValue('continue')) {
$this->createSitemap();
}
/* Backward compatibility */
if (_PS_VERSION_ < 1.5) {
require _PS_MODULE_DIR_ . 'gsitemap/backward_compatibility/backward.php';
}
/* Empty the Shop domain cache */
if (method_exists('ShopUrl', 'resetMainDomainCache')) {
ShopUrl::resetMainDomainCache();
}
$this->context->smarty->assign(array('gsitemap_form' => './index.php?tab=AdminModules&configure=gsitemap&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=' . $this->tab . '&module_name=gsitemap', 'gsitemap_cron' => _PS_BASE_URL_ . _MODULE_DIR_ . 'gsitemap/gsitemap-cron.php?token=' . substr(Tools::encrypt('gsitemap/cron'), 0, 10) . '&id_shop=' . $this->context->shop->id, 'gsitemap_feed_exists' => file_exists(dirname(__FILE__) . '/../../index_sitemap.xml'), 'gsitemap_last_export' => Configuration::get('GSITEMAP_LAST_EXPORT'), 'gsitemap_frequency' => Configuration::get('GSITEMAP_FREQUENCY'), 'gsitemap_store_url' => 'http://' . Tools::getShopDomain(false, true) . __PS_BASE_URI__, 'gsitemap_links' => Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'gsitemap_sitemap` WHERE id_shop = ' . (int) $this->context->shop->id), 'store_metas' => Meta::getMetasByIdLang((int) $this->context->cookie->id_lang), 'gsitemap_disable_metas' => explode(',', Configuration::get('GSITEMAP_DISABLE_LINKS')), 'gsitemap_customer_limit' => array('max_exec_time' => (int) ini_get('max_execution_time'), 'memory_limit' => intval(ini_get('memory_limit'))), 'prestashop_version' => _PS_VERSION_ >= 1.5 ? '1.5' : '1.4', 'prestashop_ssl' => Configuration::get('PS_SSL_ENABLED'), 'gsitemap_check_image_file' => Configuration::get('GSITEMAP_CHECK_IMAGE_FILE'), 'shop' => $this->context->shop));
return $this->display(__FILE__, 'tpl/configuration.tpl');
}
示例4: getPagesOption
private function getPagesOption($id_lang = null, $link = false)
{
if (is_null($id_lang)) {
$id_lang = (int) $this->context->cookie->id_lang;
}
$files = Meta::getMetasByIdLang($id_lang);
$html = '';
foreach ($files as $file) {
if ($link) {
$html .= '<option value="' . $this->context->link->getPageLink($file['page']) . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
} else {
$html .= '<option value="PAG' . $file['page'] . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
}
}
return $html;
}
示例5: generatePageLinkOption
protected function generatePageLinkOption($id_lang = 0, $selected = '', $html = null)
{
//if($html == null) $html = '';
/*
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
ksort($controllers);
foreach ($controllers as $k => $v){
$v = 'PAG|'.$k;
if($k == $selected)
$html .= '<option selected="selected" value="'.$v.'">'.$k.'</option>';
else
$html .= '<option value="'.$v.'">'.$k.'</option>';
}
$all_modules_controllers = Dispatcher::getModuleControllers('front');
foreach ($all_modules_controllers as $module => $modules_controllers)
foreach ($modules_controllers as $cont){
$k = 'module-'.$module.'-'.$cont;
$v = 'PAG|'.$k;
if($k == $selected)
$html .= '<option selected="selected" value="'.$v.'">'.$k.'</option>';
else
$html .= '<option value="'.$v.'">'.$k.'</option>';
}
*/
if (!$id_lang) {
$id_lang = (int) ($langId = (int) $this->context->language->id);
}
$files = Meta::getMetasByIdLang($id_lang);
$html = '';
foreach ($files as $file) {
$key = 'PAG|' . $file['page'];
if ($key == $selected) {
$html .= '<option selected="selected" value="' . $key . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
} else {
$html .= '<option value="' . $key . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
}
}
return $html;
}
示例6: getPagesOption
public function getPagesOption($selected = null)
{
$files = Meta::getMetasByIdLang((int) $this->context->cookie->id_lang);
$html = '';
foreach ($files as $file) {
$html .= '<option ' . ($selected == $file['page'] ? 'selected="selected"' : '') . ' value="' . $file['page'] . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
}
return $html;
}
示例7: getControllerNameOnLive
private function getControllerNameOnLive($q)
{
$pages = Meta::getPages();
$pages_names = Meta::getMetasByIdLang($this->_cookie->id_lang);
$controllers_list = array();
foreach ($pages_names as $page_name) {
if (isset($page_name['page']) && (isset($pages[$page_name['page']]) || in_array($page_name['page'], $pages) || (isset($pages[str_replace('-', '', $page_name['page'])]) || in_array(str_replace('-', '', $page_name['page']), $pages)))) {
if (stripos($page_name['page'], $q) !== false || stripos($page_name['title'], $q) !== false) {
$controllers_list[] = $page_name;
}
}
}
return $controllers_list;
}
示例8: getPagesOption
private function getPagesOption($id_lang = null, $selected = '')
{
if (is_null($id_lang)) {
$id_lang = (int) $this->context->cookie->id_lang;
}
$files = Meta::getMetasByIdLang($id_lang);
$html = '';
foreach ($files as $file) {
$key = 'PAG-' . $file['page'];
if ($key == $selected) {
$html .= '<option selected="selected" value="' . $key . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
} else {
$html .= '<option value="' . $key . '">' . ($file['title'] != '' ? $file['title'] : $file['page']) . '</option>';
}
}
return $html;
}