本文整理汇总了PHP中waAppSettingsModel::get方法的典型用法代码示例。如果您正苦于以下问题:PHP waAppSettingsModel::get方法的具体用法?PHP waAppSettingsModel::get怎么用?PHP waAppSettingsModel::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waAppSettingsModel
的用法示例。
在下文中一共展示了waAppSettingsModel::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDomainsSettings
public static function getDomainsSettings()
{
$cache = new waSerializeCache('shopPricePlugin');
if ($cache && $cache->isCached()) {
$domains_settings = $cache->get();
} else {
$app_settings_model = new waAppSettingsModel();
$routing = wa()->getRouting();
$domains_routes = $routing->getByApp('shop');
$app_settings_model->get(shopPricePlugin::$plugin_id, 'domains_settings');
$domains_settings = json_decode($app_settings_model->get(shopPricePlugin::$plugin_id, 'domains_settings'), true);
if (empty($domains_settings)) {
$domains_settings = array();
}
foreach ($domains_routes as $domain => $routes) {
foreach ($routes as $route) {
$domain_route = md5($domain . '/' . $route['url']);
if (empty($domains_settings[$domain_route])) {
$domains_settings[$domain_route] = shopPricePlugin::$default_settings;
}
}
if ($domains_settings && $cache) {
$cache->set($domains_settings);
}
}
}
return $domains_settings;
}
示例2: waAppSettingsModel
/**
*
* @return waInstallerApps
*/
public static function &getInstaller()
{
if (!self::$model) {
self::$model = new waAppSettingsModel();
}
if (!self::$installer) {
self::$installer = new waInstallerApps(self::$model->get('webasyst', 'license', false), wa()->getLocale(), 600, waRequest::get('refresh') ? true : false);
}
return self::$installer;
}
示例3: getDefaultFrom
public static function getDefaultFrom($sender = true)
{
if (!isset(self::$wa_config['from'])) {
$app_settings_model = new waAppSettingsModel();
$email = $app_settings_model->get('webasyst', 'sender');
if ($email) {
self::$wa_config['from'] = array($email => $app_settings_model->get('webasyst', 'name'));
} else {
self::$wa_config['from'] = array();
}
}
return self::$wa_config['from'];
}
示例4: execute
public function execute()
{
$app_settings_model = new waAppSettingsModel();
$background = $app_settings_model->get('webasyst', 'auth_form_background');
$stretch = $app_settings_model->get('webasyst', 'auth_form_background_stretch');
if ($background) {
$background = 'wa-data/public/webasyst/' . $background;
}
$this->view->assign('stretch', $stretch);
$this->view->assign('background', $background);
$this->view->assign('env', wa()->getEnv());
$this->template = wa()->getAppPath('templates/layouts/Login.html', 'webasyst');
}
示例5: load
protected function load()
{
$this->settings = array();
if ($this->name) {
//load settings from database
$settings = self::$model->get($this->name);
foreach ($settings as $field => $value) {
if ($field != 'update_time') {
$this->loadSetting($field, $value);
}
}
}
return $this;
}
示例6: execute
public function execute()
{
$app_settings_model = new waAppSettingsModel();
$settings = $app_settings_model->get(shopDiscountcardsPlugin::$plugin_id);
if (!empty($settings['amounts'])) {
$settings['amounts'] = json_decode($settings['amounts'], true);
} else {
$settings['amounts'] = array();
}
$this->view->assign('settings', $settings);
$templates = array();
foreach ($this->templates as $template_id => $template) {
$tpl_full_path = $template['tpl_path'] . $template['tpl_name'] . '.' . $template['tpl_ext'];
$template_path = wa()->getDataPath($tpl_full_path, $template['public'], 'shop', true);
if (file_exists($template_path)) {
$template['template'] = file_get_contents($template_path);
$template['change_tpl'] = 1;
} else {
$template_path = wa()->getAppPath($tpl_full_path, 'shop');
$template['template'] = file_get_contents($template_path);
$template['change_tpl'] = 0;
}
$templates[$template_id] = $template;
}
$this->view->assign('templates', $templates);
}
示例7: postExecute
public function postExecute($order_id = null, $result = null)
{
$data = parent::postExecute($order_id, $result);
if ($order_id != null) {
$log_model = new waLogModel();
$log_model->add('order_delete', $order_id);
$order_model = new shopOrderModel();
$app_settings_model = new waAppSettingsModel();
if ($data['before_state_id'] != 'refunded') {
$update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
// for logging changes in stocks
shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was deleted', array('order_id' => $order_id));
if ($update_on_create) {
$order_model->returnProductsToStocks($order_id);
} else {
if (!$update_on_create && $data['before_state_id'] != 'new') {
$order_model->returnProductsToStocks($order_id);
}
}
shopProductStocksLogModel::clearContext();
}
$order = $order_model->getById($order_id);
if ($order && $order['paid_date']) {
// Remember paid_date in log params for Restore action
$olpm = new shopOrderLogParamsModel();
$olpm->insert(array('name' => 'paid_date', 'value' => $order['paid_date'], 'order_id' => $order_id, 'log_id' => $data['id']));
// Empty paid_date and update stats so that deleted orders do not affect reports
$order_model->updateById($order_id, array('paid_date' => null, 'paid_year' => null, 'paid_month' => null, 'paid_quarter' => null));
$order_model->recalculateProductsTotalSales($order_id);
shopCustomers::recalculateTotalSpent($order['contact_id']);
}
}
return $data;
}
示例8: execute
public function execute()
{
$messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
installerHelper::checkUpdates($messages);
if ($m = $this->view->getVars('messages')) {
$messages = array_merge($m, $messages);
}
$this->view->assign('messages', $messages);
$plugins = 'wa-plugins/payment';
$apps = wa()->getApps();
if (isset($apps['shop'])) {
$plugins = 'shop';
} else {
ksort($apps);
foreach ($apps as $app => $info) {
if (!empty($info['plugins'])) {
$plugins = $app;
break;
}
}
}
$model = new waAppSettingsModel();
$this->view->assign('update_counter', $model->get($this->getApp(), 'update_counter'));
$this->view->assign('module', waRequest::get('module', 'backend'));
$this->view->assign('default_query', array('plugins' => $plugins));
}
示例9: execute
function execute()
{
try {
$message = array();
$settings = waRequest::get('setting');
if ($settings) {
$model = new waAppSettingsModel();
$changed = false;
foreach ((array) $settings as $setting) {
if (in_array($setting, array('auth_form_background'))) {
if ($value = $model->get('webasyst', $setting)) {
waFiles::delete(wa()->getDataPath($value, true, 'webasyst'));
$message[] = _w('Image deleted');
}
} else {
$changed = true;
}
$model->set('webasyst', $setting, false);
}
if ($changed) {
$message[] = _w('Settings saved');
}
}
$params = array('module' => 'settings', 'msg' => installerMessage::getInstance()->raiseMessage(implode(', ', $message)));
$this->redirect($params);
} catch (waException $ex) {
$msg = installerMessage::getInstance()->raiseMessage($ex->getMessage(), installerMessage::R_FAIL);
$params = array('module' => 'settings', 'msg' => $msg);
$this->redirect($params);
}
}
示例10: postExecute
public function postExecute($order_id = null, $result = null)
{
$data = parent::postExecute($order_id, $result);
if ($order_id != null) {
$log_model = new waLogModel();
$log_model->add('order_restore', $order_id);
$order_model = new shopOrderModel();
$app_settings_model = new waAppSettingsModel();
if ($this->state_id != 'refunded') {
// for logging changes in stocks
shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was restored', array('order_id' => $order_id));
$update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
if ($update_on_create) {
$order_model->reduceProductsFromStocks($order_id);
} else {
if (!$update_on_create && $this->state_id != 'new') {
$order_model->reduceProductsFromStocks($order_id);
}
}
shopProductStocksLogModel::clearContext();
}
$order = $order_model->getById($order_id);
if ($order && $order['paid_date']) {
shopAffiliate::applyBonus($order_id);
shopCustomers::recalculateTotalSpent($order['contact_id']);
}
}
return $data;
}
示例11: getReviews
/**
* Получение и обработка данных об отзывах из кабинета WA
* Получение и обработка идет до тех пор, пока не будут обраотаны либо все страницы
* либо пока не будет найден отзыв который уже есть в БД в таблице wacab_reviews
*/
public function getReviews()
{
$settings_model = new waAppSettingsModel();
$settings = $settings_model->get('wacab');
$model = new wacabReviewModel();
$auth = new wacabWaauth();
$count = 0;
while (true) {
if (!isset($url)) {
$url = 'https://www.webasyst.ru/my/?action=developerReviews';
}
$rvs = wacabReviewsparseController::getReviews($url, $auth);
$url = $rvs[0];
unset($rvs[0]);
foreach ($rvs as $rv) {
$check_rv = array('rv_id' => $rv['rv_id']);
$exist_rv = $model->getByField($check_rv);
if (count($exist_rv) > 0) {
if ($rv['date'] == $exist_rv['date'] && $rv['text'] == $exist_rv['text']) {
break 2;
} else {
$model->updateById($exist_rv['id'], $rv);
$count++;
continue;
}
}
$model->insert($rv);
$count++;
}
if ($url == 'false') {
break;
}
}
return $count;
}
示例12: getPayment
/**
* Получение и обработка данных оп платежах из кабинета WA
* Получение и обработка идет до тех пор, пока не будут обраотаны либо все страницы
* либо пока не будет найден платеж который уже есть в БД в таблице wacab_payments
* @param object wacabWaauth
*/
public function getPayment($auth)
{
$settings_model = new waAppSettingsModel();
$settings = $settings_model->get('wacab');
$model = new wacabPaymentModel();
$count = 0;
while (true) {
if (!isset($url)) {
$url = 'https://www.webasyst.ru/my/?action=checkingaccountInfo&id=' . $settings['account'];
}
$pays = wacabPaymentparseController::getPayments($url, $auth);
$url = $pays[0];
unset($pays[0]);
foreach ($pays as $pay) {
$check_pay = array('date' => $pay['date'], 'order' => $pay['order'], 'description' => $pay['description']);
$exist_pay = $model->getByField($check_pay);
if (count($exist_pay) > 0) {
break 2;
}
/* Привязываем платеж к плагину/приложению */
$pay['type'] = self::checkType($pay);
if ($pay['type'] == 'payin') {
$pay['apps_id'] = self::checkApps($pay);
}
/* EOF Привязываем платеж к плагину/приложению */
$model->insert($pay);
$count++;
}
if ($url == 'false') {
break;
}
}
return $count;
}
示例13: postExecute
public function postExecute($order_id = null, $result = null)
{
$data = parent::postExecute($order_id, $result);
$log_model = new waLogModel();
$log_model->add('order_complete', $order_id);
$order_model = new shopOrderModel();
if (is_array($order_id)) {
$order = $order_id;
$order_id = $order['id'];
} else {
$order = $order_model->getById($order_id);
}
shopCustomers::recalculateTotalSpent($order['contact_id']);
if ($order !== null) {
$log_model = new shopOrderLogModel();
$state_id = $log_model->getPreviousState($order_id);
$app_settings_model = new waAppSettingsModel();
$update_on_create = $app_settings_model->get('shop', 'update_stock_count_on_create_order');
if (!$update_on_create && $state_id == 'new') {
// jump through 'processing' state - reduce
// for logging changes in stocks
shopProductStocksLogModel::setContext(shopProductStocksLogModel::TYPE_ORDER, 'Order %s was completed', array('order_id' => $order_id));
$order_model = new shopOrderModel();
$order_model->reduceProductsFromStocks($order_id);
shopProductStocksLogModel::clearContext();
}
$order_model->recalculateProductsTotalSales($order_id);
}
return $data;
}
示例14: execute
public function execute()
{
try {
$app_settings_model = new waAppSettingsModel();
if (waRequest::post('cancel')) {
wa()->getStorage()->set('shop/discountcard', '');
} else {
if ($discountcard_number = waRequest::post('discountcard')) {
$model = new shopDiscountcardsPluginModel();
if ($app_settings_model->get(shopDiscountcardsPlugin::$plugin_id, 'binding_customer')) {
$contact_id = wa()->getUser()->getId();
$discountcard = $model->getByField(array('contact_id' => $contact_id, 'discountcard' => $discountcard_number));
if (empty($discountcard)) {
$discountcard = $model->getByField(array('contact_id' => 0, 'discountcard' => $discountcard_number));
}
} else {
$discountcard = $model->getByField('discountcard', $discountcard_number);
}
if ($discountcard) {
wa()->getStorage()->set('shop/discountcard', $discountcard['discountcard']);
} else {
throw new waException('Дисконтная карта не найдена');
}
} else {
throw new waException('Укажите номер дисконтной карты');
}
}
} catch (Exception $ex) {
$this->setError($ex->getMessage());
}
}
开发者ID:klxqz,项目名称:discountcards,代码行数:31,代码来源:shopDiscountcardsPluginFrontendDiscountcard.controller.php
示例15: prepareSkus
public static function prepareSkus($skus = array(), $contact_id = null, $currency = null)
{
$app_settings_model = new waAppSettingsModel();
if ($app_settings_model->get(self::$plugin_id, 'status') && shopPrice::getDomainSetting('status')) {
$category_ids = self::getUserCategoryId($contact_id);
$domain_hash = shopPrice::getRouteHash();
$params = array('domain_hash' => $domain_hash, 'category_id' => $category_ids);
$price_model = new shopPricePluginModel();
$prices = $price_model->getPriceByParams($params, true);
if ($prices) {
foreach ($skus as &$sku) {
foreach ($prices as $price) {
$price_field = "price_plugin_{$price['id']}";
if (!empty($sku[$price_field]) && $sku[$price_field] > 0) {
//if (!empty($sku['unconverted_currency']) && !empty($sku['currency'])) {
// $sku['price'] = shop_currency($sku[$price_field], $sku['unconverted_currency'], $sku['currency'], false);
//} else {
if (!$currency) {
$sku['price'] = $sku[$price_field];
} else {
$product_model = new shopProductModel();
$product = $product_model->getById($sku['product_id']);
$sku['price'] = shop_currency($sku[$price_field], $product['currency'], $currency, false);
}
//}
break;
}
}
}
unset($sku);
}
}
return $skus;
}