本文整理汇总了PHP中Configuration::loadConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::loadConfiguration方法的具体用法?PHP Configuration::loadConfiguration怎么用?PHP Configuration::loadConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::loadConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_module_1_3_0
/**
* Upgrades the module to version 1.3.0.
*
* Purges existing nosto configs.
* Removes unused config variables.
* Registers new hooks.
* Un-register left/right column hooks.
*
* @param NostoTagging $object
* @return bool
*/
function upgrade_module_1_3_0($object)
{
// Purge the nosto configs the plugin have created so far and reload the config.
$config_table = _DB_PREFIX_ . 'configuration';
$config_lang_table = $config_table . '_lang';
Db::getInstance()->execute('
DELETE `' . $config_lang_table . '` FROM `' . $config_lang_table . '`
LEFT JOIN `' . $config_table . '`
ON `' . $config_lang_table . '`.`id_configuration` = `' . $config_table . '`.`id_configuration`
WHERE `' . $config_table . '`.`name` LIKE "NOSTOTAGGING_%"');
Db::getInstance()->execute('
DELETE FROM `' . $config_table . '`
WHERE `' . $config_table . '`.`name` LIKE "NOSTOTAGGING_%"');
Configuration::loadConfiguration();
// Backward compatibility
if (_PS_VERSION_ < '1.5') {
$object->registerHook('header');
$object->registerHook('top');
$object->registerHook('footer');
$object->registerHook('productfooter');
$object->registerHook('shoppingCart');
$object->registerHook('orderConfirmation');
$object->registerHook('paymentConfirm');
$object->registerHook('paymentTop');
$object->registerHook('home');
$object->registerHook('updateproduct');
$object->registerHook('deleteproduct');
$object->registerHook('updateQuantity');
} else {
$object->registerHook('actionObjectUpdateAfter');
}
$object->unregisterHook('displayLeftColumn');
$object->unregisterHook('displayRightColumn');
return true;
}
示例2: loadConfiguration
public static function loadConfiguration()
{
ConfigurationKPI::setKpiDefinition();
$r = parent::loadConfiguration();
ConfigurationKPI::unsetKpiDefinition();
return $r;
}
示例3: initializeContext
public function initializeContext()
{
global $smarty;
// Clean all cache values
Cache::clean('*');
Context::getContext()->shop = new Shop(1);
Shop::setContext(Shop::CONTEXT_SHOP, 1);
Configuration::loadConfiguration();
if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) {
if ($id_lang = (int) Configuration::get('PS_LANG_DEFAULT')) {
Context::getContext()->language = new Language($id_lang);
}
}
if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) {
if ($id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT')) {
Context::getContext()->country = new Country((int) $id_country);
}
}
if (!isset(Context::getContext()->currency) || !Validate::isLoadedObject(Context::getContext()->currency)) {
if ($id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT')) {
Context::getContext()->currency = new Currency((int) $id_currency);
}
}
Context::getContext()->cart = new Cart();
Context::getContext()->employee = new Employee(1);
if (!defined('_PS_SMARTY_FAST_LOAD_')) {
define('_PS_SMARTY_FAST_LOAD_', true);
}
require_once _PS_ROOT_DIR_ . '/config/smarty.config.inc.php';
Context::getContext()->smarty = $smarty;
}
示例4: init
public function init()
{
define('_PS_ADMIN_DIR_', getcwd());
// Load Presta Configuration
Configuration::loadConfiguration();
Context::getContext()->link = new Link();
$this->confirm();
}
示例5: generateHtaccess
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
{
if (Module::isInstalled('agilemultipleseller')) {
AgileSellerManager::ensure_configuration_record_for_all_shops();
Configuration::loadConfiguration();
return self::generateHtaccess_override($path, $rewrite_settings, $cache_control, $specific, $disable_multiviews, $medias, $disable_modsec, $disable_modsec);
}
return parent::generateHtaccess($path, $rewrite_settings, $cache_control, $specific, $disable_multiviews, $medias, $disable_modsec);
}
示例6: update_module_followup
function update_module_followup()
{
Configuration::loadConfiguration();
$followup = Module::getInstanceByName('followup');
if (!$followup->id) {
return;
}
Db::getInstance()->Execute('ALTER TABLE `' . _DB_PREFIX_ . 'log_email` ADD INDEX `date_add`(`date_add`), ADD INDEX `id_cart`(`id_cart`);');
}
示例7: alter_productcomments_guest_index
function alter_productcomments_guest_index()
{
Configuration::loadConfiguration();
$productcomments = Module::getInstanceByName('productcomments');
if (!$productcomments->id) {
return;
}
DB::getInstance()->Execute('
ALTER TABLE `' . _DB_PREFIX_ . 'product_comment`
DROP INDEX `id_guest`, ADD INDEX `id_guest` (`id_guest`);');
}
示例8: __construct
/**
* Creates a new backup object
*
* @param string $filename Filename of the backup file
*/
public function __construct($filename = NULL)
{
if ($filename) {
$this->id = $this->getRealBackupPath($filename);
}
Configuration::loadConfiguration();
$psBackupAll = Configuration::get('PS_BACKUP_ALL');
$psBackupDropTable = Configuration::get('PS_BACKUP_DROP_TABLE');
$this->psBackupAll = $psBackupAll !== false ? $psBackupAll : true;
$this->psBackupDropTable = $psBackupDropTable !== false ? $psBackupDropTable : true;
}
示例9: initializeContext
public function initializeContext()
{
global $smarty;
Context::getContext()->shop = new Shop(1);
Shop::setContext(Shop::CONTEXT_SHOP, 1);
Configuration::loadConfiguration();
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
Context::getContext()->country = new Country('PS_COUNTRY_DEFAULT');
Context::getContext()->cart = new Cart();
define('_PS_SMARTY_FAST_LOAD_', true);
require_once _PS_ROOT_DIR_ . '/config/smarty.config.inc.php';
Context::getContext()->smarty = $smarty;
}
示例10: update_modules_sql
function update_modules_sql()
{
Configuration::loadConfiguration();
$blocklink = Module::getInstanceByName('blocklink');
if ($blocklink->id) {
Db::getInstance()->Execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'blocklink_lang` ADD PRIMARY KEY (`id_link`, `id_lang`);');
}
$productComments = Module::getInstanceByName('productcomments');
if ($productComments->id) {
Db::getInstance()->Execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'product_comment_grade` ADD PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`);');
Db::getInstance()->Execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'product_comment_criterion` DROP PRIMARY KEY, ADD PRIMARY KEY (`id_product_comment_criterion`, `id_lang`);');
Db::getInstance()->Execute('ALTER IGNORE TABLE `' . _DB_PREFIX_ . 'product_comment_criterion_product` ADD PRIMARY KEY(`id_product`, `id_product_comment_criterion`);');
}
}
示例11: invoice_number_set
function invoice_number_set()
{
Configuration::loadConfiguration();
$number = 1;
// Update each order with a number
$result = Db::getInstance()->ExecuteS('
SELECT id_order
FROM ' . _DB_PREFIX_ . 'orders
ORDER BY id_order');
foreach ($result as $row) {
$order = new Order((int) $row['id_order']);
$history = $order->getHistory(false);
foreach ($history as $row2) {
$oS = new OrderState((int) $row2['id_order_state'], (int) Configuration::get('PS_LANG_DEFAULT'));
if ($oS->invoice) {
Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'orders SET invoice_number = ' . (int) $number++ . ', `invoice_date` = `date_add` WHERE id_order = ' . (int) $order->id);
break;
}
}
}
// Add configuration var
Configuration::updateValue('PS_INVOICE_NUMBER', (int) $number);
}
示例12: delivery_number_set
function delivery_number_set()
{
Configuration::loadConfiguration();
$number = 1;
// Update each order with a number
$result = Db::getInstance()->ExecuteS('
SELECT id_order
FROM ' . _DB_PREFIX_ . 'orders
ORDER BY id_order');
foreach ($result as $row) {
$order = new Order(intval($row['id_order']));
$history = $order->getHistory(false);
foreach ($history as $row2) {
$oS = new OrderState(intval($row2['id_order_state']));
if ($oS->delivery) {
Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'orders SET delivery_number = ' . intval($number++) . ', `delivery_date` = `date_add` WHERE id_order = ' . intval($order->id));
break;
}
}
}
// Add configuration var
Configuration::updateValue('PS_DELIVERY_NUMBER', intval($number));
}
示例13: configureShop
/**
* PROCESS : configureShop
* Set default shop configuration
*/
public function configureShop(array $data = array())
{
//clear image cache in tmp folder
if (file_exists(_PS_TMP_IMG_DIR_)) {
foreach (scandir(_PS_TMP_IMG_DIR_) as $file) {
if ($file[0] != '.' && $file != 'index.php') {
Tools::deleteFile(_PS_TMP_IMG_DIR_ . $file);
}
}
}
$default_data = array('shop_name' => 'My Shop', 'shop_activity' => '', 'shop_country' => 'us', 'shop_timezone' => 'US/Eastern', 'use_smtp' => false, 'smtp_encryption' => 'off', 'smtp_port' => 25, 'rewrite_engine' => false);
foreach ($default_data as $k => $v) {
if (!isset($data[$k])) {
$data[$k] = $v;
}
}
Context::getContext()->shop = new Shop(1);
Configuration::loadConfiguration();
// use the old image system if the safe_mod is enabled otherwise the installer will fail with the fixtures installation
if (InstallSession::getInstance()->safe_mode) {
Configuration::updateGlobalValue('PS_LEGACY_IMAGES', 1);
}
$id_country = Country::getByIso($data['shop_country']);
// Set default configuration
Configuration::updateGlobalValue('PS_SHOP_DOMAIN', Tools::getHttpHost());
Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', Tools::getHttpHost());
Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_);
Configuration::updateGlobalValue('PS_LOCALE_LANGUAGE', $this->language->getLanguageIso());
Configuration::updateGlobalValue('PS_SHOP_NAME', $data['shop_name']);
Configuration::updateGlobalValue('PS_SHOP_ACTIVITY', $data['shop_activity']);
Configuration::updateGlobalValue('PS_COUNTRY_DEFAULT', $id_country);
Configuration::updateGlobalValue('PS_LOCALE_COUNTRY', $data['shop_country']);
Configuration::updateGlobalValue('PS_TIMEZONE', $data['shop_timezone']);
Configuration::updateGlobalValue('PS_CONFIGURATION_AGREMENT', (int) $data['configuration_agrement']);
// Set mails configuration
Configuration::updateGlobalValue('PS_MAIL_METHOD', $data['use_smtp'] ? 2 : 1);
Configuration::updateGlobalValue('PS_MAIL_SMTP_ENCRYPTION', $data['smtp_encryption']);
Configuration::updateGlobalValue('PS_MAIL_SMTP_PORT', $data['smtp_port']);
// Set default rewriting settings
Configuration::updateGlobalValue('PS_REWRITING_SETTINGS', $data['rewrite_engine']);
// Activate rijndael 128 encrypt algorihtm if mcrypt is activated
Configuration::updateGlobalValue('PS_CIPHER_ALGORITHM', function_exists('mcrypt_encrypt') ? 1 : 0);
$groups = Group::getGroups((int) Configuration::get('PS_LANG_DEFAULT'));
$groups_default = Db::getInstance()->executeS('SELECT `name` FROM ' . _DB_PREFIX_ . 'configuration WHERE `name` LIKE "PS_%_GROUP" ORDER BY `id_configuration`');
foreach ($groups_default as &$group_default) {
if (is_array($group_default) && isset($group_default['name'])) {
$group_default = $group_default['name'];
}
}
if (is_array($groups) && count($groups)) {
foreach ($groups as $key => $group) {
if (Configuration::get($groups_default[$key]) != $groups[$key]['id_group']) {
Configuration::updateGlobalValue($groups_default[$key], (int) $groups[$key]['id_group']);
}
}
}
$states = Db::getInstance()->executeS('SELECT `id_order_state` FROM ' . _DB_PREFIX_ . 'order_state ORDER by `id_order_state`');
$states_default = Db::getInstance()->executeS('SELECT MIN(`id_configuration`), `name` FROM ' . _DB_PREFIX_ . 'configuration WHERE `name` LIKE "PS_OS_%" GROUP BY `value` ORDER BY`id_configuration`');
foreach ($states_default as &$state_default) {
if (is_array($state_default) && isset($state_default['name'])) {
$state_default = $state_default['name'];
}
}
if (is_array($states) && count($states)) {
foreach ($states as $key => $state) {
if (Configuration::get($states_default[$key]) != $states[$key]['id_order_state']) {
Configuration::updateGlobalValue($states_default[$key], (int) $states[$key]['id_order_state']);
}
}
/* deprecated order state */
Configuration::updateGlobalValue('PS_OS_OUTOFSTOCK_PAID', (int) Configuration::get('PS_OS_OUTOFSTOCK'));
}
// Set logo configuration
if (file_exists(_PS_IMG_DIR_ . 'logo.jpg')) {
list($width, $height) = getimagesize(_PS_IMG_DIR_ . 'logo.jpg');
Configuration::updateGlobalValue('SHOP_LOGO_WIDTH', round($width));
Configuration::updateGlobalValue('SHOP_LOGO_HEIGHT', round($height));
}
// Disable cache for debug mode
if (_PS_MODE_DEV_) {
Configuration::updateGlobalValue('PS_SMARTY_CACHE', 1);
}
// Active only the country selected by the merchant
Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'country SET active = 0 WHERE id_country != ' . (int) $id_country);
// Set localization configuration
$version = str_replace('.', '', _PS_VERSION_);
$version = substr($version, 0, 2);
$localization_file_content = $this->getLocalizationPackContent($version, $data['shop_country']);
$locale = new LocalizationPackCore();
$locale->loadLocalisationPack($localization_file_content, '', true);
// Create default employee
if (isset($data['admin_firstname']) && isset($data['admin_lastname']) && isset($data['admin_password']) && isset($data['admin_email'])) {
$employee = new Employee();
$employee->firstname = Tools::ucfirst($data['admin_firstname']);
$employee->lastname = Tools::ucfirst($data['admin_lastname']);
$employee->email = $data['admin_email'];
//.........这里部分代码省略.........
示例14: AddConfToFile
$confFile = new AddConfToFile(SETTINGS_FILE, 'w');
if ($confFile->error) {
die('<action result="fail" error="' . $confFile->error . '" />' . "\n");
}
foreach ($datas as $data) {
$confFile->writeInFile($data[0], $data[1]);
}
$confFile->writeEndTagPhp();
if ($confFile->error != false) {
die('<action result="fail" error="' . $confFile->error . '" />' . "\n");
}
//sql file execution
global $requests, $warningExist;
$requests = '';
$warningExist = false;
Configuration::loadConfiguration();
foreach ($sqlContent as $query) {
$query = trim($query);
if (!empty($query)) {
/* If php code have to be executed */
if (strpos($query, '/* PHP:') !== false) {
/* Parsing php code */
$pos = strpos($query, '/* PHP:') + strlen('/* PHP:');
$phpString = substr($query, $pos, strlen($query) - $pos - strlen(' */;'));
$php = explode('::', $phpString);
preg_match('/\\((.*)\\)/', $phpString, $pattern);
$paramsString = trim($pattern[0], '()');
preg_match_all('/([^,]+),? ?/', $paramsString, $parameters);
if (isset($parameters[1])) {
$parameters = $parameters[1];
} else {
示例15: ajaxProcessBackupDb
public function ajaxProcessBackupDb()
{
$this->_loadDbRelatedClasses();
$backup = new Backup();
// for backup db, use autoupgrade directory
// @TODO : autoupgrade must not be static
$backup->setCustomBackupPath('autoupgrade');
// maybe for big tables we should save them in more than one file ?
$res = $backup->add();
if ($res) {
$this->nextParams['backupDbFilename'] = $backup->id;
// We need to load configuration to use it ...
Configuration::loadConfiguration();
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $backup->id);
$this->next = 'upgradeFiles';
$this->nextDesc = sprintf($this->l('Database backup done in %s. Now updating files'), $backup->id);
}
// if an error occur, we assume the file is not saved
}