本文整理汇总了PHP中Combination::isCurrentlyUsed方法的典型用法代码示例。如果您正苦于以下问题:PHP Combination::isCurrentlyUsed方法的具体用法?PHP Combination::isCurrentlyUsed怎么用?PHP Combination::isCurrentlyUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combination
的用法示例。
在下文中一共展示了Combination::isCurrentlyUsed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAddServer')) {
if ($this->tabAccess['add'] === '1') {
if (!Tools::getValue('memcachedIp')) {
$this->errors[] = Tools::displayError('Memcached IP is missing');
}
if (!Tools::getValue('memcachedPort')) {
$this->errors[] = Tools::displayError('Memcached port is missing');
}
if (!Tools::getValue('memcachedWeight')) {
$this->errors[] = Tools::displayError('Memcached weight is missing');
}
if (!count($this->errors)) {
if (CacheMemcache::addServer(pSQL(Tools::getValue('memcachedIp')), (int) Tools::getValue('memcachedPort'), (int) Tools::getValue('memcachedWeight'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = Tools::displayError('Cannot add Memcached server');
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to add here.');
}
}
if (Tools::getValue('deleteMemcachedServer')) {
if ($this->tabAccess['add'] === '1') {
if (CacheMemcache::deleteServer((int) Tools::getValue('deleteMemcachedServer'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = Tools::displayError('Error in deleting Memcached server');
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
}
}
$redirecAdmin = false;
if ((bool) Tools::getValue('smarty_up')) {
if ($this->tabAccess['edit'] === '1') {
Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0));
$redirecAdmin = true;
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if ((bool) Tools::getValue('features_detachables_up')) {
if ($this->tabAccess['edit'] === '1') {
if (!Combination::isCurrentlyUsed()) {
Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination'));
}
Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature'));
$redirecAdmin = true;
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if ((bool) Tools::getValue('ccc_up')) {
if ($this->tabAccess['edit'] === '1') {
if (!Configuration::updateValue('PS_CSS_THEME_CACHE', (int) Tools::getValue('PS_CSS_THEME_CACHE')) || !Configuration::updateValue('PS_JS_THEME_CACHE', (int) Tools::getValue('PS_JS_THEME_CACHE')) || !Configuration::updateValue('PS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_JS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_JS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_HIGH_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_HIGH_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int) Tools::getValue('PS_HTACCESS_CACHE_CONTROL'))) {
$this->errors[] = Tools::displayError('Unknown error.');
} else {
$redirecAdmin = true;
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) {
Tools::generateHtaccess();
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if ((bool) Tools::getValue('media_server_up')) {
if ($this->tabAccess['edit'] === '1') {
if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_'))) {
$this->errors[] = Tools::displayError('Media server #1 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_'))) {
$this->errors[] = Tools::displayError('Media server #2 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_'))) {
$this->errors[] = Tools::displayError('Media server #3 is invalid');
}
if (!count($this->errors)) {
$base_urls = array();
$base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
$base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
$base_urls['_MEDIA_SERVER_3_'] = Tools::getValue('_MEDIA_SERVER_3_');
rewriteSettingsFile($base_urls, null, null);
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
$redirecAdmin = true;
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if ((bool) Tools::getValue('ciphering_up') && Configuration::get('PS_CIPHER_ALGORITHM') != (int) Tools::getValue('PS_CIPHER_ALGORITHM')) {
if ($this->tabAccess['edit'] === '1') {
$algo = (int) Tools::getValue('PS_CIPHER_ALGORITHM');
//.........这里部分代码省略.........
示例2: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->errors[] = Tools::displayError('This functionality has been disabled.');
return;
}
Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'Before', array('controller' => $this));
if (Tools::isSubmit('submitAddServer')) {
if ($this->tabAccess['add'] === '1') {
if (!Tools::getValue('memcachedIp')) {
$this->errors[] = Tools::displayError('The Memcached IP is missing.');
}
if (!Tools::getValue('memcachedPort')) {
$this->errors[] = Tools::displayError('The Memcached port is missing.');
}
if (!Tools::getValue('memcachedWeight')) {
$this->errors[] = Tools::displayError('The Memcached weight is missing.');
}
if (!count($this->errors)) {
if (CacheMemcache::addServer(pSQL(Tools::getValue('memcachedIp')), (int) Tools::getValue('memcachedPort'), (int) Tools::getValue('memcachedWeight'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = Tools::displayError('The Memcached server cannot be added.');
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
}
if (Tools::getValue('deleteMemcachedServer')) {
if ($this->tabAccess['add'] === '1') {
if (CacheMemcache::deleteServer((int) Tools::getValue('deleteMemcachedServer'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = Tools::displayError('There was an error when attempting to delete the Memcached server.');
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to delete this.');
}
}
$redirectAdmin = false;
if ((bool) Tools::getValue('smarty_up')) {
if ($this->tabAccess['edit'] === '1') {
Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0));
Configuration::updateValue('PS_SMARTY_CONSOLE_KEY', Tools::getValue('smarty_console_key', 'SMARTY_DEBUG'));
$redirecAdmin = true;
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
if ((bool) Tools::getValue('features_detachables_up')) {
if ($this->tabAccess['edit'] === '1') {
if (Tools::getValue('combination') || !Combination::isCurrentlyUsed()) {
Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', Tools::getValue('combination'));
}
if (Tools::getValue('customer_group') && !Group::isCurrentlyUsed()) {
Configuration::updateValue('PS_GROUP_FEATURE_ACTIVE', Tools::getValue('customer_group'));
}
Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', Tools::getValue('feature'));
$redirectAdmin = true;
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
if ((bool) Tools::getValue('ccc_up')) {
if ($this->tabAccess['edit'] === '1') {
$theme_cache_directory = _PS_ALL_THEMES_DIR_ . $this->context->shop->theme_directory . '/cache/';
if (((bool) Tools::getValue('PS_CSS_THEME_CACHE') || (bool) Tools::getValue('PS_JS_THEME_CACHE')) && !is_writable($theme_cache_directory)) {
$this->errors[] = Tools::displayError(sprintf($this->l('To use Smart Cache directory %s must be writable.'), realpath($theme_cache_directory)));
}
if (!Configuration::updateValue('PS_CSS_THEME_CACHE', (int) Tools::getValue('PS_CSS_THEME_CACHE')) || !Configuration::updateValue('PS_JS_THEME_CACHE', (int) Tools::getValue('PS_JS_THEME_CACHE')) || !Configuration::updateValue('PS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_JS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_JS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int) Tools::getValue('PS_HTACCESS_CACHE_CONTROL'))) {
$this->errors[] = Tools::displayError('Unknown error.');
} else {
$redirectAdmin = true;
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) {
Tools::generateHtaccess();
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
}
if ((bool) Tools::getValue('media_server_up')) {
if ($this->tabAccess['edit'] === '1') {
if (Tools::getValue('_MEDIA_SERVER_1_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_1_'))) {
$this->errors[] = Tools::displayError('Media server #1 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_2_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_2_'))) {
$this->errors[] = Tools::displayError('Media server #2 is invalid');
}
if (Tools::getValue('_MEDIA_SERVER_3_') != null && !Validate::isFileName(Tools::getValue('_MEDIA_SERVER_3_'))) {
$this->errors[] = Tools::displayError('Media server #3 is invalid');
}
if (!count($this->errors)) {
$base_urls = array();
$base_urls['_MEDIA_SERVER_1_'] = Tools::getValue('_MEDIA_SERVER_1_');
$base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
//.........这里部分代码省略.........
示例3: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->errors[] = $this->trans('This functionality has been disabled.', array(), 'Admin.Notifications.Error');
return;
}
Hook::exec('action' . get_class($this) . ucfirst($this->action) . 'Before', array('controller' => $this));
if (Tools::isSubmit('submitAddServer')) {
if ($this->access('add')) {
if (!Tools::getValue('memcachedIp')) {
$this->errors[] = $this->trans('The Memcached IP is missing.', array(), 'Admin.Parameters.Notification');
}
if (!Tools::getValue('memcachedPort')) {
$this->errors[] = $this->trans('The Memcached port is missing.', array(), 'Admin.Parameters.Notification');
}
if (!Tools::getValue('memcachedWeight')) {
$this->errors[] = $this->trans('The Memcached weight is missing.', array(), 'Admin.Parameters.Notification');
}
if (!count($this->errors)) {
if (CacheMemcache::addServer(pSQL(Tools::getValue('memcachedIp')), (int) Tools::getValue('memcachedPort'), (int) Tools::getValue('memcachedWeight'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = $this->trans('The Memcached server cannot be added.', array(), 'Admin.Parameters.Notification');
}
}
} else {
$this->errors[] = $this->trans('You do not have permission to add this.', array(), 'Admin.Notifications.Error');
}
}
if (Tools::getValue('deleteMemcachedServer')) {
if ($this->access('add')) {
if (CacheMemcache::deleteServer((int) Tools::getValue('deleteMemcachedServer'))) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getValue('token') . '&conf=4');
} else {
$this->errors[] = $this->trans('There was an error when attempting to delete the Memcached server.', array(), 'Admin.Parameters.Notification');
}
} else {
$this->errors[] = $this->trans('You do not have permission to delete this.', array(), 'Admin.Notifications.Error');
}
}
$redirectAdmin = false;
if ((bool) Tools::getValue('smarty_up')) {
if ($this->access('edit')) {
Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
if (Configuration::get('PS_SMARTY_CACHE') != Tools::getValue('smarty_cache')) {
Tools::clearSmartyCache();
}
Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
Configuration::updateValue('PS_SMARTY_CLEAR_CACHE', Tools::getValue('smarty_clear_cache'));
Configuration::updateValue('PS_SMARTY_LOCAL', Tools::getValue('smarty_local', 0));
$redirectAdmin = true;
} else {
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
}
}
if ((bool) Tools::getValue('features_detachables_up')) {
if ($this->access('edit')) {
if (Tools::isSubmit('combination')) {
if ((!Tools::getValue('combination') && Combination::isCurrentlyUsed()) === false) {
Configuration::updateValue('PS_COMBINATION_FEATURE_ACTIVE', (bool) Tools::getValue('combination'));
}
}
if (Tools::isSubmit('customer_group')) {
if ((!Tools::getValue('customer_group') && Group::isCurrentlyUsed()) === false) {
Configuration::updateValue('PS_GROUP_FEATURE_ACTIVE', (bool) Tools::getValue('customer_group'));
}
}
Configuration::updateValue('PS_FEATURE_FEATURE_ACTIVE', (bool) Tools::getValue('feature'));
$redirectAdmin = true;
} else {
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
}
}
if ((bool) Tools::getValue('ccc_up')) {
if ($this->access('edit')) {
$theme_cache_directory = _PS_ALL_THEMES_DIR_ . $this->context->shop->theme_directory . '/cache/';
@mkdir($theme_cache_directory, 0777, true);
if (((bool) Tools::getValue('PS_CSS_THEME_CACHE') || (bool) Tools::getValue('PS_JS_THEME_CACHE')) && !is_writable($theme_cache_directory)) {
$this->errors[] = $this->trans('To use Smart Cache, the directory %directorypath% must be writable.', array('%directorypath%' => realpath($theme_cache_directory)), 'Admin.Parameters.Notification');
}
if ($tmp = (int) Tools::getValue('PS_CSS_THEME_CACHE')) {
$version = (int) Configuration::get('PS_CCCCSS_VERSION');
if (Configuration::get('PS_CSS_THEME_CACHE') != $tmp) {
Configuration::updateValue('PS_CCCCSS_VERSION', ++$version);
}
}
if ($tmp = (int) Tools::getValue('PS_JS_THEME_CACHE')) {
$version = (int) Configuration::get('PS_CCCJS_VERSION');
if (Configuration::get('PS_JS_THEME_CACHE') != $tmp) {
Configuration::updateValue('PS_CCCJS_VERSION', ++$version);
}
}
if (!Configuration::updateValue('PS_CSS_THEME_CACHE', (int) Tools::getValue('PS_CSS_THEME_CACHE')) || !Configuration::updateValue('PS_JS_THEME_CACHE', (int) Tools::getValue('PS_JS_THEME_CACHE')) || !Configuration::updateValue('PS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_JS_HTML_THEME_COMPRESSION', (int) Tools::getValue('PS_JS_HTML_THEME_COMPRESSION')) || !Configuration::updateValue('PS_JS_DEFER', (int) Tools::getValue('PS_JS_DEFER')) || !Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int) Tools::getValue('PS_HTACCESS_CACHE_CONTROL'))) {
$this->errors[] = $this->trans('Unknown error.', array(), 'Admin.Notifications.Error');
} else {
$redirectAdmin = true;
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL')) {
if (is_writable(_PS_ROOT_DIR_ . '/.htaccess')) {
Tools::generateHtaccess();
//.........这里部分代码省略.........