本文整理汇总了PHP中Module::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::isEnabled方法的具体用法?PHP Module::isEnabled怎么用?PHP Module::isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::isEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPost
public static function getPost($id_post, $id_lang = null)
{
$result = array();
if ($id_lang == null) {
$id_lang = (int) Context::getContext()->language->id;
}
preg_match('/^[\\d]+/', $id_post, $id_post);
$id_post = $id_post[0];
$sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post p INNER JOIN
' . _DB_PREFIX_ . 'smart_blog_post_lang pl ON p.id_smart_blog_post=pl.id_smart_blog_post INNER JOIN
' . _DB_PREFIX_ . 'smart_blog_post_shop ps ON pl.id_smart_blog_post = ps.id_smart_blog_post
WHERE pl.id_lang=' . $id_lang . '
AND p.active= 1 AND p.id_smart_blog_post = ' . $id_post;
if (!($post = Db::getInstance()->executeS($sql))) {
return false;
}
$result['id_post'] = $post[0]['id_smart_blog_post'];
$result['meta_title'] = $post[0]['meta_title'];
$result['meta_description'] = $post[0]['meta_description'];
$result['short_description'] = $post[0]['short_description'];
$result['meta_keyword'] = $post[0]['meta_keyword'];
if (Module::isEnabled('smartshortcode') == 1 && Module::isInstalled('smartshortcode') == 1) {
require_once _PS_MODULE_DIR_ . 'smartshortcode/smartshortcode.php';
$smartshortcode = new SmartShortCode();
$result['content'] = $smartshortcode->parse($post[0]['content']);
} else {
$result['content'] = $post[0]['content'];
}
$result['active'] = $post[0]['active'];
$result['created'] = $post[0]['created'];
$result['comment_status'] = $post[0]['comment_status'];
$result['viewed'] = $post[0]['viewed'];
$result['is_featured'] = $post[0]['is_featured'];
$result['post_type'] = $post[0]['post_type'];
$result['id_category'] = $post[0]['id_category'];
$employee = new Employee($post[0]['id_author']);
$result['id_author'] = $post[0]['id_author'];
$result['lastname'] = $employee->lastname;
$result['firstname'] = $employee->firstname;
$result['youtube'] = $post[0]['youtube'];
if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $post[0]['id_smart_blog_post'] . '.jpg')) {
$image = $post[0]['id_smart_blog_post'] . '.jpg';
$result['post_img'] = $image;
} else {
$result['post_img'] = NULL;
}
return $result;
}
示例2: postProcess
public function postProcess()
{
if (!Module::isInstalled('aplazame') || !Module::isEnabled('aplazame')) {
$this->error('Aplazame is not enabled');
}
$cartId = $mid = Tools::getValue('checkout_token');
$secureKey = Tools::getValue('key', false);
if (!$mid || !$secureKey) {
$this->error('Missing required fields');
}
$cart = new Cart((int) $mid);
if (!Validate::isLoadedObject($cart)) {
$this->error('Cart does not exists or does not have an order');
}
$response = $this->module->callToRest('POST', '/orders/' . $mid . '/authorize');
if ($response['is_error']) {
$message = 'Aplazame Error #' . $response['code'];
if (isset($response['payload']['error']['message'])) {
$message .= ' ' . $response['payload']['error']['message'];
}
$this->module->validateOrder($cartId, Configuration::get('PS_OS_ERROR'), $cart->getOrderTotal(true), $this->module->displayName, $message, null, null, false, $secureKey);
$this->error('Authorization error');
}
$cartAmount = AplazameSerializers::formatDecimals($cart->getOrderTotal(true));
if ($response['payload']['amount'] !== $cartAmount) {
$this->error('Invalid');
}
$aplazameAmount = AplazameSerializers::decodeDecimals($response['payload']['amount']);
if (!$this->module->validateOrder($cartId, Configuration::get('PS_OS_PAYMENT'), $aplazameAmount, $this->module->displayName, null, null, null, false, $secureKey)) {
$this->error('Cannot validate order');
}
exit('success');
}
示例3: getBlockContent
public static function getBlockContent($params, &$smarty)
{
//use in template as {getBelvgBlockContent id="block_identifier"}
if (!Module::isEnabled('belvg_staticblocks')) {
return FALSE;
}
if (isset($params['id'])) {
$block_identifier = $params['id'];
$sql = '
SELECT `id_belvg_staticblocks`
FROM `' . _DB_PREFIX_ . 'belvg_staticblocks`
WHERE `block_identifier` = "' . pSQL($block_identifier) . '" AND `status` = "1"';
if (Shop::isFeatureActive()) {
$sql .= ' AND `id_belvg_staticblocks` IN (
SELECT sa.`id_belvg_staticblocks`
FROM `' . _DB_PREFIX_ . 'belvg_staticblocks_shop` sa
WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
)';
}
$block_id = (int) Db::getInstance()->getValue($sql);
if ($block_id) {
$id_lang = Context::getContext()->cookie->id_lang;
$block = new self($block_id);
if (isset($block->content[$id_lang])) {
return $block->content[$id_lang];
}
}
}
}
示例4: getImageLink
public function getImageLink($name, $ids, $type = null)
{
$context = Context::getContext();
// check if WebP support is enabled.
if ($context->cookie->exists() && $context->cookie->WebPSupport) {
$extension = '.webp';
} else {
$extension = '.jpg';
}
$not_default = false;
// Check if module is installed, enabled, customer is logged in and watermark logged option is on
if (Configuration::get('WATERMARK_LOGGED') && (Module::isInstalled('watermark') && Module::isEnabled('watermark')) && isset(Context::getContext()->customer->id)) {
$type .= '-' . Configuration::get('WATERMARK_HASH');
}
// legacy mode or default image
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension) || ($not_default = strpos($ids, 'default') !== false)) {
if ($this->allow == 1 && !$not_default) {
$uri_path = __PS_BASE_URI__ . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
} else {
$uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension;
}
} else {
// if ids if of the form id_product-id_image, we want to extract the id_image part
$split_ids = explode('-', $ids);
$id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0];
$theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
if ($this->allow == 1) {
$uri_path = __PS_BASE_URI__ . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
} else {
$uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . $theme . $extension;
}
}
return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
}
示例5: init
public function init()
{
parent::init();
if (Module::isEnabled('aimultidimensions')) {
if (Tools::getIsset('add') && $this->context->cart->id) {
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php';
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'config.php';
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions' . $GLOBALS['aimd_config_suffix'] . '.php';
$add = 1;
$idProduct = (int) Tools::getValue('id_product', NULL);
if (checkLink($idProduct)) {
$idProductAttribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
$customizationId = (int) Tools::getValue('id_customization', 0);
$qty = (int) abs(Tools::getValue('qty', 1));
if ($add && $qty >= 0 && getProducts($idProduct)) {
$quantity = (int) Db::getInstance()->getValue('SELECT quantity FROM ' . _DB_PREFIX_ . 'cart_product WHERE id_cart = ' . $this->context->cart->id . ' AND id_product = ' . $idProduct . ' AND ' . 'id_product_attribute = ' . $idProductAttribute);
if (Tools::getValue('op', 'up') == 'up') {
$quantity += (int) $qty;
} else {
$quantity -= (int) $qty;
}
$cookie = $this->context->cookie;
$cart = $this->context->cart;
include_once 'modules/aimultidimensions/includes/cart.php';
Product::flushPriceCache();
}
}
}
}
}
示例6: getSpecificPrice
public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0, $id_cart = 0, $real_quantity = 0)
{
$specific_price = parent::getSpecificPrice($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute, $id_customer, $id_cart, $real_quantity);
if (Module::isEnabled('loyaltydiscount')) {
include_once _PS_MODULE_DIR_ . DIRECTORY_SEPARATOR . 'loyaltydiscount' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'LoyaltyDiscount.php';
LoyaltyDiscountModel::applyPossibleDiscount($id_product, $id_shop, $specific_price);
}
return $specific_price;
}
示例7: init
public function init()
{
if (Module::isInstalled('magicredirect') && Module::isEnabled('magicredirect')) {
require_once _PS_MODULE_DIR_ . 'magicredirect/magicredirect.php';
$mod = new MagicRedirect();
$mod->catchUrls();
}
return parent::init();
}
示例8: initContent
public function initContent()
{
parent::initContent();
$_legal = Module::getInstanceByName('eu_legal');
if (Validate::isLoadedObject($_legal) && Module::isInstalled($_legal->name) && Module::isEnabled($_legal->name)) {
if ($tpl = $_legal->getThemeOverride('order-detail')) {
$this->setTemplate($tpl);
}
}
}
示例9: __construct
public function __construct()
{
/*
* EU-Legal
* instantiate EU Legal Module
*/
parent::__construct();
$instance = Module::getInstanceByName('eu_legal');
if (Validate::isLoadedObject($instance) && Module::isInstalled($instance->name) && Module::isEnabled($instance->name)) {
$this->_legal = $instance;
}
}
示例10: isExpeditorCarrier
public static function isExpeditorCarrier($id_carrier)
{
if (!Module::isEnabled('expeditor')) {
return false;
}
foreach (explode(',', ConfigurationCore::get('EXPEDITOR_CARRIER')) as $carrier) {
if ($carrier == $id_carrier) {
return true;
}
}
return false;
}
示例11: postProcess
public function postProcess()
{
if (Module::isInstalled('aplazame') && Module::isEnabled('aplazame')) {
if (Tools::isSubmit('id_order') && Tools::getValue('id_order') > 0) {
$order = new Order(Tools::getValue('id_order'));
if (Validate::isLoadedObject($order)) {
if (Tools::isSubmit('partialRefund') && isset($order)) {
if ($this->tabAccess['edit'] == '1') {
if (is_array($_POST['partialRefundProduct'])) {
$amount = 0;
$order_detail_list = array();
foreach ($_POST['partialRefundProduct'] as $id_order_detail => $amount_detail) {
$order_detail_list[$id_order_detail] = array('quantity' => (int) $_POST['partialRefundProductQuantity'][$id_order_detail], 'id_order_detail' => (int) $id_order_detail);
$order_detail = new OrderDetail((int) $id_order_detail);
if (empty($amount_detail)) {
$order_detail_list[$id_order_detail]['unit_price'] = $order_detail->unit_price_tax_excl;
$order_detail_list[$id_order_detail]['amount'] = $order_detail->unit_price_tax_incl * $order_detail_list[$id_order_detail]['quantity'];
} else {
$order_detail_list[$id_order_detail]['unit_price'] = (double) str_replace(',', '.', $amount_detail / $order_detail_list[$id_order_detail]['quantity']);
$order_detail_list[$id_order_detail]['amount'] = (double) str_replace(',', '.', $amount_detail);
}
$amount += $order_detail_list[$id_order_detail]['amount'];
}
$choosen = false;
$voucher = 0;
if ((int) Tools::getValue('refund_voucher_off') == 1) {
$amount -= $voucher = (double) Tools::getValue('order_discount_price');
} elseif ((int) Tools::getValue('refund_voucher_off') == 2) {
$choosen = true;
$amount = $voucher = (double) Tools::getValue('refund_voucher_choose');
}
$shipping_cost_amount = (double) str_replace(',', '.', Tools::getValue('partialRefundShippingCost')) ? (double) str_replace(',', '.', Tools::getValue('partialRefundShippingCost')) : false;
if ($shipping_cost_amount > 0) {
$amount += $shipping_cost_amount;
}
if ($amount > 0) {
if (!Tools::isSubmit('generateDiscountRefund') && $order->module == 'aplazame') {
$aplazame = ModuleCore::getInstanceByName('aplazame');
$aplazame->refundAmount($order, $amount);
}
}
}
}
}
}
}
}
parent::postProcess();
}
示例12: __construct
public function __construct($request, $origin)
{
$this->loadClasses();
parent::__construct($request);
// Abstracted out for example
$APIKey = new PowaTagAPIKey();
if (!Module::isInstalled('powatag') || !Module::isEnabled('powatag')) {
throw new Exception('Module not enable');
}
/*
if (!array_key_exists('HTTP_HMAC', $_SERVER))
throw new Exception('No API Key provided');
else if (!$APIKey->verifyKey($_SERVER['HTTP_HMAC'], $this->data))
throw new Exception('Invalid API Key');
*/
$this->data = Tools::jsonDecode($this->data);
}
示例13: preparePosts
public function preparePosts($nb = 4, $cat = null)
{
$featured = false;
if ($cat == 9999) {
$cat = 0;
$featured = true;
}
if (!Module::isInstalled('ph_simpleblog') || !Module::isEnabled('ph_simpleblog')) {
return false;
}
if (!isset($nb) || !isset($cat)) {
return false;
}
require_once _PS_MODULE_DIR_ . 'ph_simpleblog/models/SimpleBlogPost.php';
$id_lang = $this->context->language->id;
$posts = SimpleBlogPost::getPosts($id_lang, $nb, $cat, null, true, 'sbp.date_add', 'DESC', null, $featured);
return $posts;
}
示例14: initContent
public function initContent()
{
$this->context->controller->addJqueryPlugin('cooki-plugin');
$this->context->controller->addJqueryPlugin('cookie-plugin');
$this->context->controller->addjqueryPlugin('fancybox');
$this->context->controller->addCSS(array(_THEME_CSS_DIR_ . 'category.css' => 'all', _THEME_CSS_DIR_ . 'product_list.css' => 'all'));
parent::initContent();
$this->SimpleBlogPost->increaseViewsNb();
/**
Support for SmartShortcode module from CodeCanyon
**/
if (file_exists(_PS_MODULE_DIR_ . 'smartshortcode/smartshortcode.php')) {
require_once _PS_MODULE_DIR_ . 'smartshortcode/smartshortcode.php';
}
if (Module::isEnabled('smartshortcode')) {
$smartshortcode = new SmartShortCode();
$this->SimpleBlogPost->content = $smartshortcode->parse($this->SimpleBlogPost->content);
}
$this->context->smarty->assign('post', $this->SimpleBlogPost);
$this->context->smarty->assign('is_16', version_compare(_PS_VERSION_, '1.6.0', '>=') === true ? true : false);
$this->context->smarty->assign('gallery_dir', _MODULE_DIR_ . 'ph_simpleblog/galleries/');
// Comments
if ($this->SimpleBlogPost->allow_comments == 1) {
$allow_comments = true;
} elseif ($this->SimpleBlogPost->allow_comments == 2) {
$allow_comments = false;
} elseif ($this->SimpleBlogPost->allow_comments == 3) {
$allow_comments = Configuration::get('PH_BLOG_COMMENT_ALLOW');
} else {
$allow_comments = false;
}
$this->context->smarty->assign('allow_comments', $allow_comments);
if ($allow_comments) {
$comments = SimpleBlogComment::getComments($this->SimpleBlogPost->id_simpleblog_post);
$this->context->smarty->assign('comments', $comments);
}
if (Configuration::get('PH_BLOG_DISPLAY_RELATED')) {
$related_products = SimpleBlogPost::getRelatedProducts($this->SimpleBlogPost->id_product);
$this->context->smarty->assign('related_products', $related_products);
}
$this->setTemplate('single.tpl');
}
示例15: disable
/**
* Disables a module.
*
* @param $slug
*
* @return \Illuminate\Http\Response
*/
public function disable($slug)
{
Audit::log(Auth::user()->id, trans('admin/modules/general.audit-log.category'), trans('admin/modules/general.audit-log.msg-disable', ['slug' => $slug]));
$module = \Module::where('slug', $slug)->first();
if ($module) {
if (\Module::isInitialized($slug)) {
if (\Module::isEnabled($slug)) {
\Module::disable($slug);
Flash::success(trans('admin/modules/general.status.disabled', ['name' => $module['name']]));
} else {
Flash::warning(trans('admin/modules/general.status.not-enabled', ['name' => $module['name']]));
}
} else {
Flash::warning(trans('admin/modules/general.status.not-initialized', ['name' => $module['name']]));
}
} else {
Flash::error(trans('admin/modules/general.status.not-found', ['slug' => $slug]));
}
Flash::success(trans('admin/modules/general.status.disabled'));
return redirect('/admin/modules');
}