当前位置: 首页>>代码示例>>PHP>>正文


PHP waSystem::getInstance方法代码示例

本文整理汇总了PHP中waSystem::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP waSystem::getInstance方法的具体用法?PHP waSystem::getInstance怎么用?PHP waSystem::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在waSystem的用法示例。


在下文中一共展示了waSystem::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $order_id = waRequest::post('order_id', null, waRequest::TYPE_INT);
     if ($order_id) {
         $order_model = new shopOrderModel();
         $order = $order_model->getOrder($order_id);
         $customer_model = new shopCustomerModel();
         $customer = $customer_model->getById($order['contact_id']);
         $customer_model->updateById($order['contact_id'], array('is_spamer' => 1));
         $plugin = waSystem::getInstance()->getPlugin('orderantispam');
         $action_id = $plugin->getSettings('action_id');
         $workflow = new shopWorkflow();
         $action = $workflow->getActionById($action_id);
         $action->run($order_id);
         // counters
         $state_counters = $order_model->getStateCounters();
         $pending_counters = (!empty($state_counters['new']) ? $state_counters['new'] : 0) + (!empty($state_counters['processing']) ? $state_counters['processing'] : 0) + (!empty($state_counters['paid']) ? $state_counters['paid'] : 0);
         // update app coutner
         wa('shop')->getConfig()->setCount($state_counters['new']);
         $script = "<script>";
         $script .= "\$.order_list.updateCounters(" . json_encode(array('state_counters' => $state_counters, 'common_counters' => array('pending_counters' => $pending_counters))) . ");";
         $script .= "\$.order.reload();</script>";
         $this->response['script'] = $script;
     }
 }
开发者ID:klxqz,项目名称:orderantispam,代码行数:25,代码来源:shopOrderantispamPluginBackendSpamerOrder.controller.php

示例2: display

 public function display(array $data, $template = null, $return = false)
 {
     $view = waSystem::getInstance()->getView();
     if ($template === null) {
         $template = ucfirst($this->action);
     }
     if (strpbrk($template, '/:') === false) {
         $match = array();
         preg_match("/[A-Z][^A-Z]+/", get_class($this), $match);
         $template = $this->getPluginRoot() . 'templates/actions/' . strtolower($match[0]) . "/" . $match[0] . $template . $view->getPostfix();
     }
     // assign vars
     $view->assign($data);
     if ($this->layout && $this->layout instanceof waLayout) {
         // assign result to layout
         $this->layout->setBlock('content', $view->fetch($template));
         $this->layout->display();
     } else {
         // send headers
         $this->getResponse()->sendHeaders();
         // display
         if ($return) {
             return $view->fetch($template);
         } else {
             $view->display($template);
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:28,代码来源:waActions.class.php

示例3: execute

 protected function execute($app, $method_name)
 {
     if ($format = waRequest::get('format')) {
         $format = strtoupper($format);
         if (!in_array($format, array('JSON', 'XML'))) {
             $this->response(array('error' => 'invalid_request', 'error_description' => 'Invalid response format: ' . $format));
             return;
         }
         $this->format = $format;
     }
     // check access token and scope
     $token = $this->checkToken();
     // check app access
     if (!waSystem::getInstance()->appExists($app)) {
         throw new waAPIException('invalid_request', 'Application ' . $app . ' not exists');
     }
     // check scope
     $scope = explode(',', $token['scope']);
     if (!in_array($app, $scope)) {
         throw new waAPIException('access_denied', 403);
     }
     // init app
     waSystem::getInstance($app, null, true);
     $class_name = $app . implode('', array_map('ucfirst', explode('.', $method_name))) . "Method";
     if (!class_exists($class_name)) {
         throw new waAPIException('invalid_method', 'Unknown method: ' . $app . '.' . htmlspecialchars($method_name), 404);
     }
     /**
      * Execute method of the API
      * @var waAPIMethod $method
      */
     $method = new $class_name();
     $this->response($method->getResponse());
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:waAPIController.class.php

示例4: load

 public function load($locale, $locale_path, $domain, $textdomain = true)
 {
     $file = $locale_path . '/' . $locale . '/LC_MESSAGES/' . $domain . '.po';
     $cache_file = waSystem::getInstance()->getConfig()->getPath('cache') . '/apps/' . $domain . '/locale/' . $locale . '.php';
     if (isset(self::$cache[$locale][$domain])) {
     } elseif (!file_exists($file)) {
         self::$cache[$locale][$domain] = array();
     } elseif (file_exists($cache_file) && filemtime($cache_file) > filemtime($file)) {
         self::$cache[$locale][$domain] = (include $cache_file);
     } else {
         if (file_exists($file)) {
             $gettext = new waGettext($file);
             self::$cache[$locale][$domain] = $gettext->read();
         } else {
             self::$cache[$locale][$domain] = array();
         }
         waFiles::create($cache_file);
         waUtils::varExportToFile(self::$cache[$locale][$domain], $cache_file);
     }
     if (isset(self::$cache[$locale][$domain]['meta']['Plural-Forms']['plural']) && self::$cache[$locale][$domain]['meta']['Plural-Forms']['plural']) {
         self::$cache[$locale][$domain]['meta']['f'] = create_function('$n', self::$cache[$locale][$domain]['meta']['Plural-Forms']['plural']);
     }
     if ($textdomain) {
         self::$domain = $domain;
         self::$locale = $locale;
     }
     if (!self::$locale) {
         self::$locale = $locale;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:30,代码来源:waLocalePHPAdapter.class.php

示例5: getView

 private static function getView()
 {
     if (!isset(self::$view)) {
         self::$view = waSystem::getInstance()->getView();
     }
     return self::$view;
 }
开发者ID:itfrogs,项目名称:wa-wacab,代码行数:7,代码来源:wacabAppsDelete.controller.php

示例6: removeExtras

 protected function removeExtras($app_id, $extras_id, $info)
 {
     try {
         $paths = array();
         $plugin_instance = waSystem::getInstance($app_id)->getPlugin($extras_id);
         if (!$plugin_instance) {
             return false;
         }
         $plugin_instance->uninstall();
         $this->installer->updateAppPluginsConfig($app_id, $extras_id, null);
         //wa-apps/$app_id/plugins/$slug
         $paths[] = wa()->getAppPath("{$this->extras_type}/{$extras_id}", $app_id);
         $paths[] = wa()->getTempPath(null, $app_id);
         //wa-cache/temp/$app_id/
         $paths[] = wa()->getAppCachePath(null, $app_id);
         //wa-cache/apps/$app_id/
         foreach ($paths as $path) {
             waFiles::delete($path, true);
         }
         return true;
     } catch (Exception $ex) {
         //TODO check config
         $this->installer->updateAppPluginsConfig($app_id, $extras_id, true);
         throw $ex;
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:26,代码来源:installerPluginsRemove.action.php

示例7: execute

 public function execute()
 {
     $plugin_id = waRequest::get('id');
     if (!$plugin_id) {
         throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
     }
     $namespace = 'photos_' . $plugin_id;
     /**
      * @var photosPlugin $plugin
      */
     $plugin = waSystem::getInstance()->getPlugin($plugin_id);
     $settings = (array) $this->getRequest()->post($namespace);
     $files = waRequest::file($namespace);
     $settings_defenitions = $plugin->getSettings();
     foreach ($files as $name => $file) {
         if (isset($settings_defenitions[$name])) {
             $settings[$name] = $file;
         }
     }
     try {
         $plugin->saveSettings($settings);
     } catch (Exception $e) {
         $this->errors = $e->getMessage();
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:25,代码来源:photosPluginsSave.controller.php

示例8: init

 public function init($options = null)
 {
     $cookie_defaults = session_get_cookie_params();
     if (!isset($options['session_cookie_path']) && class_exists("waSystem")) {
         $options['session_cookie_path'] = waSystem::getInstance()->getRootUrl();
     }
     $options = array_merge(array('session_id' => null, 'auto_start' => true, 'session_cookie_lifetime' => $cookie_defaults['lifetime'], 'session_cookie_path' => $cookie_defaults['path'], 'session_cookie_domain' => $cookie_defaults['domain'], 'session_cookie_secure' => $cookie_defaults['secure'], 'session_cookie_httponly' => true, 'session_cache_limiter' => 'none'), $options);
     // initialize parent
     parent::init($options);
     if (isset($this->options['session_name'])) {
         session_name($this->options['session_name']);
     }
     if (!(bool) ini_get('session.use_cookies') && ($session_id = $this->options['session_id'])) {
         session_id($session_id);
     }
     $lifetime = $this->options['session_cookie_lifetime'];
     $path = $this->options['session_cookie_path'];
     $domain = $this->options['session_cookie_domain'];
     $secure = $this->options['session_cookie_secure'];
     $http_only = $this->options['session_cookie_httponly'];
     session_set_cookie_params($lifetime, $path, $domain, $secure, $http_only);
     if (null !== $this->options['session_cache_limiter']) {
         session_cache_limiter($this->options['session_cache_limiter']);
     }
     if ($this->options['auto_start']) {
         if (isset($_COOKIE[session_name()])) {
             $this->open();
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:30,代码来源:waSessionStorage.class.php

示例9: execute

 public function execute()
 {
     $plugin_id = waRequest::get('id', null);
     $plugins_count = 0;
     if ($plugin_id) {
         $plugins = $this->getConfig()->getPlugins();
         $plugins_count = count($plugins);
         if (isset($plugins[$plugin_id])) {
             /**
              * @var photosPlugin $plugin
              */
             $plugin = waSystem::getInstance()->getPlugin($plugin_id);
             waSystem::pushActivePlugin($plugin_id, 'photos');
             $namespace = 'photos_' . $plugin_id;
             $params = array();
             $params['id'] = $plugin_id;
             $params['namespace'] = $namespace;
             $params['title_wrapper'] = '%s';
             $params['description_wrapper'] = '<br><span class="hint">%s</span>';
             $params['control_wrapper'] = '<div class="name">%s</div><div class="value">%s %s</div>';
             $settings_controls = $plugin->getControls($params);
             $this->getResponse()->setTitle(_w(sprintf('Plugin %s settings', $plugin->getName())));
             $this->view->assign('plugin_info', $plugins[$plugin_id]);
             $this->view->assign('plugin_id', $plugin_id);
             $this->view->assign('settings_controls', $settings_controls);
             waSystem::popActivePlugin();
         }
     }
     $this->view->assign('plugins_count', $plugins_count);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:30,代码来源:photosPluginsSettings.action.php

示例10: execute

 public function execute()
 {
     if (!$this->getUser()->getRights('shop', 'settings')) {
         throw new waException(_w('Access denied'));
     }
     $plugin_id = waRequest::get('id', null);
     $plugins_count = 0;
     if ($plugin_id) {
         $plugins = $this->getConfig()->getPlugins();
         $plugins_count = count($plugins);
         if (isset($plugins[$plugin_id])) {
             /**
              * @var shopPlugin $plugin
              */
             $plugin = waSystem::getInstance()->getPlugin($plugin_id, true);
             $namespace = 'shop_' . $plugin_id;
             $params = array();
             $params['id'] = $plugin_id;
             $params['namespace'] = $namespace;
             $params['title_wrapper'] = '%s';
             $params['description_wrapper'] = '<br><span class="hint">%s</span>';
             $params['control_wrapper'] = '<div class="name">%s</div><div class="value">%s %s</div>';
             $settings_controls = $plugin->getControls($params);
             $this->getResponse()->setTitle(_w(sprintf('Plugin %s settings', $plugin->getName())));
             $this->view->assign('plugin_info', $plugins[$plugin_id]);
             $this->view->assign('plugin_id', $plugin_id);
             $this->view->assign('settings_controls', $settings_controls);
         }
         waSystem::popActivePlugin();
     }
     $this->view->assign('plugins_count', $plugins_count);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:32,代码来源:shopPluginsSettings.action.php

示例11: getDomain

 protected function getDomain()
 {
     if (!$this->domain) {
         $this->domain = waSystem::getInstance()->getRouting()->getDomain();
     }
     return $this->domain;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:siteFrontend.class.php

示例12: execute

 public function execute()
 {
     if (!$this->getUser()->getRights('shop', 'settings')) {
         throw new waException(_w('Access denied'));
     }
     $plugin_id = waRequest::get('id');
     if (!$plugin_id) {
         throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
     }
     $namespace = 'shop_' . $plugin_id;
     /**
      * @var shopPlugin $plugin
      */
     $plugin = waSystem::getInstance()->getPlugin($plugin_id);
     $settings = (array) $this->getRequest()->post($namespace);
     $files = waRequest::file($namespace);
     $settings_defenitions = $plugin->getSettings();
     foreach ($files as $name => $file) {
         if (isset($settings_defenitions[$name])) {
             $settings[$name] = $file;
         }
     }
     try {
         $this->response = $plugin->saveSettings($settings);
         $this->response['message'] = _w('Saved');
     } catch (Exception $e) {
         $this->setError($e->getMessage());
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:29,代码来源:shopPluginsSave.controller.php

示例13: __construct

 public function __construct($options = array())
 {
     $this->system = waSystem::getInstance();
     foreach ($options as $k => $v) {
         $this->options[$k] = $v;
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:7,代码来源:waFrontController.class.php

示例14: saveAction

 public function saveAction()
 {
     $plugin_id = waRequest::get('id');
     if (!$plugin_id) {
         throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
     }
     $namespace = $this->getAppId() . '_' . $plugin_id;
     /**
      * @var shopPlugin $plugin
      */
     $plugin = waSystem::getInstance()->getPlugin($plugin_id);
     $settings = (array) $this->getRequest()->post($namespace);
     $files = waRequest::file($namespace);
     $settings_defenitions = $plugin->getSettings();
     foreach ($files as $name => $file) {
         if (isset($settings_defenitions[$name])) {
             $settings[$name] = $file;
         }
     }
     try {
         $response = $plugin->saveSettings($settings);
         $response['message'] = _w('Saved');
         $this->displayJson($response);
     } catch (Exception $e) {
         $this->setError($e->getMessage());
         $this->displayJson(array(), $e->getMessage());
     }
 }
开发者ID:Rupreht,项目名称:webasyst-framework,代码行数:28,代码来源:waPlugins.actions.php

示例15: getItems

 protected function getItems($app_id, &$link = null)
 {
     $old_app = wa()->getApp();
     if ($old_app != $app_id) {
         waSystem::getInstance($app_id, null, true);
     }
     $class_name = $app_id . 'MyNavAction';
     $result = array();
     if (class_exists($class_name)) {
         /**
          * @var waViewAction $action
          */
         try {
             $action = new $class_name();
             wa()->getView()->assign('my_nav_selected', '');
             $html = $action->display();
             $link = '';
             if (preg_match_all('/<li.*?>(.*?)<\\/li>/uis', $html, $match)) {
                 foreach ($match[1] as $m) {
                     if (!$link && preg_match('/href="(.*?)"/uis', $m, $link_m)) {
                         $link = $link_m[1];
                     }
                     $result[] = trim(strip_tags($m));
                 }
             }
         } catch (Exception $e) {
         }
     }
     if ($old_app != $app_id) {
         wa()->setActive($old_app);
     }
     return $result;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:33,代码来源:sitePersonal.action.php


注:本文中的waSystem::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。