本文整理汇总了PHP中osCommerce\OM\Core\Registry类的典型用法代码示例。如果您正苦于以下问题:PHP Registry类的具体用法?PHP Registry怎么用?PHP Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute($data) {
$OSCOM_PDO = Registry::get('PDO');
$sql_query = 'select l.*, (select count(*) from :table_languages_definitions ld where ld.languages_id = l.languages_id) as total_definitions from :table_languages l where';
if ( is_numeric($data['id']) ) {
$sql_query .= ' l.languages_id = :languages_id';
} else {
$sql_query .= ' l.code = :code';
}
$sql_query .= ' limit 1';
$Qlanguage = $OSCOM_PDO->prepare($sql_query);
if ( is_numeric($data['id']) ) {
$Qlanguage->bindInt(':languages_id', $data['id']);
} else {
$Qlanguage->bindValue(':code', $data['id']);
}
$Qlanguage->execute();
return $Qlanguage->fetch();
}
示例2: execute
public static function execute(ApplicationAbstract $application)
{
$OSCOM_Shipping = Registry::get('Shipping');
$OSCOM_ShoppingCart = Registry::get('ShoppingCart');
if (!empty($_POST['comments'])) {
$_SESSION['comments'] = HTML::sanitize($_POST['comments']);
}
if ($OSCOM_Shipping->hasQuotes()) {
if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) {
list($module, $method) = explode('_', $_POST['shipping_mod_sel']);
if (Registry::exists('Shipping_' . $module) && Registry::get('Shipping_' . $module)->isEnabled()) {
$quote = $OSCOM_Shipping->getQuote($_POST['shipping_mod_sel']);
if (isset($quote['error'])) {
$OSCOM_ShoppingCart->resetShippingMethod();
} else {
$OSCOM_ShoppingCart->setShippingMethod($quote);
OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
}
} else {
$OSCOM_ShoppingCart->resetShippingMethod();
}
}
} else {
$OSCOM_ShoppingCart->resetShippingMethod();
OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
}
}
示例3: execute
public static function execute(ApplicationAbstract $application)
{
$OSCOM_Database = Registry::get('Database');
$OSCOM_MessageStack = Registry::get('MessageStack');
$Qcheck = $OSCOM_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
$Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1) {
$password = osc_create_random_string(ACCOUNT_PASSWORD);
if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
if (ACCOUNT_GENDER > -1) {
if ($Qcheck->value('customers_gender') == 'm') {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
}
} else {
$email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
}
$email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), osc_get_ip_address(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
$OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success');
}
osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL'));
} else {
$OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found'));
}
}
示例4: install
public function install()
{
$OSCOM_Database = Registry::get('Database');
parent::install();
$OSCOM_Database->simpleQuery("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Entries To Display', 'MODULE_CONTENT_UPCOMING_PRODUCTS_MAX_DISPLAY', '10', 'Maximum number of upcoming products to display', '6', '0', now())");
$OSCOM_Database->simpleQuery("insert into :table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Cache Contents', 'MODULE_CONTENT_UPCOMING_PRODUCTS_CACHE', '1440', 'Number of minutes to keep the contents cached (0 = no cache)', '6', '0', now())");
}
示例5: execute
public static function execute($data)
{
$OSCOM_Database = Registry::get('PDO');
$OSCOM_Database->beginTransaction();
$Qlanguage = $OSCOM_Database->prepare('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id, sort_order = :sort_order where languages_id = :languages_id');
$Qlanguage->bindValue(':name', $data['name']);
$Qlanguage->bindValue(':code', $data['code']);
$Qlanguage->bindValue(':locale', $data['locale']);
$Qlanguage->bindValue(':charset', $data['charset']);
$Qlanguage->bindValue(':date_format_short', $data['date_format_short']);
$Qlanguage->bindValue(':date_format_long', $data['date_format_long']);
$Qlanguage->bindValue(':time_format', $data['time_format']);
$Qlanguage->bindValue(':text_direction', $data['text_direction']);
$Qlanguage->bindInt(':currencies_id', $data['currencies_id']);
$Qlanguage->bindValue(':numeric_separator_decimal', $data['numeric_separator_decimal']);
$Qlanguage->bindValue(':numeric_separator_thousands', $data['numeric_separator_thousands']);
$Qlanguage->bindInt(':parent_id', $data['parent_id']);
$Qlanguage->bindInt(':sort_order', $data['sort_order']);
$Qlanguage->bindInt(':languages_id', $data['id']);
$Qlanguage->execute();
if (!$Qlanguage->isError()) {
if ($data['set_default'] === true) {
$Qupdate = $OSCOM_Database->prepare('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
$Qupdate->bindValue(':configuration_value', $data['code']);
$Qupdate->bindValue(':configuration_key', 'DEFAULT_LANGUAGE');
$Qupdate->execute();
}
$OSCOM_Database->commit();
return true;
}
$OSCOM_Database->rollBack();
return false;
}
示例6: execute
public static function execute($data)
{
$OSCOM_Database = Registry::get('PDO');
$result = array();
$sql_query = 'select SQL_CALC_FOUND_ROWS c.*, count(z.zone_id) as total_zones from :table_countries c left join :table_zones z on (c.countries_id = z.zone_country_id) where (c.countries_name like :countries_name or c.countries_iso_code_2 like :countries_iso_code_2 or c.countries_iso_code_3 like :countries_iso_code_3 or z.zone_name like :zone_name or z.zone_code like :zone_code) group by c.countries_id order by c.countries_name';
if ($data['batch_pageset'] !== -1) {
$sql_query .= ' limit :batch_pageset, :batch_max_results';
}
$sql_query .= '; select found_rows();';
$Qcountries = $OSCOM_Database->prepare($sql_query);
$Qcountries->bindValue(':countries_name', '%' . $data['keywords'] . '%');
$Qcountries->bindValue(':countries_iso_code_2', '%' . $data['keywords'] . '%');
$Qcountries->bindValue(':countries_iso_code_3', '%' . $data['keywords'] . '%');
$Qcountries->bindValue(':zone_name', '%' . $data['keywords'] . '%');
$Qcountries->bindValue(':zone_code', '%' . $data['keywords'] . '%');
if ($data['batch_pageset'] !== -1) {
$Qcountries->bindInt(':batch_pageset', $OSCOM_Database->getBatchFrom($data['batch_pageset'], $data['batch_max_results']));
$Qcountries->bindInt(':batch_max_results', $data['batch_max_results']);
}
$Qcountries->execute();
$result['entries'] = $Qcountries->fetchAll();
$Qcountries->nextRowset();
$result['total'] = $Qcountries->fetchColumn();
return $result;
}
示例7: execute
public static function execute($data) {
$OSCOM_PDO = Registry::get('PDO');
$result = array();
$sql_query = 'select * from :table_customers where ';
if ( isset($data['email_address']) ) {
$sql_query .= 'customers_email_address = :customers_email_address';
} else {
$sql_query .= 'customers_id = :customers_id';
}
$Qcustomer = $OSCOM_PDO->prepare($sql_query);
if ( isset($data['email_address']) ) {
$Qcustomer->bindValue(':customers_email_address', $data['email_address']);
} else {
$Qcustomer->bindInt(':customers_id', $data['id']);
}
$Qcustomer->execute();
if ( $Qcustomer->fetch() !== false ) {
$result = $Qcustomer->toArray();
$result['customers_name'] = $result['customers_firstname'] . ' ' . $result['customers_lastname'];
}
return $result;
}
示例8: start
public static function start()
{
$OSCOM_Service = Registry::get('Service');
Registry::set('RecentlyVisited', new RecentlyVisitedClass());
$OSCOM_Service->addCallBeforePageContent('RecentlyVisited', 'initialize');
return true;
}
示例9: execute
public static function execute() {
$OSCOM_PDO = Registry::get('PDO');
$result = $OSCOM_PDO->query('show server_version')->fetch();
return 'PostgreSQL v' . $result['server_version'];
}
示例10: execute
public static function execute($data) {
$OSCOM_PDO = Registry::get('PDO');
$sql_query = 'select * from :table_currencies where';
if ( is_numeric($data['id']) ) {
$sql_query .= ' currencies_id = :currencies_id';
} else {
$sql_query .= ' code = :code';
}
$sql_query .= ' limit 1';
$Qcurrency = $OSCOM_PDO->prepare($sql_query);
if ( is_numeric($data['id']) ) {
$Qcurrency->bindInt(':currencies_id', $data['id']);
} else {
$Qcurrency->bindValue(':code', $data['id']);
}
$Qcurrency->execute();
return $Qcurrency->fetch();
}
示例11: initialize
public function initialize()
{
$OSCOM_Product = Registry::exists('Product') ? Registry::get('Product') : null;
$OSCOM_PDO = Registry::get('PDO');
$OSCOM_Language = Registry::get('Language');
if (isset($OSCOM_Product) && $OSCOM_Product instanceof \osCommerce\OM\Site\Shop\Product && $OSCOM_Product->isValid()) {
$Qmanufacturer = $OSCOM_PDO->query('select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from :table_manufacturers m left join :table_manufacturers_info mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = :languages_id), :table_products p where p.products_id = :products_id and p.manufacturers_id = m.manufacturers_id');
$Qmanufacturer->bindInt(':languages_id', $OSCOM_Language->getID());
$Qmanufacturer->bindInt(':products_id', $OSCOM_Product->getID());
$Qmanufacturer->execute();
$result = $Qmanufacturer->fetch();
if (!empty($result)) {
$this->_content = '';
if (strlen($result['manufacturers_image']) > 0) {
$this->_content .= '<div style="text-align: center;">' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), HTML::image('public/manufacturers/' . $result['manufacturers_image'], $result['manufacturers_name'])) . '</div>';
}
$this->_content .= '<ol style="list-style: none; margin: 0; padding: 0;">';
if (strlen($result['manufacturers_url']) > 0) {
$this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Redirct', 'Manufacturer=' . $result['manufacturers_id']), sprintf(OSCOM::getDef('box_manufacturer_info_website'), $result['manufacturers_name']), 'target="_blank"') . '</li>';
}
$this->_content .= '<li>' . HTML::link(OSCOM::getLink(null, 'Index', 'Manufacturers=' . $result['manufacturers_id']), OSCOM::getDef('box_manufacturer_info_products')) . '</li>';
$this->_content .= '</ol>';
}
}
}
示例12: uninstall
public function uninstall() {
$OSCOM_PDO = Registry::get('PDO');
$error = false;
$OSCOM_PDO->beginTransaction();
$Qdelete = $OSCOM_PDO->prepare('delete from :table_product_attributes where id = :id');
$Qdelete->bindInt(':id', $this->getID());
$Qdelete->execute();
if ( $Qdelete->isError() ) {
$error = true;
}
if ( $error === false ) {
$Quninstall = $OSCOM_PDO->prepare('delete from :table_templates_boxes where code = :code and modules_group = :modules_group');
$Quninstall->bindValue(':code', $this->getCode());
$Quninstall->bindValue(':modules_group', 'ProductAttribute');
$Quninstall->execute();
if ( $Quninstall->isError() ) {
$error = true;
}
}
if ( $error === false ) {
$OSCOM_PDO->commit();
} else {
$OSCOM_PDO->rollBack();
}
return ( $error === false );
}
示例13: execute
public static function execute($data) {
$OSCOM_PDO = Registry::get('PDO');
$result = array();
$sql_query = 'select * from :table_administrators order by user_name';
if ( $data['batch_pageset'] !== -1 ) {
$sql_query .= ' limit :batch_max_results offset :batch_pageset';
}
$Qadmins = $OSCOM_PDO->prepare($sql_query);
if ( $data['batch_pageset'] !== -1 ) {
$Qadmins->bindInt(':batch_pageset', $OSCOM_PDO->getBatchFrom($data['batch_pageset'], $data['batch_max_results']));
$Qadmins->bindInt(':batch_max_results', $data['batch_max_results']);
}
$Qadmins->execute();
$result['entries'] = $Qadmins->fetchAll();
$Qtotal = $OSCOM_PDO->query('select count(*) from :table_administrators');
$Qtotal->execute();
$result['total'] = $Qtotal->fetchColumn();
return $result;
}
示例14: execute
public static function execute($data)
{
$OSCOM_PDO = Registry::get('PDO');
if (isset($data['key']) && isset($data['value'])) {
$data = array($data);
}
$error = false;
$in_transaction = false;
if (count($data) > 1) {
$OSCOM_PDO->beginTransaction();
$in_transaction = true;
}
$Qcfg = $OSCOM_PDO->prepare('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_key = :configuration_key');
foreach ($data as $d) {
$Qcfg->bindValue(':configuration_value', $d['value']);
$Qcfg->bindValue(':configuration_key', $d['key']);
$Qcfg->execute();
if ($Qcfg->isError()) {
if ($in_transaction === true) {
$OSCOM_PDO->rollBack();
}
$error = true;
break;
}
}
if ($error === false && $in_transaction === true) {
$OSCOM_PDO->commit();
}
return !$error;
}
示例15: execute
public static function execute($data)
{
$OSCOM_Database = Registry::get('PDO');
$OSCOM_Database->beginTransaction();
if (is_numeric($data['id'])) {
$Qcurrency = $OSCOM_Database->prepare('update :table_currencies set title = :title, code = :code, symbol_left = :symbol_left, symbol_right = :symbol_right, decimal_places = :decimal_places, value = :value where currencies_id = :currencies_id');
$Qcurrency->bindInt(':currencies_id', $data['id']);
} else {
$Qcurrency = $OSCOM_Database->prepare('insert into :table_currencies (title, code, symbol_left, symbol_right, decimal_places, value) values (:title, :code, :symbol_left, :symbol_right, :decimal_places, :value)');
}
$Qcurrency->bindValue(':title', $data['title']);
$Qcurrency->bindValue(':code', $data['code']);
$Qcurrency->bindValue(':symbol_left', $data['symbol_left']);
$Qcurrency->bindValue(':symbol_right', $data['symbol_right']);
$Qcurrency->bindInt(':decimal_places', $data['decimal_places']);
$Qcurrency->bindValue(':value', $data['value']);
$Qcurrency->execute();
if (!$Qcurrency->isError()) {
if ($data['set_default'] === true) {
$Qupdate = $OSCOM_Database->prepare('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
$Qupdate->bindValue(':configuration_value', $data['code']);
$Qupdate->bindValue(':configuration_key', 'DEFAULT_CURRENCY');
$Qupdate->execute();
}
$OSCOM_Database->commit();
return true;
}
$OSCOM_Database->rollBack();
return false;
}