本文整理汇总了PHP中waSystem类的典型用法代码示例。如果您正苦于以下问题:PHP waSystem类的具体用法?PHP waSystem怎么用?PHP waSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了waSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: prepare
protected function prepare()
{
$this->assign('wa_url', $this->system->getRootUrl());
$this->assign('wa_backend_url', waSystem::getInstance()->getConfig()->getBackendUrl(true));
$this->assign('wa_app', $this->system->getApp());
$this->assign('wa_app_url', $this->system->getAppUrl(null, true));
$this->assign('wa_app_static_url', $this->system->getAppStaticUrl());
if (!$this->helper) {
$this->helper = new waViewHelper($this);
}
$this->assign('wa', $this->helper);
}
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:12,代码来源:waView.class.php
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: getDomain
protected function getDomain()
{
if (!$this->domain) {
$this->domain = waSystem::getInstance()->getRouting()->getDomain();
}
return $this->domain;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:siteFrontend.class.php
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: execute
public function execute()
{
$cache = null;
if ($cache_time = $this->getConfig()->getOption('cache_time')) {
//$cache = new waSerializeCache('pages/'.$domain.$url.'page');
}
$page = array();
if ($cache && $cache->isCached()) {
$page = $cache->get();
} else {
$site = new siteFrontend();
if (waRequest::param('error')) {
$page = array();
} else {
$page = $site->getPage(waRequest::param('url', ''));
}
if ($page && $cache) {
$cache->set($page);
}
}
if (!waRequest::isXMLHttpRequest()) {
$this->setLayout(new siteFrontendLayout());
}
try {
$this->executeAction(new siteFrontendAction($page));
} catch (Exception $e) {
if (waSystemConfig::isDebug()) {
echo $e;
} else {
waSystem::setActive('site');
$this->executeAction(new siteFrontendAction($e));
}
}
}
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:siteFrontend.controller.php
示例14: 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
示例15: 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
示例16: 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
示例17: getView
/**
* Initialize $this->view (unless already initialized) and return it.
* @return waSmarty3View
*/
protected function getView()
{
if (!$this->view) {
$this->view = waSystem::getInstance()->getView();
$this->view->assign('action', $this);
}
return $this->view;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:12,代码来源:waWorkflowAction.class.php
示例18: __construct
private function __construct()
{
$this->storage = waSystem::getInstance()->getStorage();
$this->messages = $this->storage->read(__CLASS__);
if (!is_array($this->messages)) {
$this->messages = array();
}
}
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:8,代码来源:installerMessage.class.php
示例19: getCount
public function getCount($id)
{
$row = $this->getByField(array('album_id' => $id, 'contact_id' => waSystem::getInstance()->getUser()->getId()));
if ($row) {
return $row['count'];
}
return null;
}
开发者ID:Lazary,项目名称:webasyst,代码行数:8,代码来源:photosAlbumCount.model.php
示例20: execute
public function execute()
{
$route_id = waRequest::get('route');
$routes = wa()->getRouting()->getRoutes(siteHelper::getDomain());
if (!isset($routes[$route_id])) {
throw new waException('Route not found', 404);
}
$route = $routes[$route_id];
$app_id = $routes[$route_id]['app'];
$path = $this->getConfig()->getAppsPath($app_id, 'lib/config/site.php');
$app = wa()->getAppInfo($app_id);
if (file_exists($path)) {
// load locale of the app
if ($app_id != 'site') {
waSystem::getInstance($app_id)->setActive($app_id);
}
$app['site'] = (include $path);
// return old locale of the site
if ($app_id != 'site') {
waSystem::setActive('site');
}
}
if (isset($app['site']['params'])) {
$params = $this->getParams($route_id, $app['site']['params'], $route);
} else {
$params = array();
}
$themes = siteHelper::getThemes($app_id);
if (!isset($route['theme']) && $themes) {
$route['theme'] = 'default';
}
if (!isset($route['theme_mobile']) && $themes) {
$route['theme_mobile'] = $route['theme'];
}
if (!isset($route['locale'])) {
$route['locale'] = '';
}
if (!isset($route['_name'])) {
if ($app_id == 'site') {
if ($title = siteHelper::getDomain('title')) {
$route['_name'] = $title;
} else {
$app_settings_model = new waAppSettingsModel();
$route['_name'] = $app_settings_model->get('webasyst', 'name', 'Webasyst');
}
} else {
$route['_name'] = $app['name'];
}
}
$this->view->assign('route_id', $route_id);
$this->view->assign('route', $route);
$this->view->assign('params', $params);
$this->view->assign('app_id', $app_id);
$this->view->assign('app', $app);
$this->view->assign('domain_id', siteHelper::getDomainId());
$this->view->assign('domain', siteHelper::getDomain());
$this->view->assign('locales', array('' => _w('Auto')) + waLocale::getAll('name'));
}
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:58,代码来源:siteRoutingEdit.action.php
注:本文中的waSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论