本文整理汇总了PHP中Meta::getMetaByPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::getMetaByPage方法的具体用法?PHP Meta::getMetaByPage怎么用?PHP Meta::getMetaByPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meta
的用法示例。
在下文中一共展示了Meta::getMetaByPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeStaticLinks
private function makeStaticLinks($staticIds)
{
$staticLinks = array();
foreach ($staticIds as $staticId) {
if (false !== $staticId) {
$meta = Meta::getMetaByPage($staticId, (int) $this->language->id);
$staticLinks[] = array('id' => 'link-static-page-' . $staticId, 'class' => 'cms-page-link', 'title' => $meta['title'], 'description' => $meta['description'], 'url' => $this->link->getPageLink($staticId, true));
}
}
return $staticLinks;
}
示例2: registerUrls
/**
* Registers rewrite urls for frontend controller
* @return bool
*/
public function registerUrls()
{
try {
foreach (Language::getLanguages() as $language) {
$data = Meta::getMetaByPage('module-newsletter2go-Export', $language['id_lang']);
$meta = new Meta($data['id_meta']);
if ($meta && $meta->id) {
$meta->url_rewrite = 'n2go-export';
$meta->save();
}
}
} catch (Exception $e) {
return false;
}
return true;
}
示例3: getHomeMetas
public static function getHomeMetas($id_lang, $page_name)
{
if (!Module::isInstalled('agilemultipleshop') || !Module::isInstalled('agilemultipleseller')) {
return parent::getHomeMetas($id_lang, $page_name);
}
if (Shop::$id_shop_owner <= 1) {
return parent::getHomeMetas($id_lang, $page_name);
}
include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
$id_sellerinfo = SellerInfo::getIdBSellerId(Shop::$id_shop_owner);
$sellerinfo = new SellerInfo($id_sellerinfo, $id_lang);
$metas = Meta::getMetaByPage($page_name, $id_lang);
$ret['meta_title'] = !empty($sellerinfo->meta_title) ? $sellerinfo->meta_title : $sellerinfo->company;
$ret['meta_description'] = !empty($sellerinfo->meta_description) ? $sellerinfo->meta_description : '';
$ret['meta_keywords'] = !empty($sellerinfo->meta_keywords) ? $sellerinfo->meta_description : '';
return $ret;
}
示例4: getHomeMetas
/**
* Get meta tags for a given page
*
* @since 1.5.0
* @param int $id_lang
* @param string $page_name
* @return array Meta tags
*/
public static function getHomeMetas($id_lang, $page_name)
{
$metas = Meta::getMetaByPage($page_name, $id_lang);
$ret['meta_title'] = isset($metas['title']) && $metas['title'] ? $metas['title'] . ' - ' . Configuration::get('PS_SHOP_NAME') . ' %city_name' : Configuration::get('PS_SHOP_NAME') . ' %city_name';
$ret['meta_description'] = isset($metas['description']) && $metas['description'] ? $metas['description'] : '';
$ret['meta_keywords'] = isset($metas['keywords']) && $metas['keywords'] ? $metas['keywords'] : '';
if ($page_name == 'index') {
Meta::getEgCeoWords('HOME', null, $ret);
}
return Meta::replaceCity($ret);
}
示例5: generateUrl
protected function generateUrl($value, $default = "#", $prefix = '')
{
$response = $default;
if ($prefix) {
$value .= $prefix;
}
if ($value) {
$langId = $this->context->language->id;
$shopId = $this->context->shop->id;
$arr = explode('|', $value);
switch ($arr[0]) {
case 'PRD':
$product = new Product((int) $arr[1], true, (int) $langId);
$response = Tools::HtmlEntitiesUTF8($product->getLink());
break;
case 'CAT':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS_CAT':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCMSCategoryLink((int) $arr[1], null, $langId));
break;
case 'CMS':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getCMSLink((int) $arr[1], null, $langId));
break;
case 'ALLMAN':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink('manufacturer'), true, $langId);
break;
case 'MAN':
$man = new Manufacturer((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getManufacturerLink($man->id, $man->link_rewrite, $langId));
break;
case 'ALLSUP':
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink('supplier'), true, $langId);
break;
case 'SUP':
$sup = new Supplier((int) $arr[1], $langId);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getSupplierLink($sup->id, $sup->link_rewrite, $langId));
break;
case 'SHO':
$shop = new Shop((int) $key);
$response = $shop->getBaseURL();
break;
case 'PAG':
$pag = Meta::getMetaByPage($arr[1], $langId);
if (strpos($pag['page'], 'module-') === false) {
$response = Tools::HtmlEntitiesUTF8($this->context->link->getPageLink($pag['page'], true, $langId));
} else {
$page = explode('-', $pag['page']);
Context::getContext()->link->getModuleLink($page[1], $page[2]);
$response = Tools::HtmlEntitiesUTF8($this->context->link->getModuleLink($page[1], $page[2]));
}
break;
default:
break;
}
}
return $response;
}
示例6: dirname
* International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
if (!Module::getInstanceByName('feeder')->active) {
exit;
}
// Get data
$number = (int) Tools::getValue('n') ? (int) Tools::getValue('n') : 10;
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
$id_category = (int) Tools::getValue('id_category') ? (int) Tools::getValue('id_category') : Configuration::get('PS_HOME_CATEGORY');
$products = Product::getProducts((int) $context->language->id, 0, $number > 10 ? 10 : $number, $orderBy, $orderWay, $id_category, true);
$currency = new Currency((int) $context->currency->id);
$affiliate = Tools::getValue('ac') ? '?ac=' . (int) Tools::getValue('ac') : '';
$metas = Meta::getMetaByPage('index', (int) $context->language->id);
$shop_uri = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__;
// Send feed
header("Content-Type:text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0">
<channel>
<title><![CDATA[<?php
echo Configuration::get('PS_SHOP_NAME');
?>
]]></title>
<description><![CDATA[<?php
echo $metas['description'];
?>
]]></description>
示例7: uninstall
/**
* Delete module from datable
*
* @return boolean result
*/
public function uninstall()
{
// Check module installation id validation
if (!Validate::isUnsignedId($this->id)) {
$this->_errors[] = $this->l('The module is not installed.');
return false;
}
// Uninstall overrides
if (!$this->uninstallOverrides()) {
return false;
}
// Retrieve hooks used by the module
$sql = 'SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_module` = ' . (int) $this->id;
$result = Db::getInstance()->executeS($sql);
foreach ($result as $row) {
$this->unregisterHook((int) $row['id_hook']);
$this->unregisterExceptions((int) $row['id_hook']);
}
foreach ($this->controllers as $controller) {
$meta = Meta::getMetaByPage('module-' . $this->name . '-' . $controller, $this->context->language->id);
if ((int) $meta['id_meta'] > 0) {
Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'theme_meta` WHERE id_meta=' . (int) $meta['id_meta']);
Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'meta` WHERE id_meta=' . (int) $meta['id_meta']);
}
}
// Disable the module for all shops
$this->disable(true);
// Delete permissions module access
Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'module_access` WHERE `id_module` = ' . (int) $this->id);
// Remove restrictions for client groups
Group::truncateRestrictionsByModule($this->id);
// Uninstall the module
if (Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'module` WHERE `id_module` = ' . (int) $this->id)) {
Cache::clean('Module::isInstalled' . $this->name);
return true;
}
return false;
}
示例8: hookHeader
public function hookHeader($params)
{
// Better way to check which file / controller name is loaded
if (!($file = basename(Tools::getValue('controller')))) {
$file = str_replace(array('.php', '-'), '', basename($_SERVER['SCRIPT_NAME']));
}
// Otherwise, create Google Analytics stats
$ganalytics_id = Configuration::get('GANALYTICS_ID');
$multilang = method_exists('Language', 'isMultiLanguageActivated') ? Language::isMultiLanguageActivated() : Language::countActiveLanguages() > 1;
$defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
$order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
$pageTrack = preg_match('#(^' . __PS_BASE_URI__ . 'order.php)|(^' . __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'] . '[^-])#', $_SERVER['REQUEST_URI']) ? '/order/step' . (int) Tools::getValue('step') . '.html' : $file;
$this->context->smarty->assign('ganalytics_id', $ganalytics_id);
$this->context->smarty->assign('pageTrack', $pageTrack);
$this->context->smarty->assign('isOrder', false);
return $this->display(__FILE__, 'header.tpl');
}
示例9: getStaticPages
public function getStaticPages($id_lang = null)
{
$statics = array();
$staticPages = array('contact', 'sitemap', 'stores', 'authentication', 'my-account');
foreach ($staticPages as $staticPage) {
$meta = Meta::getMetaByPage($staticPage, $id_lang ? (int) $id_lang : (int) Context::getContext()->language->id);
$statics[] = ['id_cms' => $staticPage, 'title' => $meta['title']];
}
$pages[]['pages'] = $statics;
return $pages;
}
示例10: getHomeMetaTags
/**
* Get meta tags for a given page
*
* @param integer $id_lang Language id
* @return array Meta tags
*/
public static function getHomeMetaTags($id_lang, $page_name)
{
/* Metas-tags */
$metas = Meta::getMetaByPage($page_name, $id_lang);
$ret['meta_title'] = (isset($metas['title']) and $metas['title']) ? $metas['title'] . ' - ' . Configuration::get('PS_SHOP_NAME') : Configuration::get('PS_SHOP_NAME');
$ret['meta_description'] = (isset($metas['description']) and $metas['description']) ? $metas['description'] : '';
$ret['meta_keywords'] = (isset($metas['keywords']) and $metas['keywords']) ? $metas['keywords'] : '';
return $ret;
}
示例11: hookHeader
function hookHeader($params)
{
if (method_exists('Language', 'isMultiLanguageActivated') && Language::isMultiLanguageActivated() || Language::countActiveLanguages() > 1) {
$multilang = (string) Tools::getValue('isolang') . '/';
} else {
$multilang = '';
}
$defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . $multilang . $defaultMetaOrder['url_rewrite']) === 0) {
$this->context->smarty->assign('pageTrack', '/order/step' . (int) Tools::getValue('step') . '.html');
}
$this->context->smarty->assign('ganalytics_id', Configuration::get('GANALYTICS_ID'));
$this->context->smarty->assign('isOrder', false);
return $this->display(__FILE__, 'header.tpl');
}
示例12: getHomeMetas
/**
* Get meta tags for a given page
*
* @param int $idLang Language ID
* @param string $pageName Page name
*
* @return array Meta tags
*
* @since 1.5.0
*/
public static function getHomeMetas($idLang, $pageName)
{
$metas = Meta::getMetaByPage($pageName, $idLang);
$ret['meta_title'] = isset($metas['title']) && $metas['title'] ? $metas['title'] : Configuration::get('PS_SHOP_NAME');
$ret['meta_description'] = isset($metas['description']) && $metas['description'] ? $metas['description'] : '';
$ret['meta_keywords'] = isset($metas['keywords']) && $metas['keywords'] ? $metas['keywords'] : '';
return $ret;
}
示例13: hookHeader
function hookHeader($params)
{
// Better way to check which file / controller name is loaded
if (!($file = basename(Tools::getValue('controller')))) {
$file = str_replace(array('.php', '-'), '', basename($_SERVER['SCRIPT_NAME']));
}
#PNM-30 - Order confirmation wasn't tracked
// If other controller / file name need to be done, add it to the array
// if (in_array(v, array('orderconfirmation')))
// return '';
// Otherwise, create Google Analytics stats
$ganalytics_id = Configuration::get('GANALYTICS_ID');
$multilang = method_exists('Language', 'isMultiLanguageActivated') ? Language::isMultiLanguageActivated() : Language::countActiveLanguages() > 1;
$defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
$order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
$pageTrack = strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite']) === 0 ? '/order/step' . (int) Tools::getValue('step') . '.html' : $file;
$this->context->smarty->assign('ganalytics_id', $ganalytics_id);
$this->context->smarty->assign('pageTrack', $pageTrack);
$this->context->smarty->assign('isOrder', false);
return $this->display(__FILE__, 'header.tpl');
}
示例14: getHomeMetas
/**
* Get meta tags for a given page
*
* @since 1.5.0
* @param int $id_lang
* @param string $page_name
* @return array Meta tags
*/
public static function getHomeMetas($id_lang, $page_name)
{
$metas = Meta::getMetaByPage($page_name, $id_lang);
// var_dump($metas);exit();
$ret['meta_title'] = isset($metas['title']) && $metas['title'] ? $metas['title'] : Configuration::get('PS_SHOP_NAME');
$ret['meta_description'] = isset($metas['description']) && $metas['description'] ? $metas['description'] : '';
$ret['meta_keywords'] = isset($metas['keywords']) && $metas['keywords'] ? $metas['keywords'] : '';
$ret['meta_content'] = isset($metas['content']) && $metas['content'] ? $metas['content'] : '';
$ret['meta_urlrewrite'] = isset($metas['url_rewrite']) && $metas['url_rewrite'] ? $metas['url_rewrite'] : '';
return $ret;
}
示例15: hookHeader
function hookHeader($params)
{
global $smarty, $cookie;
// hookOrderConfirmation() already send the sats bypass this step
if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order-confirmation.php') === 0) {
return '';
}
// Otherwise, create Google Analytics stats
$ganalytics_id = Configuration::get('GANALYTICS_ID');
$multilang = Language::countActiveLanguages() > 1;
$defaultMetaOrder = Meta::getMetaByPage('order', (int) $cookie->id_lang);
$order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
$pageTrack = strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite']) === 0 ? '/order/step' . (int) Tools::getValue('step') . '.html' : '';
$smarty->assign('ganalytics_id', $ganalytics_id);
$smarty->assign('pageTrack', $pageTrack);
$smarty->assign('isOrder', false);
return $this->display(__FILE__, 'header.tpl');
}