本文整理汇总了PHP中Tygh\Registry类的典型用法代码示例。如果您正苦于以下问题:PHP Registry类的具体用法?PHP Registry怎么用?PHP Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
General::backupSettings();
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
//Find all quick menu linked to the template_editor and change it to file_editor
$quick_menus = db_get_array("SELECT * FROM ?:quick_menu WHERE url LIKE '%template_editor%'");
foreach ($quick_menus as $quick_menu) {
$quick_menu['url'] = str_replace('template_editor', 'file_editor', $quick_menu['url']);
db_query("REPLACE INTO ?:quick_menu ?e", $quick_menu);
}
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例2: fn_ebay_check_license
function fn_ebay_check_license($silent = false, $skip_messages = false)
{
// addons.ebay.ebay_license_number
$license_number = Registry::get(str_rot13('nqqbaf.ronl.ronl_yvprafr_ahzore'));
$_SESSION['eauth'] = time();
if (empty($license_number)) {
if (!$silent) {
// ebay_empty_license_number
fn_set_notification('E', __('error'), __(str_rot13('ronl_rzcgl_yvprafr_ahzore')));
}
return false;
} else {
// Some HD checking code
$data = Helpdesk::getLicenseInformation($license_number, array('edition' => 'EBAY'));
list($license_status, , $messages) = Helpdesk::parseLicenseInformation($data, array(), false);
if (!empty($messages) && !$skip_messages) {
foreach ($messages as $message) {
fn_set_notification($message['type'], $message['title'], $message['text']);
}
}
if ($license_status == 'ACTIVE') {
return 'A';
} elseif ($license_status == '') {
// Timeout
fn_set_notification('E', __('error'), __('unable_to_check_license'));
return 'T';
} else {
return 'I';
}
}
}
示例3: get
/**
* Gets theme patterns
* @param string $style_id style ID
* @return array theme patterns
*/
public static function get($style_id)
{
$style_id = fn_basename($style_id);
$url = Registry::get('config.current_location') . '/' . fn_get_theme_path('[relative]/[theme]/media/images/patterns/' . $style_id . '/');
$patterns = self::getPath($style_id);
return fn_get_dir_contents($patterns, false, true, '', $url);
}
示例4: index
public function index($id = 0, $params = array())
{
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if ($this->getParentName() == 'categories') {
$parent_category = $this->getParentData();
$params['cid'] = $parent_category['category_id'];
}
if (!empty($id)) {
$data = fn_get_product_data($id, $this->auth, $lang_code, '', true, true, true, false, false, false, false);
if (empty($data)) {
$status = Response::STATUS_NOT_FOUND;
} else {
$status = Response::STATUS_OK;
}
} else {
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page'));
$params['extend'][] = 'categories';
list($products, $search) = fn_get_products($params, $items_per_page, $lang_code);
$params['get_options'] = $this->safeGet($params, 'get_options', false);
$params['get_features'] = $this->safeGet($params, 'get_features', true);
$params['get_detailed'] = $this->safeGet($params, 'get_detailed', true);
$params['get_icon'] = $this->safeGet($params, 'get_icon', true);
$params['get_additional'] = $this->safeGet($params, 'get_additional', true);
$params['detailed_params'] = $this->safeGet($params, 'detailed_params', false);
$params['features_display_on'] = 'A';
fn_gather_additional_products_data($products, $params);
$data = array('products' => array_values($products), 'params' => $search);
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
示例5: index
/**
* Gets settings list
*
* @param int $id Settings identifier
* @param array $params Filter params
* @return array
*/
public function index($id = 0, $params = array())
{
$company_id = $this->safeGet($params, 'company_id', null);
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if (!empty($id)) {
$data = CartSettings::instance()->getData($id, $company_id);
if (empty($data)) {
$status = Response::STATUS_NOT_FOUND;
} else {
$status = Response::STATUS_OK;
}
} else {
$section_id = $this->safeGet($params, 'section_id', 0);
$section_tab_id = $this->safeGet($params, 'section_tab_id', 0);
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page'));
$page = $this->safeGet($params, 'page', 1);
$data = CartSettings::instance()->getList($section_id, $section_tab_id, true, $company_id, $lang_code);
if ($items_per_page) {
$data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page);
}
$data = array('settings' => $data, 'params' => array('section_id' => $section_id, 'section_tab_id' => $section_tab_id, 'items_per_page' => $items_per_page, 'page' => $page, 'total_items' => count($data)));
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
示例6: fn_bestsellers_get_products_pre
function fn_bestsellers_get_products_pre(&$params, &$items_per_page, &$lang_code)
{
if (!empty($params['bestsellers'])) {
$params['extend'][] = 'categories';
} elseif (empty($params['sort_by']) || empty($sortings[$params['sort_by']])) {
$default_sorting_params = fn_get_default_products_sorting();
if (!empty($params['sort_by']) && $params['sort_by'] == 'bestsellers' || $default_sorting_params['sort_by'] == 'bestsellers' || isset($params['sales_amount_from']) || isset($params['sales_amount_to'])) {
$params['extend'][] = 'categories';
$params['extend'][] = 'sales';
} elseif (!empty($params['sort_by']) && $params['sort_by'] == 'on_sale' || $default_sorting_params['sort_by'] == 'on_sale') {
$params['extend'][] = 'on_sale';
}
}
if (!empty($params['similar'])) {
$product = Registry::get('view')->getTemplateVars('product');
if (!empty($params['main_product_id'])) {
$params['exclude_pid'] = $params['main_product_id'];
}
if (!empty($params['similar_category']) && $params['similar_category'] == 'Y') {
$params['cid'] = $product['main_category'];
if (!empty($params['similar_subcats']) && $params['similar_subcats'] == 'Y') {
$params['subcats'] = 'Y';
}
}
if (!empty($product['price'])) {
if (!empty($params['percent_range'])) {
$range = $product['price'] / 100 * $params['percent_range'];
$params['price_from'] = $product['price'] - $range;
$params['price_to'] = $product['price'] + $range;
}
}
}
}
示例7: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
General::backupSettings();
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
$payflow_enabled = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')");
if (!empty($payflow_enabled)) {
$payflow_params = unserialize($payflow_enabled);
unset($payflow_params['country']);
$payflow_params['currency'] = 840;
db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')", serialize($payflow_params));
}
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例8: import
public function import($db_already_cloned)
{
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()));
General::processAddons($this->store_data, __CLASS__);
$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::convertPresets403To411();
General::convertScrollerBlocks();
db_query("UPDATE ?:sales_reports_tables SET type = 'P' WHERE type = 'C'");
General::setEmptyProgressBar();
return true;
}
示例9: import
public function import($db_already_cloned)
{
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()));
General::processAddons($this->store_data, __CLASS__);
$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();
if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
}
General::setActualLangValues();
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('ult_language_values', array('name', 'company_id'));
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例10: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
if (!file_exists($filename)) {
fn_set_progress('echo', __('generating_xls'), false);
$header = $data = array();
$currencies = Registry::get('currencies');
$currency = $currencies[CART_SECONDARY_CURRENCY];
$currency_format = '#' . $currency['thousands_separator'] . '##0.' . str_repeat('0', $currency['decimals']);
$currency_format = $currency['after'] == 'Y' ? $currency_format . $currency['symbol'] : $currency['symbol'] . $currency_format;
foreach ($this->selected_fields as $field_id => $field_value) {
$header[$this->price_schema['fields'][$field_id]['title']] = $field_id == 'price' ? $currency_format : 'string';
}
$this->writer->writeSheetHeader($this->sheet, $header);
$this->render();
$this->writer->writeToFile($filename);
}
return $filename;
}
示例11: getCompany
/**
* Gets current company ID
* @param integer $company_id company ID
* @return integer company ID
*/
private static function getCompany($company_id = 0)
{
if (empty($company_id) && Registry::get('runtime.company_id')) {
$company_id = Registry::get('runtime.company_id');
}
return intval($company_id);
}
示例12: 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 -->';
}
}
}
}
示例13: import
public function import($db_already_cloned)
{
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::restoreSettings();
db_query("\n DELETE FROM ?:settings_objects\n WHERE name IN (\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 = 'discussion'\n )\n ");
General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::updateAltLanguages('shipping_service_descriptions', 'service_id');
General::updateAltLanguages('state_descriptions', 'state_id');
General::setEmptyProgressBar();
return true;
}
示例14: index
public function index($id = 0, $params = array())
{
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if (!empty($id)) {
$data = fn_get_category_data($id, $lang_code);
if (empty($data)) {
$status = Response::STATUS_NOT_FOUND;
} else {
$status = Response::STATUS_OK;
}
} else {
if (!empty($params['category_ids']) && is_array($params['category_ids'])) {
$params['item_ids'] = $params['category_ids'];
}
$params['plain'] = $this->safeGet($params, 'plain', true);
$params['simple'] = $this->safeGet($params, 'simple', false);
$params['group_by_level'] = $this->safeGet($params, 'group_by_level', false);
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page'));
$page = $this->safeGet($params, 'page', 1);
list($data, $params) = fn_get_categories($params, $lang_code);
$params['items_per_page'] = $items_per_page;
$params['page'] = $page;
$params['total_items'] = count($data);
if ($items_per_page) {
$data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page);
}
$data = array('categories' => $data, 'params' => $params);
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
示例15: index
public function index($id = 0, $params = array())
{
if (fn_allowed_for('MULTIVENDOR') && $this->auth['user_type'] == 'V' && $this->getParentName() != 'products') {
return array('status' => Response::STATUS_FORBIDDEN);
}
$data = array();
if ($this->getParentName() == 'products') {
$parent_product = $this->getParentData();
$params['object_id'] = $parent_product['product_id'];
$params['object_type'] = 'P';
unset($params['thread_id']);
}
if (!empty($id)) {
$data = $this->getPost($id, $params);
if ($data) {
$status = Response::STATUS_OK;
} else {
$status = Response::STATUS_NOT_FOUND;
}
} else {
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page'));
list($discussions, $search) = fn_get_discussions($params, $items_per_page);
$data = array('discussions' => array_values($discussions), 'params' => $search);
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}