本文整理汇总了PHP中waRequest::param方法的典型用法代码示例。如果您正苦于以下问题:PHP waRequest::param方法的具体用法?PHP waRequest::param怎么用?PHP waRequest::param使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waRequest
的用法示例。
在下文中一共展示了waRequest::param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$action = waRequest::param('action', 'default');
$disable_sidebar = waRequest::param('disable_sidebar', false);
$this->view->assign('action', $action);
$this->view->assign('breadcrumbs', waRequest::param('breadcrumbs', array()));
if (!$this->getResponse()->getTitle()) {
$title = waRequest::param('title') ? waRequest::param('title') : wa()->accountName();
$this->getResponse()->setTitle($title);
}
$this->view->assign('nofollow', waRequest::param('nofollow', false));
$this->view->assign('disable_sidebar', $disable_sidebar);
/**
* Include plugins js and css
* @event frontend_assets
* @return array[string][string]string $return[%plugin_id%] Extra header data (css/js/meta)
*/
$this->view->assign('frontend_assets', wa()->event('frontend_assets'));
/**
* @event frontend_layout
* @return array[string][string]string $return[%plugin_id%]['header'] Header menu section
* @return array[string][string]string $return[%plugin_id%]['footer'] Footer section
*/
$this->view->assign('frontend_layout', wa()->event('frontend_layout'));
/**
* @event frontend_sidebar
* @return array[string][string]string $return[%plugin_id%]['menu'] Sidebar menu item
* @return array[string][string]string $return[%plugin_id%]['section'] Sidebar section item
*/
$this->view->assign('frontend_sidebar', wa()->event('frontend_sidebar'));
$this->setThemeTemplate('index.html');
}
示例2: execute
public function execute()
{
$this->init();
$url = trim(waRequest::param('url', '', waRequest::TYPE_STRING_TRIM), '/');
if (!$url) {
throw new waException(_w('Page not found', 404));
}
$this->route($url);
if (!$this->album) {
throw new waException(_w('Page not found', 404));
}
$this->album = photosFrontendAlbum::escapeFields($this->album);
// retrieve user params
$album_params_model = new photosAlbumParamsModel();
$params = $album_params_model->get($this->album['id']);
$params = photosPhoto::escape($params);
$this->album += $params;
// "childcrumbs" - list of childs (sub-albums). Use in 'plain' template
$childcrumbs = $this->album_model->getChildcrumbs($this->album['id'], true);
waRequest::setParam('breadcrumbs', $this->album_model->getBreadcrumbs($this->album['id'], true));
waRequest::setParam('nofollow', $this->album['status'] <= 0 ? true : false);
waRequest::setParam('disable_sidebar', true);
$this->setThemeTemplate('album.html');
$this->view->assign('album', $this->album);
$this->view->assign('childcrumbs', $childcrumbs);
$this->getResponse()->addJs('js/common.js?v=' . wa()->getVersion(), true);
$this->finite();
}
示例3: dispatch
public function dispatch()
{
$env = $this->system->getEnv();
if ($env == 'frontend') {
$module = 'frontend';
} else {
$module = waRequest::get($this->options['module'], $this->system->getEnv());
}
$module = waRequest::param('module', $module);
$action = waRequest::param('action', waRequest::get($this->options['action']));
$plugin = waRequest::param('plugin', $env == 'backend' ? waRequest::get('plugin', '') : '');
// event init
if (!waRequest::request('background_process')) {
if (method_exists($this->system->getConfig(), 'onInit')) {
$this->system->getConfig()->onInit();
}
}
if ($this->system->getEnv() == 'backend') {
if ($widget = waRequest::get('widget')) {
$this->executeWidget($widget, $action);
} else {
$this->execute($plugin, $module, $action);
}
} else {
$this->execute($plugin, $module, $action);
}
}
示例4: execute
public function execute()
{
$this->setLayout(new shopFrontendLayout());
$product_model = new shopProductModel();
$product = $product_model->getByField('url', waRequest::param('product_url'));
if (!$product) {
throw new waException('Product not found', 404);
}
$product = new shopProduct($product);
$this->getBreadcrumbs($product, true);
$reviews_model = new shopProductReviewsModel();
$reviews = $reviews_model->getFullTree($product['id'], 0, null, 'datetime DESC', array('escape' => true));
$config = wa()->getConfig();
$this->view->assign(array('product' => $product, 'reviews' => $reviews, 'reviews_count' => $reviews_model->count($product['id']), 'reply_allowed' => true, 'auth_adapters' => $adapters = wa()->getAuthAdapters(), 'request_captcha' => $config->getGeneralSettings('require_captcha'), 'require_authorization' => $config->getGeneralSettings('require_authorization')));
$storage = wa()->getStorage();
$current_auth = $storage->read('auth_user_data');
$current_auth_source = $current_auth ? $current_auth['source'] : shopProductReviewsModel::AUTH_GUEST;
$this->view->assign('current_auth_source', $current_auth_source);
$this->view->assign('current_auth', $current_auth, true);
/**
* @event frontend_product
* @param shopProduct $product
* @return array[string][string]string $return[%plugin_id%]['menu'] html output
* @return array[string][string]string $return[%plugin_id%]['cart'] html output
* @return array[string][string]string $return[%plugin_id%]['block_aux'] html output
* @return array[string][string]string $return[%plugin_id%]['block'] html output
*/
$this->view->assign('frontend_product', wa()->event('frontend_product', $product, array('menu', 'cart', 'block_aux', 'block')));
$this->setThemeTemplate('reviews.html');
}
示例5: execute
public function execute()
{
$type = waRequest::param(0);
$types = array('sms', 'payment', 'shipping');
$id = waRequest::param(1);
$params = waRequest::param();
$pattern = '/^[a-z][a-z0-9]*$/';
if (empty($type) || empty($params) || isset($params['help']) || !in_array($type, $types) || !preg_match($pattern, $id)) {
$help = <<<HELP
Usage: php wa.php createSystemPlugin type plugin_id [parameters]
type - Plugin type: shipping, payment, or sms
plugin_id - Plugin id (string in lower case)
Optional parameters:
-name (Plugin name; if comprised of several words, enclose in quotes; e.g., 'My plugin')
-version (Plugin version; e.g., 1.0.0)
-vendor (Numerical vendor id)
-settings (Supports user settings)
Example: php wa.php createSystemPlugin shipping myshipping -name 'My shipping' -version 1.0.0 -vendor 123456
HELP;
print $help . "\n";
} else {
$plugin_path = wa()->getConfig()->getPath('plugins') . '/' . $type . '/' . $id;
$this->create($type, $id, $plugin_path, $params);
}
}
示例6: execute
public function execute()
{
$blog_id = wa()->getRequest()->param('blog_url_type');
if ($blog_id <= 0) {
$blog_id = waRequest::request('blog_id', 0, 'int');
}
$this->setLayout(new blogFrontendLayout());
// Get contact id and name as post author
if (wa()->getUser()->get('is_user')) {
$post_contact_id = wa()->getUser()->getId();
$post_contact_name = wa()->getUser()->getName();
} else {
foreach (blogHelper::getAuthors($blog_id) as $post_contact_id => $post_contact_name) {
break;
}
}
// Prepare empty fake post data
$post_model = new blogPostModel();
$post = $post_model->prepareView(array(array('id' => 0, 'blog_id' => $blog_id, 'contact_id' => $post_contact_id, 'contact_name' => $post_contact_name, 'datetime' => date('Y-m-d H:i:s'), 'title' => '%replace-with-real-post-title%', 'status' => 'published', 'text' => '<div class="replace-with-real-post-text"></div>' . $this->getScripts(), 'comments_allowed' => 0) + $post_model->getEmptyRow()));
$post = array_merge($post[0], array('comments' => array(), 'comment_link' => '', 'link' => ''));
$this->getResponse()->setTitle(_w('Preview'));
$this->getResponse()->setMeta('keywords', '');
$this->getResponse()->setMeta('description', '');
$current_auth = wa()->getStorage()->read('auth_user_data');
$current_auth_source = $current_auth ? $current_auth['source'] : null;
$this->view->assign(array('realtime_preview' => true, 'frontend_post' => array(), 'errors' => array(), 'form' => array(), 'show_comments' => false, 'request_captcha' => false, 'require_authorization' => false, 'theme' => waRequest::param('theme', 'default'), 'current_auth_source' => $current_auth_source, 'current_auth' => $current_auth, true, 'auth_adapters' => wa()->getAuthAdapters(), 'post' => $post));
}
示例7: execute
public function execute()
{
$f = waRequest::param('f');
$fid = waRequest::param('fid', waRequest::post('fid'));
$prefix = waRequest::param('prefix', waRequest::post('prefix', 'options'));
$full_parent = waRequest::param('parent', waRequest::post('parent', null));
$parent = explode('.', $full_parent);
$parent = $parent[0];
$new_field = false;
if ($f && $f instanceof waContactField) {
$ftype = $f->getType();
if ($ftype == 'Select') {
if ($f instanceof waContactBranchField) {
$ftype = 'branch';
} else {
if ($f instanceof waContactRadioSelectField) {
$ftype = 'radio';
}
}
}
} else {
$ftype = strtolower(waRequest::param('ftype', waRequest::post('ftype', 'string')));
$f = self::getField($fid, $ftype);
$new_field = true;
}
$ftype = strtolower($ftype);
$this->view->assign('f', $f);
$this->view->assign('fid', $fid);
$this->view->assign('ftype', $ftype);
$this->view->assign('prefix', $prefix);
$this->view->assign('parent', $parent);
$this->view->assign('uniqid', 'fe_' . uniqid());
$this->view->assign('new_field', $new_field);
}
示例8: execute
public function execute()
{
$e = $this->getRequest()->param('exception');
if ($e && $e instanceof Exception) {
/**
* @var Exception $e
*/
$code = $e->getCode();
if (!$code) {
$code = 500;
}
$message = $e->getMessage();
} else {
$code = 404;
$message = _ws("Page not found");
}
$this->getResponse()->setStatus($code);
$this->getResponse()->setTitle(htmlentities($code . '. ' . $message, ENT_QUOTES, 'utf-8'));
$this->view->assign('error_code', $code);
$this->view->assign('error_message', $message);
if ($code == 404) {
$this->setLayout(new blogFrontendLayout());
}
$this->setThemeTemplate('error.html', waRequest::param('theme', 'default'));
}
示例9: execute
public function execute()
{
$this->init();
$type = waRequest::param('type');
$this->hash = waRequest::param('hash');
if ($type == 'tag') {
$this->view->assign('criteria', 'by-tag');
$this->view->assign('tag', waRequest::param('tag'));
} else {
if ($type == 'favorites') {
$this->view->assign('criteria', 'favorites');
}
}
if (in_array($type, array('author', 'search', 'tag', 'favorites', 'id'))) {
waRequest::setParam('disable_sidebar', true);
$template = 'search.html';
} else {
$template = 'home.html';
if (!file_exists($this->getTheme()->getPath() . '/' . $template)) {
$template = 'view-thumbs.html';
// for backward compatibility reason
}
}
if ($type != 'all' && $type != 'favorites') {
waRequest::setParam('nofollow', true);
}
$layout = $this->getLayout();
if ($layout) {
$layout->assign('hash', $this->hash);
}
$this->setThemeTemplate($template);
$this->finite();
}
示例10: execute
public function execute()
{
$this->getResponse()->addJs("js/jquery.pageless2.js?v=" . wa()->getVersion(), true);
$this->view->assign('site_theme_url', wa()->getDataUrl('themes', true, 'site') . '/' . waRequest::param('theme', 'default') . '/');
$this->view->assign('action', $action = waRequest::param('action', 'default'));
waRequest::setParam('action', $action);
$params = waRequest::param();
/**
* @event frontend_action_default
* @event frontend_action_post
* @event frontend_action_page
* @event frontend_action_error
* @param array[string]mixed $params request params
* @return array[string][string]string $return['%plugin_id%']
* @return array[string][string]string $return['%plugin_id%'][nav_before]
* @return array[string][string]string $return['%plugin_id%'][footer]
* @return array[string][string]string $return['%plugin_id%'][head]
* @return array[string][string]string $return['%plugin_id%'][sidebar]
*/
$this->view->assign('settlement_one_blog', isset($params['blog_id']) && $params['blog_url_type'] == $params['blog_id']);
$this->view->assign('frontend_action', $res = wa()->event('frontend_action_' . $action, $params));
if (!$this->view->getVars('links')) {
$this->view->assign('links', array());
}
$this->setThemeTemplate('index.html');
}
示例11: 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));
}
}
}
示例12: execute
public function execute()
{
$app_id = waRequest::param(0);
$params = waRequest::param();
if (empty($app_id) || isset($params['help'])) {
$help = <<<HELP
Usage: php wa.php createApp [app_id] [parameters]
app_id - App id (string in lower case)
Optional parameters:
-name (App name; if comprised of several words, enclose in quotes; e.g., 'My app')
-version (App version; e.g., 1.0.0)
-vendor (Numerical vendor id)
-frontend (Has frontend)
-themes (Supports design themes)
-plugins (Supports plugins)
-cli (Has CLI handlers)
-api (Has API)
Example: php wa.php createApp myapp -name 'My app' -version 1.0.0 -vendor 123456 -frontend -themes -plugins -cli -api
HELP;
print $help . "\n";
} else {
$errors = array();
if (!empty($params['version']) && !preg_match('@^[\\d]+(\\.\\d+)*$@', $params['version'])) {
$errors[] = 'Invalid version format';
}
if ($errors) {
print "ERROR:\n";
print implode("\n", $errors);
} else {
$app_path = wa()->getAppPath(null, $app_id);
$this->create($app_id, $app_path, $params);
}
}
}
示例13: dispatch
public function dispatch()
{
if ($this->system->getEnv() == 'frontend') {
$module = 'frontend';
} else {
$module = waRequest::get($this->options['module'], $this->system->getEnv());
}
$module = waRequest::param('module', $module);
$action = waRequest::param('action', waRequest::get($this->options['action']));
$plugin = waRequest::param('plugin', waRequest::get('plugin', ''));
// event init
if (!waRequest::request('background_process')) {
if (method_exists($this->system->getConfig(), 'onInit')) {
$this->system->getConfig()->onInit();
}
}
if ($widget = waRequest::param('widget')) {
$this->executeWidget($widget, $action);
} elseif ($this->system->getEnv() == 'backend') {
$url = explode("/", $this->system->getConfig()->getRequestUrl(true));
if (isset($url[2]) && isset($url[3]) && $url[2] == 'widgets') {
$this->executeWidget($url[3], $action);
} else {
$this->execute($plugin, $module, $action);
}
} else {
$this->execute($plugin, $module, $action);
}
}
示例14: execute
public function execute()
{
// Setting the frontend layout
// Задаём лайаут для фронтенда
$this->setLayout(new guestbook2FrontendLayout());
// Setting the theme template
// Задаём шаблон темы
$this->setThemeTemplate('guestbook.html');
// if a POST request has been received then write a new record to the database
// Если пришёл POST-запрос, то нужно записать в БД новую запись
if (waRequest::method() == 'post') {
$this->add();
}
// Creating a model instance for retrieving data from the database
// Создаем экземпляр модели для получения данных из БД
$model = new guestbook2Model();
// Retrieving the record count per page from the app's settings
// Получаем количество записей на одной странице из настроек приложения
$limit = $this->getConfig()->getOption('records_per_page');
// Current page
// Текущая страница
$page = waRequest::param('page');
if (!$page) {
$page = 1;
}
$this->view->assign('page', $page);
// Calculating offset
// Вычисляем смещение
$offset = ($page - 1) * $limit;
// Retrieving all records from the database
// Получаем записи гостевой книги из БД
$records = $model->getRecords($offset, $limit);
// Total record count
// Всего записей
$records_count = $model->countAll();
$pages_count = ceil($records_count / $limit);
$this->view->assign('pages_count', $pages_count);
// Preparing records for being passed to the theme template
// Подготавливаем записи для передачи в шаблон темы
foreach ($records as &$r) {
if ($r['contact_id']) {
$r['name'] = htmlspecialchars($r['contact_name']);
// getting contact photo URL
// получаем URL на фотографию контакта
$r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
} else {
$r['name'] = htmlspecialchars($r['name']);
}
$r['text'] = nl2br(htmlspecialchars($r['text']));
}
unset($r);
// Passing records to the template
// Передаем записи в шаблон
$this->view->assign('records', $records);
// URL portion for links to pages
// Часть урла для ссылок на страницы
$this->view->assign('url', wa()->getRouteUrl('/frontend'));
}
示例15: execute
public function execute()
{
$code = waRequest::param('code');
$encoded_order_id = waRequest::param('id');
$order_id = shopHelper::decodeOrderId($encoded_order_id);
if (!$order_id) {
// fall back to non-encoded id
$order_id = $encoded_order_id;
$encoded_order_id = shopHelper::encodeOrderId($order_id);
}
if (!$order_id || $order_id != substr($code, 16, -16)) {
throw new waException(_w('Order not found'), 404);
}
// When user is authorized, check if order belongs to him.
// When it does, redirect to plain order page.
if (wa()->getUser()->isAuth()) {
$om = new shopOrderModel();
$order = $om->getOrder($order_id);
if (!$order) {
throw new waException(_w('Order not found'), 404);
}
if ($order['contact_id'] == wa()->getUser()->getId()) {
$this->redirect(wa()->getRouteUrl('/frontend/myOrder', array('id' => $order_id)));
}
}
// Check auth code
$opm = new shopOrderParamsModel();
$params = $opm->get($order_id);
if (ifset($params['auth_code']) !== $code || empty($params['auth_pin'])) {
throw new waException(_w('Order not found'), 404);
}
// Check auth pin and show order page if pin is correct
$pin = waRequest::request('pin', wa()->getStorage()->get('shop/pin/' . $order_id));
if ($pin && $pin == $params['auth_pin']) {
wa()->getStorage()->set('shop/pin/' . $order_id, $pin);
parent::execute();
if (!waRequest::isXMLHttpRequest()) {
$this->layout->assign('breadcrumbs', self::getBreadcrumbs());
}
return;
}
//
// No pin or pin is incorrect: show form to enter pin
//
$this->view->assign('wrong_pin', !!$pin);
$this->view->assign('pin_required', true);
$this->view->assign('encoded_order_id', $encoded_order_id);
$this->view->assign('my_nav_selected', 'orders');
// Set up layout and template from theme
$this->setThemeTemplate('my.order.html');
if (!waRequest::isXMLHttpRequest()) {
$this->setLayout(new shopFrontendLayout());
$this->getResponse()->setTitle(_w('Order') . ' ' . $encoded_order_id);
$this->view->assign('breadcrumbs', self::getBreadcrumbs());
$this->layout->assign('nofollow', true);
}
}