本文整理汇总了PHP中XLite::isFreeLicense方法的典型用法代码示例。如果您正苦于以下问题:PHP XLite::isFreeLicense方法的具体用法?PHP XLite::isFreeLicense怎么用?PHP XLite::isFreeLicense使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite
的用法示例。
在下文中一共展示了XLite::isFreeLicense方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPagesStatic
/**
* Get pages static
*
* @return array
*/
public static function getPagesStatic()
{
$list = array();
if (\XLite::isFreeLicense() && \XLite\Core\Auth::getInstance()->isPermissionAllowed(\XLite\Model\Role\Permission::ROOT_ACCESS)) {
$list['volume_discounts'] = array('name' => static::t('Volume discounts'), 'tpl' => 'promotions/volume_discounts.tpl');
$list['coupons'] = array('name' => static::t('Coupons'), 'tpl' => 'promotions/coupons.tpl');
}
return $list;
}
示例2: checkLicense
/**
* Check if current page is accessible for current x-cart license
*
* @return boolean
*/
protected function checkLicense()
{
return !\XLite::isFreeLicense();
}
示例3: defineQuickLinks
/**
* Define quick links
*
* @return array
*/
protected function defineQuickLinks()
{
$result = array('info' => array(static::ITEM_ICON_SVG => 'images/bell.svg', static::ITEM_WIDGET => 'XLite\\View\\Menu\\Admin\\LeftMenu\\Info', static::ITEM_WEIGHT => 100), 'marketplace' => array(static::ITEM_ICON_SVG => 'images/marketplace.svg', static::ITEM_WIDGET => 'XLite\\View\\Menu\\Admin\\LeftMenu\\Marketplace', static::ITEM_WEIGHT => 200, static::ITEM_LABEL_LINK => $this->buildURL('addons_list_marketplace', null, array('landing' => 1))), 'add_new' => array(static::ITEM_TOOLTIP => static::t('Add new'), static::ITEM_WEIGHT => 300, static::ITEM_ICON_SVG => 'images/add.svg', static::ITEM_CHILDREN => array('add_product' => array(static::ITEM_TITLE => static::t('Product'), static::ITEM_ICON_SVG => 'images/add_product.svg', static::ITEM_TARGET => 'add_product', static::ITEM_PERMISSION => 'manage catalog', static::ITEM_WEIGHT => 100), 'add_category' => array(static::ITEM_TITLE => static::t('Category'), static::ITEM_ICON_SVG => 'images/add_category.svg', static::ITEM_TARGET => 'categories', static::ITEM_PERMISSION => 'manage catalog', static::ITEM_EXTRA => array('add_new' => 1), static::ITEM_WEIGHT => 200), 'add_user' => array(static::ITEM_TITLE => static::t('User'), static::ITEM_ICON_SVG => 'images/add_user.svg', static::ITEM_TARGET => 'profile', static::ITEM_EXTRA => array('mode' => 'register'), static::ITEM_PERMISSION => 'manage users', static::ITEM_WEIGHT => 300))));
if (\XLite::isFreeLicense()) {
$result['add_new'][static::ITEM_CHILDREN]['add_coupon'] = array(static::ITEM_TITLE => static::t('Coupon'), static::ITEM_ICON_SVG => 'images/add_product.svg', static::ITEM_TARGET => 'main', static::ITEM_EXTRA => array('page' => 'license_restriction'), static::ITEM_WEIGHT => 400);
}
return $result;
}
示例4: isOrderEditable
/**
* Return true if order can be edited
*
* @return boolean
*/
public function isOrderEditable()
{
return !\XLite::isFreeLicense();
}
示例5: doActionRegisterKey
/**
* Action of license key registration
*
* @return void
*/
protected function doActionRegisterKey()
{
$key = \XLite\Core\Request::getInstance()->key;
if ($key) {
$keysInfo = \XLite\Core\Marketplace::getInstance()->checkAddonKey($key);
} else {
$keysInfo = null;
$emptyKey = true;
}
$this->setReturnURL($this->buildURL('addons_list_marketplace'));
if ($keysInfo && $keysInfo[$key]) {
$keysInfo = $keysInfo[$key];
$repo = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
foreach ($keysInfo as $info) {
if (\XLite\Model\ModuleKey::KEY_TYPE_XCN == $info['keyType']) {
$xcnPlan = $info['xcnPlan'];
$keyData = $info['keyData'];
// Unset some fields which is not in database
unset($info['xcnPlan']);
unset($info['keyData']);
unset($info['key']);
$entity = $repo->findOneBy($info);
if (!$entity) {
$entity = new \XLite\Model\ModuleKey();
$entity->map($info);
}
$entity->setKeyValue($key);
$entity->setXcnPlan($xcnPlan);
$entity->setKeyData($keyData);
if (!empty($keyData['wave'])) {
$this->updateUpgradeWaveOption($keyData['wave']);
}
$isValid = true;
if (\XLite::isFreeLicense($entity)) {
if (0 == \XLite\Core\Database::getRepo('XLite\\Model\\Module')->hasMarketplaceModules(true)) {
$isValid = false;
$this->showError(__FUNCTION__, static::t('Cannot gather modules from the marketplace. Please try later.'));
}
}
if ($isValid) {
// Save entity (key) in the database
\XLite\Core\Database::getEM()->persist($entity);
\XLite\Core\Database::getEM()->flush();
if (\XLite::isFreeLicense()) {
// Search for modules from non-free edition
$nonFreeModules = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getNonFreeEditionModulesList(false);
if ($nonFreeModules) {
// Try to uninstall these modules...
foreach ($nonFreeModules as $module) {
$messages = array();
$res = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->uninstallModule($module, $messages);
if ($messages) {
foreach ($messages as $message) {
$method = $res ? 'Info' : 'Error';
\XLite\Upgrade\Logger::getInstance()->{'log' . $method}($message, array(), false);
}
}
}
}
\XLite::setCleanUpCacheFlag(true);
}
if (empty($keyData['message'])) {
$this->showInfo(__FUNCTION__, static::t('X-Cart license key has been successfully verified'));
} else {
$this->showWarning(__FUNCTION__, static::t('X-Cart license key has been successfully verified and activated. But this key has expired and do not allow upgrade store.'));
}
// Clear cache for proper installation
\XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
$this->setHardRedirect();
}
} else {
$keyData = $info['keyData'];
$module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
if ($module) {
$entity = $repo->findKey($info['author'], $info['name']);
if ($entity) {
$entity->setKeyValue($key);
$repo->update($entity);
} else {
$entity = $repo->insert($info + array('keyValue' => $key));
}
if (!empty($keyData['wave'])) {
$this->updateUpgradeWaveOption($keyData['wave']);
}
// Clear cache for proper installation
\XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
if (empty($keyData['message'])) {
$this->showInfo(__FUNCTION__, static::t('License key has been successfully verified for "{{name}}" module by "{{author}}" author', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName())));
} else {
$this->showWarning(__FUNCTION__, static::t('License key has been successfully verified and activated for "{{name}}" module by "{{author}}" author. But this key has expired and do not allow upgrade store.', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName())));
}
// We install the addon after the successfull key verification
$this->setReturnURL($this->buildURL('upgrade', 'install_addon_force', array('moduleIds[]' => $module->getModuleID(), 'agree' => 'Y')));
} else {
$this->showError(__FUNCTION__, static::t('Key is validated, but the module X was not found', array('module' => implode(',', $info))));
//.........这里部分代码省略.........
示例6: isClassColumnVisible
/**
* Check if the simple class is used for widget displaying
*
* @param array $column
* @param \XLite\Model\AEntity $entity
*
* @return boolean
*/
protected function isClassColumnVisible(array $column, \XLite\Model\AEntity $entity)
{
$result = parent::isClassColumnVisible($column, $entity);
/** @var \XLite\Model\Shipping\Method $entity */
switch ($column[static::COLUMN_CODE]) {
case 'deliveryTime':
$result = 'offline' === $entity->getProcessor();
break;
case 'handlingFee':
$result = !\XLite::isFreeLicense();
break;
default:
break;
}
return $result;
}
示例7: checkLicense
/**
* Check if current page is accessible for current x-cart license
*
* @return boolean
*/
protected function checkLicense()
{
$result = true;
if ('license_restriction' === \XLite\Core\Request::getInstance()->page && \XLite::isFreeLicense()) {
$result = false;
}
return $result;
}
示例8: getMarkupRate
/**
* getMarkupRate
*
* @return float
*/
public function getMarkupRate()
{
$handlingFee = \XLite::isFreeLicense() ? 0 : $this->getMethod()->getHandlingFee();
return $this->markupRate + $handlingFee;
}