本文整理汇总了PHP中waSystem::popActivePlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP waSystem::popActivePlugin方法的具体用法?PHP waSystem::popActivePlugin怎么用?PHP waSystem::popActivePlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waSystem
的用法示例。
在下文中一共展示了waSystem::popActivePlugin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settingsAction
public function settingsAction()
{
$plugin_id = waRequest::get('id', null);
$plugins_count = 0;
$vars = array();
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 = wa()->getApp() . '_' . $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())));
$vars['plugin_info'] = $plugins[$plugin_id];
$vars['plugin_id'] = $plugin_id;
$vars['settings_controls'] = $settings_controls;
}
waSystem::popActivePlugin();
}
$template = $this->getTemplatePath('settings');
$vars['plugins_count'] = $plugins_count;
$this->display($vars, $template);
}
示例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);
}
示例3: 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);
}
示例4: __construct
public function __construct($coupon = array())
{
waLocale::loadByDomain(array('shop', 'coupon'));
waSystem::pushActivePlugin('coupon', 'shop');
$this->data['code'] = ifempty($coupon['code'], '');
$this->data['expire'] = ifempty($coupon['expire_datetime']);
$curm = new shopCurrencyModel();
$currencies = $curm->getAll('code');
$this->data['discount'] = shopCouponPlugin::formatValue($coupon, $currencies);
waSystem::popActivePlugin();
}
示例5: execute
public function execute()
{
$url = waRequest::param('url');
$domain = waRequest::server('HTTP_HOST');
$model = new waModel();
// $main_domain = $model->query("SELECT value FROM wa_app_settings WHERE app_id = 'webasyst' AND name = 'url'")->fetchField();
$app_settings_model = new waAppSettingsModel();
$main_domain = trim(str_replace(array('https', 'http', '://'), '', $app_settings_model->get('webasyst', 'url')), "/");
$data = $model->query("\nSELECT\n shop_deliveryshop_city_description.*\n, shop_deliveryshop_city.city\n, shop_deliveryshop_city.region\nFROM\n shop_deliveryshop_city_description\nLEFT JOIN\n shop_deliveryshop_city ON shop_deliveryshop_city_description.cityCode = shop_deliveryshop_city.cityCode\nLEFT JOIN\n wa_region ON wa_region.code = shop_deliveryshop_city.region AND wa_region.country_iso3='rus'\nWHERE\n (url = '{$url}' OR city = '{$url}')\nAND\n domain IN ('{$domain}', '{$main_domain}')\nLIMIT 1\n ")->fetchAssoc();
// Уменьшаем стоимость доставки на сумму указанную в настройках плагина
$delivery_compensation = $model->query("SELECT price FROM shop_deliveryshop_delivery WHERE domain = '" . $domain . "'")->fetchField();
$delivery_compensation = intval($delivery_compensation);
$delivery_price = intval($data['delivery_price']);
$courier_price = intval($data['courier_price']);
if ($delivery_price > $delivery_compensation) {
$data['delivery_price'] = (int) (($delivery_price - $delivery_compensation) / 50) * 50;
//Уменьшаем до ближайшего полтинника
} else {
$data['delivery_price'] = 0;
}
if ($courier_price > $delivery_compensation) {
$data['courier_price'] = (int) (($courier_price - $delivery_compensation) / 50) * 50;
//Уменьшаем до ближайшего полтинника
} else {
$data['courier_price'] = 0;
}
foreach (array('meta_title' => $main_domain, 'meta_description' => '', 'meta_keywords' => '', 'delivery_time' => '', 'courier_time' => '') as $key => $value) {
$data[$key] = isset($data[$key]) ? $data[$key] : $value;
}
wa()->getResponse()->setTitle($data['meta_title']);
wa()->getResponse()->setMeta('description', $data['meta_description']);
wa()->getResponse()->setMeta('keywords', $data['meta_keywords']);
$city_code = isset($data['cityCode']) ? $data['cityCode'] : 0;
$pvz = $model->query("\nSELECT\n shop_deliveryshop_pvz.*\nFROM\n shop_deliveryshop_pvz\nWHERE\n cityCode = {$city_code}\nAND\n status = 'completed'\nAND\n (domain IN ('{$domain}', '{$main_domain}') OR domain IS NULL)\n")->fetchAll();
//$site_model = new siteDomainModel();
//$domain_id = $site_model->getByName($domain);
$domain_id = $model->query("SELECT id FROM site_domain WHERE name = '" . $domain . "'")->fetchField();
$template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka' . $domain_id . '.html', false, 'shop', true);
if (!file_exists($template_path)) {
$template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', false, 'shop', true);
}
if (!file_exists($template_path)) {
$template_path = wa()->getAppPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', 'shop');
}
$this->view->assign('data', $data);
$this->view->assign('pvz', $pvz);
$this->view->assign('page', array('id' => null, 'name' => '', 'content' => $this->view->fetch($template_path)));
$this->setThemeTemplate('page.html');
waSystem::popActivePlugin();
}
示例6: execute
public function execute()
{
if (!$this->getUser()->isAdmin($this->getApp())) {
throw new waRightsException(_w('Access denied'));
}
$plugin_settings = array();
$plugins = wa()->getConfig()->getPlugins();
if ($this->plugin_id || ($this->plugin_id = waRequest::request('slug', false))) {
if (!isset($plugins[$this->plugin_id]) || !($this->plugin_instance = waSystem::getInstance()->getPlugin($this->plugin_id))) {
throw new waException(_w('Plugin not found', 404));
}
$namespace = $this->getApp() . '_' . $this->plugin_id;
if ($post = $this->getRequest()->post($namespace)) {
$this->plugin_instance->setup($post)->saveSettings();
if (get_class($this) == 'blogPluginsSettingsAction') {
$this->getResponse()->redirect('?module=plugins');
}
}
$params = array();
$params['namespace'] = $namespace;
$params['title_wrapper'] = '<div class="name">%s</div>';
$params['description_wrapper'] = '<br><span class="hint">%s</span><br>';
$params['control_separator'] = '</div><br><div class="value no-shift">';
$params['control_wrapper'] = <<<HTML
%s
<div class="value no-shift">
\t%s
\t%s
</div>
HTML;
$this->view->assign('plugin_settings', $this->plugin_instance->getControls($params));
$this->view->assign('plugin_info', $plugins[$this->plugin_id]);
$this->view->assign('plugin_slug', $this->plugin_id);
$title = sprintf(_w('Plugin %s settings'), $plugins[$this->plugin_id]['name']);
$title .= " — " . wa()->accountName();
$this->view->assign('title', html_entity_decode($title, ENT_NOQUOTES, 'utf-8'));
waSystem::popActivePlugin();
} else {
$this->view->assign('plugin_slug', false);
}
}
示例7: execute
public function execute()
{
if (!$this->getUser()->getRights('shop', 'settings')) {
throw new waException(_w('Access denied'));
}
if ($plugin_id = waRequest::request('id')) {
$plugins = $this->getConfig()->getPlugins();
$plugins_count = count($plugins);
if (isset($plugins[$plugin_id]) && !empty($plugins[$plugin_id]['printform'])) {
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
$namespace = 'printform_' . $plugin_id;
if ($settings = waRequest::post($namespace)) {
$plugin->saveSettings($settings);
$this->view->assign('saved', true);
}
$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>';
$params['subject'] = 'printform';
$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);
if (method_exists($plugin, 'getTemplate')) {
$this->view->assign('template', $plugin->getTemplate());
$this->view->assign('is_template_changed', $plugin->isTemplateChanged());
} else {
$this->view->assign('template', false);
$this->view->assign('is_template_changed', false);
}
}
$this->view->assign('plugins_count', $plugins_count);
waSystem::popActivePlugin();
}
}
示例8: getPlugins
/**
* Returns information about all app's installed plugins as an associative array.
*
* @return array
*/
public function getPlugins()
{
if ($this->plugins === null) {
$locale = wa()->getLocale();
$file = waConfig::get('wa_path_cache') . "/apps/" . $this->application . '/config/plugins.' . $locale . '.php';
if (!file_exists($file) || SystemConfig::isDebug()) {
waFiles::create(waConfig::get('wa_path_cache') . "/apps/" . $this->application . '/config');
// read plugins from file wa-config/[APP_ID]/plugins.php
$path = $this->getConfigPath('plugins.php', true);
if (!file_exists($path)) {
$this->plugins = array();
return $this->plugins;
}
$all_plugins = (include $path);
$this->plugins = array();
foreach ($all_plugins as $plugin_id => $enabled) {
if ($enabled) {
$plugin_config = $this->getPluginPath($plugin_id) . "/lib/config/plugin.php";
if (!file_exists($plugin_config)) {
continue;
}
$plugin_info = (include $plugin_config);
waSystem::pushActivePlugin($plugin_id, $this->application);
// Load plugin locale if it exists
$locale_path = wa()->getAppPath('plugins/' . $plugin_id . '/locale', $this->application);
if (is_dir($locale_path)) {
waLocale::load($locale, $locale_path, wa()->getActiveLocaleDomain(), false);
}
$plugin_info['name'] = _wp($plugin_info['name']);
if (isset($plugin_info['title'])) {
$plugin_info['title'] = _wp($plugin_info['title']);
}
if (isset($plugin_info['description'])) {
$plugin_info['description'] = _wp($plugin_info['description']);
}
waSystem::popActivePlugin();
$plugin_info['id'] = $plugin_id;
$plugin_info['app_id'] = $this->application;
if (isset($plugin_info['img'])) {
$plugin_info['img'] = 'wa-apps/' . $this->application . '/plugins/' . $plugin_id . '/' . $plugin_info['img'];
}
if (isset($plugin_info['rights']) && $plugin_info['rights']) {
$plugin_info['handlers']['rights.config'] = 'rightsConfig';
}
if (isset($plugin_info['frontend']) && $plugin_info['frontend']) {
$plugin_info['handlers']['routing'] = 'routing';
}
if (!empty($plugin_info[$this->application . '_settings'])) {
$plugin_info['custom_settings'] = $plugin_info[$this->application . '_settings'];
}
$this->plugins[$plugin_id] = $plugin_info;
}
}
if (!SystemConfig::isDebug()) {
waUtils::varExportToFile($this->plugins, $file);
} else {
waFiles::delete($file);
}
} else {
$this->plugins = (include $file);
}
}
return $this->plugins;
}
示例9: execute
/** Execute appropriate controller and return it's result.
* Throw 404 exception if no controller found. */
public function execute($plugin = null, $module = null, $action = null, $default = false)
{
if (!$this->system->getConfig()->checkRights($module, $action)) {
throw new waRightsException(_ws("Access denied."));
}
// current app prefix
$prefix = $this->system->getConfig()->getPrefix();
// Load plugin locale and set plugin as active
if ($plugin) {
$plugin_path = $this->system->getAppPath('plugins/' . $plugin, $this->system->getApp());
if (!file_exists($plugin_path . '/lib/config/plugin.php')) {
$plugin = null;
} else {
$plugin_info = (include $plugin_path . '/lib/config/plugin.php');
// check rights
if (isset($plugin_info['rights']) && $plugin_info['rights']) {
if (!$this->system->getUser()->getRights($this->system->getConfig()->getApplication(), 'plugin.' . $plugin)) {
throw new waRightsException(_ws("Access denied"), 403);
}
}
waSystem::pushActivePlugin($plugin, $prefix);
if (is_dir($plugin_path . '/locale')) {
waLocale::load($this->system->getLocale(), $plugin_path . '/locale', waSystem::getActiveLocaleDomain(), false);
}
}
}
// custom login and signup
if (wa()->getEnv() == 'frontend') {
if (!$plugin && !$action && $module == 'login') {
$login_action = $this->system->getConfig()->getFactory('login_action');
if ($login_action) {
$controller = $this->system->getDefaultController();
$controller->setAction($login_action);
$r = $controller->run();
return $r;
}
} elseif (!$plugin && !$action && $module == 'signup') {
$signup_action = $this->system->getConfig()->getFactory('signup_action');
if ($signup_action) {
$controller = $this->system->getDefaultController();
$controller->setAction($signup_action);
$r = $controller->run();
return $r;
}
}
}
//
// Check possible ways to handle the request one by one
//
// list of failed class names (for debugging)
$class_names = array();
// Single Controller (recomended)
$class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . ($action ? ucfirst($action) : '') . 'Controller';
if (class_exists($class_name, true)) {
/**
* @var $controller waController
*/
$controller = new $class_name();
$r = $controller->run();
if ($plugin) {
waSystem::popActivePlugin();
}
return $r;
}
$class_names[] = $class_name;
// Single Action
$class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . ($action ? ucfirst($action) : '') . 'Action';
if (class_exists($class_name)) {
// get default view controller
/**
* @var $controller waDefaultViewController
*/
$controller = $this->system->getDefaultController();
$controller->setAction($class_name);
$r = $controller->run();
if ($plugin) {
waSystem::popActivePlugin();
}
return $r;
}
$class_names[] = $class_name;
// Controller Multi Actions, Zend/Symfony style
$class_name = $prefix . ($plugin ? ucfirst($plugin) . 'Plugin' : '') . ucfirst($module) . 'Actions';
if (class_exists($class_name, true)) {
$controller = new $class_name();
$r = $controller->run($action);
if ($plugin) {
waSystem::popActivePlugin();
}
return $r;
}
$class_names[] = $class_name;
// Plugin is no longer active
if ($plugin) {
waSystem::popActivePlugin();
}
// Last chance: default action for this module
if ($action && $default) {
//.........这里部分代码省略.........