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


PHP waRequest::setParam方法代码示例

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


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

示例1: 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');
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:26,代码来源:blogFrontend.layout.php

示例2: initRouting

 private function initRouting()
 {
     $routing = wa()->getRouting();
     $app_id = $this->getAppId();
     $domain_routes = $routing->getByApp($app_id);
     $success = false;
     foreach ($domain_routes as $domain => $routes) {
         foreach ($routes as $route) {
             if ($domain . '/' . $route['url'] == $this->data['domain']) {
                 $routing->setRoute($route, $domain);
                 $this->data['type_id'] = ifempty($route['type_id'], array());
                 if ($this->data['type_id']) {
                     $this->data['type_id'] = array_map('intval', $this->data['type_id']);
                 }
                 waRequest::setParam($route);
                 $this->data['base_url'] = parse_url('http://' . preg_replace('@https?://@', '', $domain), PHP_URL_HOST);
                 $success = true;
                 break;
             }
         }
     }
     if (!$success) {
         throw new waException('Error while select routing');
     }
     $app_settings_model = new waAppSettingsModel();
     $this->data['app_settings'] = array('ignore_stock_count' => $app_settings_model->get($app_id, 'ignore_stock_count', 0));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:_shopYandexmarketPluginRun.controller.php

示例3: 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();
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:33,代码来源:photosFrontend.action.php

示例4: 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();
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:28,代码来源:photosFrontendAlbum.action.php

示例5: execute

 public function execute()
 {
     $url = waRequest::param('url');
     $this->album = waRequest::param('album');
     $this->hash = waRequest::param('hash');
     if (!$url) {
         throw new waException(_w('Page not found', 404));
     }
     $this->photo_model = new photosPhotoModel();
     $this->photo = $this->getPhoto($url);
     if (!$this->photo) {
         throw new waException(_w('Page not found'), 404);
     }
     $this->photo = photosPhoto::escapeFields($this->photo);
     if ($this->album && $this->album['status'] <= 0) {
         $this->album['full_url'] = photosCollection::frontendAlbumHashToUrl($this->hash);
     }
     // delegate work to special render helper
     $render_helper = new photosPhotoRenderHelper($this->photo, $this->private_hash);
     $result = $render_helper->workUp(array('album' => $this->album, 'hash' => $this->hash));
     waRequest::setParam('title', $this->photo['name']);
     waRequest::setParam('nofollow', $this->isNeedNofollow());
     waRequest::setParam('breadcrumbs', $this->getBreadcrumbs());
     waRequest::setParam('disable_sidebar', true);
     // pull out work's up result
     $this->view->assign('photo', $result['photo']);
     $this->view->assign('albums', $result['blocks']['albums']);
     $this->view->assign('tags', $result['blocks']['tags']);
     $this->view->assign('exif', $result['blocks']['exif']);
     $this->view->assign('author', $result['blocks']['author']);
     $this->view->assign('stack_nav', $result['blocks']['stack_nav']);
     $this->view->assign('photo_stream', $result['blocks']['photo_stream']);
     // if we are not in album, than $album is null
     $this->view->assign('album', $this->album);
     /**
      * Add extra widgets to photo page
      * @event frontend_photo
      * @param string[array]mixed $photo photo data
      * @return array[string][string]string $return[%plugin_id%]['bottom'] In bottom, under photo - any widget
      * @return array[string][string]string $return[%plugin_id%]['sidebar']
      * @return array[string][string]string $return[%plugin_id%]['top_left']
      * @return array[string][string]string $return[%plugin_id%]['top_right']
      */
     $this->view->assign('frontend_photo', wa()->event('frontend_photo', $this->photo));
     $version = wa()->getVersion();
     $this->getResponse()->addJs('js/common.js?v=' . $version, true);
     $this->getResponse()->addJs('js/photo.stream.slider.js?v=' . $version, true);
     $this->getResponse()->addJs('js/frontend.photo.js?v=' . $version, true);
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:49,代码来源:photosFrontendPhoto.action.php

示例6: castParams

 /**
  * 
  * @param $params array
  * @return array
  */
 protected function castParams($params = array())
 {
     waRequest::setParam($params);
     foreach ($this->params_definition as $param => $definition) {
         if (isset($definition['required']) && $definition['required']) {
             if (!isset($params[$param])) {
                 throw new waApiException(100, sprintf('Param %s are required', $param));
             }
         }
         $type = isset($definition['type']) && $definition['type'] ? $definition['type'] : null;
         $default = isset($definition['default']) ? $definition['default'] : false;
         waRequest::setParam($param, waRequest::param($param, $default, $type));
     }
     return waRequest::param();
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:20,代码来源:stickiesApiMethod.class.php

示例7: catalogAction

 public function catalogAction()
 {
     /**
      * @var shopYandexmarketPlugin $plugin
      */
     $plugin = wa()->getPlugin('yandexmarket');
     $profile_helper = new shopImportexportHelper('yandexmarket');
     list($path, $profile_id) = $plugin->getInfoByHash(waRequest::param('hash'));
     if ($profile_id) {
         $profile = $profile_helper->getConfig($profile_id);
         if (!$profile) {
             throw new waException('Profile not found', 404);
         }
         $lifetime = ifset($profile['config']['lifetime'], 0);
         if ($lifetime && (!file_exists($path) || time() - filemtime($path) > $lifetime)) {
             waRequest::setParam('profile_id', $profile_id);
             $runner = new shopYandexmarketPluginRunController();
             $_POST['processId'] = null;
             $moved = false;
             $ready = false;
             do {
                 ob_start();
                 if (empty($_POST['processId'])) {
                     $_POST['processId'] = $runner->processId;
                 } else {
                     sleep(1);
                 }
                 if ($ready) {
                     $_POST['cleanup'] = true;
                     $moved = true;
                 }
                 $runner->execute();
                 $out = ob_get_clean();
                 $result = json_decode($out, true);
                 $ready = !empty($result) && is_array($result) && ifempty($result['ready']);
             } while (!$ready || !$moved);
             //TODO check errors
         }
     }
     waFiles::readFile($path, waRequest::get('download') ? 'yandexmarket.xml' : null);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:41,代码来源:shopYandexmarketPluginFrontend.actions.php

示例8: smarty_function_wa_action

/**
 * @param $params
 * @param $smarty
 * @return string|void
 */
function smarty_function_wa_action($params, &$smarty)
{
    $current_app = waSystem::getInstance()->getApp();
    $app = $params['app'];
    waSystem::getInstance($app)->setActive($app);
    if (isset($params['action'])) {
        $type = 'action';
        $class_name = $app . ucfirst($params['module']) . ucfirst($params['action']) . 'Action';
    } elseif (isset($params['controller'])) {
        $type = 'controller';
        $class_name = $app . ucfirst($params['module']) . ucfirst($params['controller']) . 'Controller';
    }
    $var = isset($params['var']) ? $params['var'] : false;
    if ($var) {
        unset($params['var']);
    }
    unset($params['app']);
    unset($params['module']);
    unset($params['action']);
    foreach ($params as $key => $value) {
        waRequest::setParam($key, $value);
    }
    $result = '';
    try {
        if ($type == 'action') {
            $action = new $class_name();
            $result = $action->display();
        } elseif ($type == 'controller') {
            $controller = new $class_name();
            $result = $controller->execute();
        }
    } catch (Exception $e) {
        $result = $e->getMessage();
    }
    waSystem::setActive($current_app);
    if ($var) {
        $smarty->assign($var, $result);
    } else {
        return $result;
    }
}
开发者ID:Lazary,项目名称:webasyst,代码行数:46,代码来源:function.wa_action.php

示例9: finite

 public function finite()
 {
     $collection = new photosCollection($this->hash);
     $photos = $collection->getPhotos("*,thumb,frontend_link,tags", $this->offset, $this->photos_per_page);
     $photos = photosCollection::extendPhotos($photos);
     if ($this->hash) {
         $title = photosPhoto::escape($collection->getTitle());
         waRequest::setParam('title', $title);
         $this->view->assign('title', $title);
     } else {
         $this->view->assign('title', '');
     }
     $this->workupPhotos($photos);
     $total_count = $collection->count();
     $this->view->assign('photos_per_page', $this->photos_per_page);
     $this->view->assign('pages_count', floor($total_count / $this->photos_per_page) + 1);
     $this->view->assign('total_photos_count', $total_count);
     $this->view->assign('offset', $this->offset);
     $this->view->assign('photos', $photos);
     $is_xhr = waRequest::isXMLHttpRequest();
     $this->view->assign('is_xhr', $is_xhr);
     if ($is_xhr) {
         $this->view->assign('frontend_collection', array());
     } else {
         /**
          * @event frontend_collection
          * @return array[string][string]string $return[%plugin_id%]['name'] Extra name info
          * @return array[string][string]string $return[%plugin_id%]['content'] Extra album description and etc
          * @return array[string][string]string $return[%plugin_id%]['footer'] Footer section
          * @return array[string][string]string $return[%plugin_id%]['sidebar'] Footer section
          * @return array[string][string]string $return[%plugin_id%]['footer'] Footer section
          */
         $this->view->assign('frontend_collection', wa()->event('frontend_collection'));
     }
     $this->view->assign('lazy_load', !is_null(waRequest::get('lazy')));
     $v = wa()->getVersion();
     $this->getResponse()->addJs('js/lazy.load.js?v=' . $v, true);
     $this->getResponse()->addJs('js/frontend.photos.js?v=' . $v, true);
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:39,代码来源:photosFrontendCollectionViewAction.class.php

示例10: execute

 public function execute()
 {
     if (waRequest::param('url_type') == 2) {
         $product_model = new shopProductModel();
         if (waRequest::param('category_url')) {
             $category_model = new shopCategoryModel();
             $c = $category_model->getByField('full_url', waRequest::param('category_url'));
             if ($c) {
                 $product = $product_model->getByUrl(waRequest::param('product_url'), $c['id']);
                 if ($product && $product['category_id'] != $c['id']) {
                     $c = $category_model->getById($product['category_id']);
                     if ($c) {
                         $this->redirect(wa()->getRouteUrl('shop/frontend/product', array('category_url' => $c['full_url'], 'product_url' => $product['url'])));
                     } else {
                         $product = null;
                     }
                 }
             } else {
                 $product = null;
             }
         } else {
             $product = $product_model->getByField('url', waRequest::param('product_url'));
         }
         if (!$product) {
             // try find page
             $url = waRequest::param('category_url');
             $url_parts = explode('/', $url);
             waRequest::setParam('page_url', waRequest::param('product_url'));
             waRequest::setParam('product_url', end($url_parts));
             $this->executeAction(new shopFrontendProductPageAction());
         } else {
             $this->executeAction(new shopFrontendProductAction($product));
         }
     } else {
         $this->executeAction(new shopFrontendProductAction());
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:37,代码来源:shopFrontendProduct.controller.php

示例11: myNav

 /**
  * @return array
  * array(
  *     'shop' => 'shop my nav html...',
  *     'helpdesk' => 'helpdesk my nav html...',
  *     ...
  * )
  */
 public function myNav($ul_class = true)
 {
     $domain = wa()->getRouting()->getDomain(null, true);
     $domain_config_path = wa()->getConfig()->getConfigPath('domains/' . $domain . '.php', true, 'site');
     if (file_exists($domain_config_path)) {
         $domain_config = (include $domain_config_path);
     } else {
         $domain_config = array();
     }
     $routes = wa()->getRouting()->getRoutes();
     $apps = wa()->getApps();
     $result = array();
     foreach ($routes as $r) {
         if (isset($r['app']) && !empty($apps[$r['app']]['my_account'])) {
             $result[$r['app']] = $r;
         }
     }
     if (isset($domain_config['personal'])) {
         $tmp = array();
         foreach ($domain_config['personal'] as $app_id => $enabled) {
             if (!isset($result[$app_id])) {
                 continue;
             }
             if ($enabled) {
                 $tmp[$app_id] = $result[$app_id];
             } else {
                 unset($result[$app_id]);
             }
         }
         foreach ($result as $app_id => $r) {
             $tmp[$app_id] = $r;
         }
         $result = array_reverse($tmp, true);
     }
     $old_app = wa()->getApp();
     $my_nav_selected = $this->view->getVars('my_nav_selected');
     $old_params = waRequest::param();
     $i = 0;
     foreach ($result as $app_id => $r) {
         unset($r['url']);
         unset($r['app']);
         if ($i || $old_app != $app_id) {
             waSystem::getInstance($app_id, null, true);
             waRequest::setParam($r);
         }
         $class_name = $app_id . 'MyNavAction';
         if (class_exists($class_name)) {
             /**
              * @var waViewAction $action
              */
             try {
                 $action = new $class_name();
                 wa()->getView()->assign('my_nav_selected', $app_id == $old_app ? $my_nav_selected : '');
                 $result[$app_id] = $action->display();
             } catch (Exception $e) {
                 unset($result[$app_id]);
             }
         } else {
             unset($result[$app_id]);
         }
         $i++;
     }
     if (isset($app_id) && $old_app != $app_id) {
         waRequest::setParam($old_params);
         wa()->setActive($old_app);
     }
     $result = array_reverse($result, true);
     if ($ul_class) {
         $html = '<ul' . (is_string($ul_class) ? ' class="' . $ul_class . '"' : '') . '>';
         foreach ($result as $app_result) {
             $html .= $app_result;
         }
         $html .= '</ul>';
         return $html;
     } else {
         return $result;
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:86,代码来源:waViewHelper.class.php

示例12: execute

 public function execute()
 {
     $routing = wa()->getRouting();
     $settlements = array();
     $profile_helper = new shopImportexportHelper($this->plugin_id);
     $this->view->assign('profiles', $list = $profile_helper->getList());
     $profile = $profile_helper->getConfig();
     $profile['config'] += array('hash' => '', 'domain' => '', 'lifetime' => 0);
     $current_domain =& $profile['config']['domain'];
     $this->view->assign('current_domain', $current_domain);
     $domain_routes = $routing->getByApp('shop');
     foreach ($domain_routes as $domain => $routes) {
         foreach ($routes as $route) {
             $settlement = $domain . '/' . $route['url'];
             if ($settlement == $current_domain || $current_domain === '') {
                 $current_domain = $settlement;
                 $routing->setRoute($route, $domain);
                 waRequest::setParam($route);
             }
             $settlements[] = $settlement;
         }
     }
     $this->view->assign('profile', $profile);
     $info = array();
     $this->view->assign('settlements', $settlements);
     if (!empty($profile['id'])) {
         $path = shopYandexmarketPlugin::path($profile['id'] . '.xml');
         $info['exists'] = file_exists($path);
         $info['mtime'] = $info['exists'] ? filemtime($path) : null;
     } else {
         $info['mtime'] = $info['exists'] = null;
     }
     if ($info['exists']) {
         $route_params = array('plugin' => $this->plugin_id, 'hash' => $this->plugin()->getHash($profile['id']));
         $info['url'] = $routing->getUrl('shop/frontend/catalog', $route_params, true);
     } else {
         $info['url'] = null;
     }
     $this->view->assign('info', $info);
     /**
      * @var shopConfig $config ;
      */
     $config = wa('shop')->getConfig();
     $this->view->assign('primary_currency', $config->getCurrency());
     $this->view->assign('company', ifempty($profile['config']['company'], $config->getGeneralSettings('name')));
     $this->view->assign('company_name', ifempty($profile['config']['company_name'], $config->getGeneralSettings('name')));
     $type_model = new shopTypeModel();
     $this->view->assign('types', $type_model->getAll());
     $profile_map = ifset($profile['config']['map'], array());
     $export = ifset($profile['config']['export'], array());
     $set_model = new shopSetModel();
     $map = $this->plugin()->map(array(), null, true);
     $params = array();
     if ($profile_map) {
         foreach ($map as $type => &$type_map) {
             foreach ($type_map['fields'] as $field => &$info) {
                 $info['source'] = ifempty($profile_map[$type][$field], 'skip:');
                 unset($profile_map[$type][$field]);
                 unset($info);
             }
             if (!empty($type_map['fields']['param.*'])) {
                 $params[$type] = -1;
             }
             unset($type_map);
         }
         foreach ($profile_map as $type => $fields) {
             foreach ($fields as $field => $source) {
                 $info_field = strpos($field, 'param.') === 0 ? 'param.*' : $field;
                 if (isset($map[$type]['fields'][$info_field])) {
                     $info = $map[$type]['fields'][$info_field];
                     $info['source'] = ifempty($source, 'skip:');
                     $map[$type]['fields'][$field] = $info;
                     $params[$type] = max(ifset($params[$type], -1), intval(preg_replace('@\\D+@', '', $field)));
                 }
             }
         }
     }
     $this->view->assign('sets', $set_model->getAll());
     $this->view->assign('type_map', $map);
     $this->view->assign('params', array('params' => $params));
     $this->view->assign('export', $export);
     $this->view->assign('types_map', ifset($profile['config']['types'], array()));
     $app_settings_model = new waAppSettingsModel();
     $app_settings = array('ignore_stock_count' => $app_settings_model->get('shop', 'ignore_stock_count', 0));
     $this->view->assign('app_settings', $app_settings);
     $feature_model = new shopFeatureModel();
     $config = wa('shop')->getConfig();
     /**
      * @var shopConfig $config
      */
     $limit = $config->getOption('features_per_page');
     if ($feature_model->countByField(array('parent_id' => null)) < $limit) {
         $features = $feature_model->getFeatures(true);
         /*, true*/
         foreach ($features as $id => $feature) {
             if ($feature['type'] == shopFeatureModel::TYPE_DIVIDER) {
                 unset($features[$id]);
             }
         }
     } else {
//.........这里部分代码省略.........
开发者ID:Lazary,项目名称:webasyst,代码行数:101,代码来源:shopYandexmarketPluginBackendSetup.action.php

示例13: dispatchRoutes

 protected function dispatchRoutes($routes, $url)
 {
     $result = null;
     foreach ($routes as $r) {
         if ($this->route && isset($this->route['module']) && (!isset($r['module']) || $r['module'] != $this->route['module'])) {
             continue;
         }
         $vars = array();
         $pattern = str_replace(array(' ', '.', '('), array('\\s', '\\.', '(?:'), $r['url']);
         $pattern = preg_replace('/(^|[^\\.])\\*/ui', '$1.*?', $pattern);
         if (preg_match_all('/<([a-z_]+):?([^>]*)?>/ui', $pattern, $match, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
             $offset = 0;
             foreach ($match as $m) {
                 $vars[] = $m[1][0];
                 if ($m[2][0]) {
                     $p = $m[2][0];
                 } else {
                     $p = '.*?';
                 }
                 $pattern = substr($pattern, 0, $offset + $m[0][1]) . '(' . $p . ')' . substr($pattern, $offset + $m[0][1] + strlen($m[0][0]));
                 $offset = $offset + strlen($p) + 2 - strlen($m[0][0]);
             }
         }
         if (preg_match('!^' . $pattern . '$!ui', $url, $match)) {
             if (isset($r['redirect'])) {
                 $p = str_replace('.*?', '(.*?)', $pattern);
                 if ($p != $pattern) {
                     preg_match('!^' . $p . '$!ui', $url, $m);
                     if (isset($m[1])) {
                         $r['redirect'] = str_replace('*', $m[1], $r['redirect']);
                         if (waRequest::server('QUERY_STRING')) {
                             $r['redirect'] .= '?' . waRequest::server('QUERY_STRING');
                         }
                     }
                 }
                 wa()->getResponse()->redirect($r['redirect'], 301);
             }
             if ($vars) {
                 array_shift($match);
                 foreach ($vars as $i => $v) {
                     if (isset($match[$i]) && !waRequest::param($v)) {
                         waRequest::setParam($v, $match[$i]);
                     }
                 }
             }
             foreach ($r as $k => $v) {
                 if ($k !== 'url') {
                     waRequest::setParam($k, $v);
                 }
             }
             $result = $r;
             break;
         }
     }
     return $result;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:56,代码来源:waRouting.class.php

示例14: execute

 public function execute($plugin = null, $module = null, $action = null, $default = false)
 {
     if (!$plugin && $module == 'frontend') {
         try {
             if (!waRequest::param('page_id')) {
                 $request_url = parse_url($this->system->getRootUrl() . $this->system->getConfig()->getRequestUrl());
                 if (isset($request_url['path']) && $request_url['path'] && substr($request_url['path'], -1) != '/') {
                     $request_url['path'] .= '/';
                     $this->system->getResponse()->redirect(implode('', $request_url), 301);
                 }
             }
             #parse request URL
             $params = waRequest::param();
             #determine blog ID which are dependent on routing settings
             $blog_model = new blogBlogModel();
             $blogs = array();
             $params['blog_url_type'] = waRequest::param('blog_url_type', 0, waRequest::TYPE_INT);
             if (!($title = waRequest::param('title'))) {
                 $title = wa()->accountName();
             }
             $blog_url = waRequest::param('blog_url', '', waRequest::TYPE_STRING_TRIM);
             $main_page = false;
             if ($params['blog_url_type'] > 0) {
                 if ($blog = $blog_model->getByField(array('id' => $params['blog_url_type'], 'status' => blogBlogModel::STATUS_PUBLIC))) {
                     $blogs[] = $blog;
                     $main_page = true;
                 }
             } elseif (strlen($blog_url)) {
                 if ($blog = $blog_model->getBySlug($blog_url, true, array('id', 'name', 'url'))) {
                     $blogs[] = $blog;
                 }
             } else {
                 $blogs = blogHelper::getAvailable();
                 if (!isset($params['post_url'])) {
                     if (count($blogs) > 1 || $params['blog_url_type'] == 0) {
                         $main_page = true;
                     }
                 }
             }
             if ($blogs) {
                 if (count($blogs) == 1 && ($params['blog_url_type'] != 0 || strlen($blog_url))) {
                     $blog = reset($blogs);
                     $params['blog_id'] = intval($blog['id']);
                     $params['blog_url'] = $blog['url'];
                     if (!$main_page) {
                         $routing = wa()->getRouting();
                         if ($params['blog_id'] != $routing->getRouteParam('blog_url_type') || isset($params['post_url'])) {
                             $title = $blog['name'];
                         } elseif (!$title) {
                             $title = $blog['name'];
                         }
                     }
                 } else {
                     $params['blog_id'] = array_map('intval', array_keys($blogs));
                 }
             } else {
                 throw new waException(_w('Blog not found'), 404);
             }
             wa()->getResponse()->setTitle($title);
             if ($main_page) {
                 wa()->getResponse()->setMeta('keywords', waRequest::param('meta_keywords'));
                 wa()->getResponse()->setMeta('description', waRequest::param('meta_description'));
             }
             waRequest::setParam($params);
             parent::execute($plugin, $module, $action, $default);
         } catch (Exception $e) {
             waRequest::setParam('exception', $e);
             parent::execute(null, 'frontend', 'error');
         }
     } else {
         parent::execute($plugin, $module, $action, $default);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:73,代码来源:blogFrontController.class.php

示例15: execute

 public function execute($plugin = null, $module = null, $action = null, $default = false)
 {
     try {
         if (!waRequest::param('page_id')) {
             if (!waRequest::isXMLHttpRequest()) {
                 $request_url = parse_url($this->system->getRootUrl() . $this->system->getConfig()->getRequestUrl());
                 if (!empty($request_url['path']) && empty($request_url['query']) && substr($request_url['path'], -1) != '/') {
                     $request_url['path'] .= '/';
                     $this->system->getResponse()->redirect(implode('', $request_url), 301);
                 }
             }
         }
         if ($module == 'frontend' && $action != 'album') {
             // request params
             $id = waRequest::param('id', '', waRequest::TYPE_STRING_TRIM);
             $tag = waRequest::param('tag', '', waRequest::TYPE_STRING_TRIM);
             $author = waRequest::param('author', '', waRequest::TYPE_INT);
             $search = waRequest::param('search', '', waRequest::TYPE_STRING_TRIM);
             $favorites = waRequest::param('favorites', '', waRequest::TYPE_STRING_TRIM);
             $url = waRequest::param('url', '', waRequest::TYPE_STRING_TRIM);
             $type = 'all';
             $hash = '';
             $album = null;
             if ($author) {
                 $hash = 'author/' . $author;
                 $type = 'author';
             } else {
                 if ($search) {
                     $hash = 'search/' . $search;
                     $type = 'search';
                 } else {
                     if ($id) {
                         $hash = 'id/' . $id;
                         $type = 'id';
                     } else {
                         if ($tag) {
                             $hash = 'tag/' . $tag;
                             $type = 'tag';
                         } else {
                             if ($favorites) {
                                 $hash = 'favorites';
                                 $type = 'favorites';
                             } else {
                                 if ($url) {
                                     if (preg_match('/^([^\\s]+)\\/([^\\s\\/]+)/', trim($url, '/'), $m)) {
                                         $album_url = $m[1];
                                         $url = $m[2];
                                         $hash = photosCollection::frontendAlbumUrlToHash($album_url, $album);
                                         if (!$album) {
                                             throw new waException(_w('Page not found'), 404);
                                         }
                                         $type = 'album';
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $url = rtrim($url, '/');
             waRequest::setParam('url', $url);
             waRequest::setParam('album', $album);
             waRequest::setParam('hash', $hash);
             waRequest::setParam('type', $type);
         }
         parent::execute($plugin, $module, $action, $default);
     } catch (Exception $e) {
         if ($module == 'frontend') {
             $action = new photosFrontendErrorAction($e);
             $action->display();
         } else {
             throw $e;
         }
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:75,代码来源:photosFrontController.class.php


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