本文整理汇总了PHP中Tygh\Registry::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::set方法的具体用法?PHP Registry::set怎么用?PHP Registry::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tygh\Registry
的用法示例。
在下文中一共展示了Registry::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($db_already_cloned)
{
Registry::set('runtime.simple_ultimate', true);
Registry::del('runtime.forced_company_id');
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
General::restoreSettings();
db_query("\n DELETE FROM ?:settings_objects\n WHERE name IN (\n 'product_notify_vendor',\n 'order_notify_vendor',\n 'page_notify_vendor',\n 'company_discussion_type',\n 'company_only_buyers',\n 'company_posts_per_page',\n 'company_post_approval',\n 'company_post_ip_check',\n 'company_notification_email',\n 'company_notify_vendor',\n 'companies_setting',\n 'include_companies',\n 'companies_change',\n 'companies_priority',\n 'product_share_discussion',\n 'news_share_discussion',\n 'page_share_discussion',\n 'testimonials_from_all_stores'\n )\n AND section_id IN (\n SELECT section_id FROM ?:settings_sections\n WHERE name IN (\n 'discussion',\n 'google_sitemap'\n )\n )\n ");
General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::updateAltLanguages('state_descriptions', 'state_id');
db_query('DROP TABLE IF EXISTS ?:se_queue');
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例2: smarty_function_script
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_script($params, &$smarty)
{
static $scripts = array();
if (!isset($scripts[$params['src']])) {
if (strpos($params['src'], '//') === false) {
$src = Registry::get('config.current_location') . '/' . fn_link_attach($params['src'], 'ver=' . PRODUCT_VERSION);
} else {
$src = $params['src'];
}
$scripts[$params['src']] = '<script type="text/javascript"' . (!empty($params['class']) ? ' class="' . $params['class'] . '" ' : '') . ' src="' . $src . '" ' . (isset($params['charset']) ? 'charset="' . $params['charset'] . '"' : '') . (isset($params['escape']) ? '><\\/script>' : '></script>');
if (defined('AJAX_REQUEST') || Registry::get('runtime.inside_scripts')) {
return $scripts[$params['src']];
} else {
if (isset($params['no-defer']) && $params['no-defer']) {
return $scripts[$params['src']];
} else {
$cache_name = $smarty->getTemplateVars('block_cache_name');
if (!empty($cache_name)) {
$cached_content = Registry::get($cache_name);
if (!isset($cached_content['javascript'])) {
$cached_content['javascript'] = '';
}
$cached_content['javascript'] .= $scripts[$params['src']];
Registry::set($cache_name, $cached_content, true);
}
$repeat = false;
$smarty->loadPlugin('smarty_block_inline_script');
smarty_block_inline_script(array(), $scripts[$params['src']], $smarty, $repeat);
return '<!-- Inline script moved to the bottom of the page -->';
}
}
}
}
示例3: import
public function import($db_already_cloned)
{
Registry::set('runtime.simple_ultimate', true);
Registry::del('runtime.forced_company_id');
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('shipping_service_descriptions', 'service_id');
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例4: SendRequest
protected static function SendRequest($requestString, $testMode)
{
if ($testMode) {
$serverUrl = "https://testpayments.worldnettps.com/merchant/xmlpayment";
} else {
$serverUrl = "https://payments.worldnettps.com/merchant/xmlpayment";
}
Registry::set('log_cut_data', array('CARDTYPE', 'CARDNUMBER', 'CARDEXPIRY', 'CARDHOLDERNAME', 'CVV', 'ISSUENO'));
return Http::post($serverUrl, $requestString);
}
示例5: getById
/**
* Return template object
*
* @param $id
* @return Template
*/
public static function getById($id)
{
$id = (int) $id;
if (!isset(static::$templates[$id])) {
Registry::set('runtime.skip_sharing_selection', true);
$result = fn_get_ebay_template($id);
Registry::set('runtime.skip_sharing_selection', false);
static::$templates[$id] = new Template($result);
}
return static::$templates[$id];
}
示例6: smarty_helper_inline_scripts
function smarty_helper_inline_scripts($params, $content, &$smarty, &$repeat)
{
Registry::del('runtime.inside_scripts');
// Get inline scripts
$repeat = false;
$smarty->loadPlugin('smarty_block_inline_script');
$inline_scripts = "\n\n<!-- Inline scripts -->\n" . smarty_block_inline_script(array('output' => true), '', $smarty, $repeat);
// FIXME: Backward compatibility. If {scripts} included at the TOP of the page, do not grab inline scripts.
Registry::set('runtime.inside_scripts', 1);
return $inline_scripts;
}
示例7: setup
/**
* Installs addons
*
* @param bool $install_demo
* @param array $addons List of addons to be installed, if empty will be installed addons according <auto_install> tag
* @return bool Always true
*/
public function setup($install_demo = true, $addons = array())
{
$app = App::instance();
Registry::set('customer_theme_path', Registry::get('config.dir.install_themes') . '/' . App::THEME_NAME);
$addons = empty($addons) ? $this->_getAddons() : $addons;
foreach ($addons as $addon_name) {
if (fn_install_addon($addon_name, false, $install_demo)) {
fn_set_progress('echo', $app->t('addon_installed', array('addon' => $addon_name)) . '<br/>', true);
}
Registry::set('runtime.database.errors', '');
}
return true;
}
示例8: import
public function import($db_already_cloned)
{
Registry::set('runtime.simple_ultimate', true);
Registry::del('runtime.forced_company_id');
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToImportedDB($this->store_data);
$supplier_settings = $this->getSupplierSettings();
General::setSupplierSettings($supplier_settings);
$default_language = db_get_field("SELECT value FROM ?:settings WHERE option_name = 'customer_default_language' AND section_id = 'Appearance'");
$settings_to_be_saved = array('use_email_as_login', 'admin_default_language', 'customer_default_language', 'disable_shipping', 'fedex_enabled', 'ups_enabled', 'usps_enabled', 'dhl_enabled', 'aup_enabled', 'can_enabled', 'swisspost_enabled', 'seo_product_type', 'seo_category_type', 'single_url', 'seo_language');
$settings_to_be_saved_values = General::get22xSettings($settings_to_be_saved);
$addons = General::get22xAddons();
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
General::processAddons($this->store_data, __CLASS__, array_keys($addons));
if (!empty($addons)) {
General::processAddonsSettings($addons);
}
General::enableInstalledAddons($addons);
General::setEmptyProgressBar();
$this->_importMenu();
$this->_copyImages();
$this->_copyFiles();
$this->_patchProfileFields();
$this->_normalizeProductViews();
$this->_normalizeUserGroupIds();
$this->_fixLanguagesMissedInImported($default_language);
General::addStatusColors();
General::copyProductsBlocks($this->store_data);
General::restore22xSavedSetting($settings_to_be_saved_values);
General::setEmptyProgressBar();
return true;
}
示例9: create
public function create($params)
{
$status = Response::STATUS_BAD_REQUEST;
$data = array();
unset($params['company_id']);
if (Registry::get('runtime.simple_ultimate')) {
Registry::set('runtime.simple_ultimate', false);
}
list($valid_params, $data['message']) = $this->checkRequiredParams($params, 'add');
if ($valid_params) {
$company_id = fn_update_company($params);
if ($company_id) {
$status = Response::STATUS_OK;
$data = array('store_id' => $company_id);
}
}
return array('status' => $status, 'data' => $data);
}
示例10: fn_seo_settings_update
function fn_seo_settings_update($type, $option, $new_value, $redirect_only)
{
$old_value = Registry::get('addons.seo.' . $option);
fn_iterate_through_seo_names(function ($seo_name) use($option, $old_value, $new_value, $redirect_only) {
// We shouldn't consider null value
if (false === fn_check_seo_object_exists($seo_name['object_id'], $seo_name['type'], $seo_name['company_id'])) {
fn_delete_seo_name($seo_name['object_id'], $seo_name['type'], '', $seo_name['company_id']);
return;
}
Registry::set('addons.seo.' . $option, $old_value);
$url = fn_generate_seo_url_from_schema(array('type' => $seo_name['type'], 'object_id' => $seo_name['object_id'], 'lang_code' => $seo_name['lang_code']), false);
fn_seo_update_redirect(array('src' => $url, 'type' => $seo_name['type'], 'object_id' => $seo_name['object_id'], 'company_id' => $seo_name['company_id'], 'lang_code' => $seo_name['lang_code']), 0, false);
if (!$redirect_only) {
Registry::set('addons.seo.' . $option, $new_value);
fn_create_seo_name($seo_name['object_id'], $seo_name['type'], $seo_name['name'], 0, '', $seo_name['company_id'], $seo_name['lang_code'], true);
}
}, db_quote("type = ?s ?p", $type, fn_get_seo_company_condition('?:seo_names.company_id', $type)));
}
示例11: moveToRuntime
/**
* Move settings from the database to the registry.
* @param array $default_settings
*/
public static function moveToRuntime($default_settings = array())
{
$in_runtime = self::get();
if (!$in_runtime) {
$in_runtime = array();
}
$settings = array_merge($default_settings, $in_runtime, self::_getFromDB());
// Merge current company's settings to the root
$company_id = fn_twg_get_current_company_id();
if (!empty($settings['customer_connections'][$company_id])) {
$settings = array_merge($settings, $settings['customer_connections'][$company_id]);
}
Registry::set(self::REGISTRY_PATH, $settings);
// To avoid caching set for each store
Registry::set(self::REGISTRY_PATH . '.customer_connections', $settings['customer_connections']);
foreach ($settings['customer_connections'] as $company_id => $connection) {
Registry::set(self::REGISTRY_PATH . ".customer_connections.{$company_id}", $connection);
}
}
示例12: fn_seo_settings_update
function fn_seo_settings_update($type, $option, $new_value, $redirect_only)
{
$i = 0;
$items_per_pass = 100;
$old_value = Registry::get('addons.seo.' . $option);
$company_condition = fn_get_seo_company_condition('?:seo_names.company_id', $type);
while ($update_data = db_get_array("SELECT * FROM ?:seo_names WHERE type = ?s ?p LIMIT {$i}, {$items_per_pass}", $type, $company_condition)) {
foreach ($update_data as $data) {
Registry::set('addons.seo.' . $option, $old_value);
$url = fn_generate_seo_url_from_schema(array('type' => $data['type'], 'object_id' => $data['object_id'], 'lang_code' => $data['lang_code']), false);
fn_seo_update_redirect(array('src' => $url, 'type' => $data['type'], 'object_id' => $data['object_id'], 'company_id' => $data['company_id'], 'lang_code' => $data['lang_code']), 0, false);
if (!$redirect_only) {
Registry::set('addons.seo.' . $option, $new_value);
fn_create_seo_name($data['object_id'], $data['type'], $data['name'], 0, '', $data['company_id'], $data['lang_code'], true);
}
}
$i += $items_per_pass;
}
}
示例13: import
public function import($db_already_cloned)
{
Registry::set('runtime.simple_ultimate', true);
Registry::del('runtime.forced_company_id');
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$default_company = General::getDefaultCompany();
$supplier_settings = $this->getSupplierSettings();
General::setSupplierSettings($supplier_settings);
$enabledSuppliers = General::supplierSettings('enabled') ? true : false;
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
if ($enabledSuppliers) {
$this->_importSuppliers();
}
General::processAddons($this->store_data, __CLASS__);
General::setEmptyProgressBar();
$this->_deleteAllCompanies();
$default_company_id = (int) General::createDefaultCompany($default_company);
$this->_fillSharingTable($default_company_id);
$this->_updateCompanyId($default_company_id);
$this->_setStorefromUrl($default_company_id, $this->store_data);
General::setEmptyProgressBar();
return true;
}
示例14: outputScript
public static function outputScript($content, \Smarty_Internal_Template $template)
{
if (defined('AJAX_REQUEST')) {
return $content;
}
$continue = $template->smarty->getTemplateVars('block_parse_js');
if (!$continue) {
return $content;
}
$pattern = '/\\<script([^>]*)\\>.*?\\<\\/script\\>/s';
if (preg_match_all($pattern, $content, $matches)) {
if (Registry::get('runtime.inside_scripts')) {
return $content;
}
$cache_name = $template->smarty->getTemplateVars('block_cache_name');
$m = $matches[0];
$m_attrs = $matches[1];
$javascript = '';
foreach ($m as $index => $match) {
if (strpos($m_attrs[$index], 'data-no-defer') === false) {
$repeat = false;
$template->smarty->loadPlugin('smarty_block_inline_script');
smarty_block_inline_script(array(), $match, $template->smarty, $repeat);
$content = str_replace($match, '<!-- Inline script moved to the bottom of the page -->', $content);
$javascript .= $match;
}
}
if (!empty($cache_name)) {
$cached_content = Registry::get($cache_name);
if (!isset($cached_content['javascript'])) {
$cached_content['javascript'] = '';
}
$cached_content['javascript'] .= $javascript;
Registry::set($cache_name, $cached_content, true);
}
}
return $content;
}
示例15: import
public function import($db_already_cloned)
{
Registry::set('runtime.simple_ultimate', true);
Registry::del('runtime.forced_company_id');
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::updateAltLanguages('state_descriptions', 'state_id');
General::updateAltLanguages('shipping_service_descriptions', 'service_id');
General::updateAltLanguages('privilege_descriptions', 'privilege');
General::updateAltLanguages('privilege_section_descriptions', 'section_id');
General::updateAltLanguages('country_descriptions', 'code');
db_query('DROP TABLE IF EXISTS ?:se_queue');
General::setEmptyProgressBar();
General::processBlocks();
if (db_get_field("SHOW TABLES LIKE '?:mailing_lists'")) {
db_query("ALTER TABLE ?:mailing_lists DROP `show_on_sidebar`");
}
General::setEmptyProgressBar();
return true;
}