本文整理匯總了PHP中Shop::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shop::init方法的具體用法?PHP Shop::init怎麽用?PHP Shop::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Shop
的用法示例。
在下文中一共展示了Shop::init方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postContentLoad
/**
* Do something after content is loaded from DB
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
// Show the Shop navbar in the Shop, or on every page if configured to do so
if (!Shop::isInitialized()) {
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
if (\Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')) {
Shop::init();
Shop::setNavbar();
}
}
break;
}
}
示例2: isTableAssociated
/**
* Check if given table is associated to shop
*
* @param string $table
* @return bool
*/
public static function isTableAssociated($table)
{
if (!Shop::$initialized) {
Shop::init();
}
return isset(Shop::$asso_tables[$table]) && Shop::$asso_tables[$table]['type'] == 'shop';
}
示例3: postContentLoad
/**
* Do something after content is loaded from DB
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
// Show the Shop navbar in the Shop, or on every page if configured to do so
if (!Shop::isInitialized()) {
\Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
if (\Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')) {
Shop::init();
Shop::setNavbar();
}
// replace global product blocks
$page->setContent(preg_replace_callback('/<!--\\s+BEGIN\\s+(block_shop_products_category_(?:\\d+)\\s+-->).*<!--\\s+END\\s+\\1/s', function ($matches) {
$blockTemplate = new \Cx\Core\Html\Sigma();
$blockTemplate->setTemplate($matches[0]);
Shop::parse_products_blocks($blockTemplate);
return $blockTemplate->get();
}, $page->getContent()));
}
break;
}
}