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


PHP WM_Router::create方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $where = '';
     $category = null;
     if ($this->getRequest()->getQuery('username')) {
         $userinfo = Model_Users::getByUsername($this->getRequest()->getQuery('username'));
         if ($userinfo) {
             $where = "users.username = '" . $this->getRequest()->getQuery('username') . "'";
         }
     }
     if ($this->getRequest()->getQuery('category')) {
         $catinfo = Model_Categories::get($this->getRequest()->getQuery('category'));
         if ($catinfo) {
             $category = $this->getRequest()->getQuery('category');
         }
     }
     $items = Model_Items::getAll($category, 0, 20, 'id desc', $where);
     $this->view->item = array();
     if ($items) {
         $model_images = new Model_Images();
         $categories = Model_Categories::get_all();
         foreach ($items as $item) {
             $categories_string = '';
             if ($category) {
                 foreach ($item['categories'] as $cats) {
                     if (in_array($category, $cats)) {
                         foreach ($cats as $cat) {
                             if (isset($categories[$cat]['name'])) {
                                 $categories_string .= $categories_string ? ' › ' : '';
                                 $categories_string .= $categories[$cat]['name'];
                             }
                         }
                         break;
                     }
                 }
             } else {
                 $cats = array_pop($item['categories']);
                 if ($cats && is_array($cats)) {
                     foreach ($cats as $cat) {
                         if (isset($categories[$cat]['name'])) {
                             $categories_string .= $categories_string ? ' › ' : '';
                             $categories_string .= $categories[$cat]['name'];
                         }
                     }
                 }
             }
             if ((int) JO_Registry::get($item['module'] . '_items_preview_width') && (int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resize($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'), JO_Registry::forceGet($item['module'] . '_items_preview_height'), true);
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_width')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeHeight($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_height'));
             } else {
                 $item['theme_preview_thumbnail'] = false;
             }
             $this->view->item[] = array('title' => $item['name'], 'link' => WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id']), 'description' => html_entity_decode($item['description'], ENT_QUOTES, 'utf-8'), 'author' => $item['username'], 'category' => $categories_string, 'guid' => $item['id'], 'enclosure' => $item['theme_preview_thumbnail'], 'pubDate' => JO_Date::getInstance($item['datetime'], JO_Date::RSS_FULL, true)->toString());
         }
     }
     echo $this->renderScript('rss');
 }
开发者ID:noikiy,项目名称:PD,代码行数:60,代码来源:RssController.php

示例2: autocompleteAction

 public function autocompleteAction()
 {
     $request = $this->getRequest();
     $this->view->items = array();
     if (JO_Session::get('user[user_id]') && $request->getPost('value')) {
         $methods = glob(dirname(__FILE__) . '/Search/*.php');
         if ($methods) {
             foreach ($methods as $file) {
                 $controller = basename($file, '.php');
                 $class_name = 'Search_' . $controller;
                 if (!class_exists($class_name, false)) {
                     JO_Loader::loadFile($file);
                 }
                 $class = new $class_name();
                 if (method_exists($class, 'autocomplete')) {
                     $this->view->items = array_merge($this->view->items, $class->autocomplete($request->getPost('value')));
                 }
             }
         }
     }
     $this->view->items[] = array('template' => 'global', 'label' => sprintf($this->translate('Search for %s'), $request->getPost('value')), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getPost('value')));
     if ($request->isXmlHttpRequest()) {
         echo $this->renderScript('json');
     } else {
         $this->forward('error', 'error404');
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:27,代码来源:SearchController.php

示例3: indexAction

 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (isset($settings['instagram_module_status_enable']) && $settings['instagram_module_status_enable']) {
         if (isset($settings['instagram_login_with_instagram']) && $settings['instagram_login_with_instagram']) {
             $request = $this->getRequest();
             $next = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_connect&action=connect');
             $this->view->instagram_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_login&instagram_fnc=connect&action=forward&next=' . $next);
             $this->view->instagram_fetch = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_media');
             $connectObject = new Model_Instagram_Login();
             $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
             $this->view->instagram_connect = false;
             $this->view->fetch_instagram_media = false;
             if ($user_info) {
                 $this->view->instagram_connect = true;
                 $this->view->fetch_instagram_media = isset($settings['instagram_fetch_instagram_media']) && $settings['instagram_fetch_instagram_media'];
             }
             $this->view->site_name = Helper_Config::get('site_name');
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:25,代码来源:ConnectController.php

示例4: get_avatarAction

 public function get_avatarAction()
 {
     $this->noLayout(true);
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         $connectObject = new Model_Facebook_Login();
         $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
         $user_id = 0;
         if ($user_info) {
             $user_id = $user_info['oauth_uid'];
         } else {
             $facebookObject = new Helper_Modules_Facebook();
             $user_data = $facebookObject->getUser(true);
             if ($user_data && isset($user_data['id'])) {
                 $user_id = $user_data['id'];
             }
         }
         if ($user_id) {
             $ph = new WM_Facebook_Photo();
             $image = $ph->getRealUrl('http://graph.facebook.com/' . $user_id . '/picture?type=large');
             $image_info = @getimagesize($image);
             if ($image_info) {
                 $image_data = @file_get_contents($image);
                 if ($image_data) {
                     JO_Session::set('upload_avatar', array('name' => basename($image), 'type' => $image_info['mime'], 'data' => $image_data));
                     $this->view->success = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=temporary_avatar&hash=' . microtime(true));
                 }
             }
         } else {
             $this->view->error = $this->translate('There is no established connection with facebook!');
         }
     }
     echo $this->renderScript('json');
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:34,代码来源:UseravatarController.php

示例5: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $goodies = Model_Pages::getPage(Helper_Config::get('page_goodies'));
     $pin_text = $this->translate('Pyng images from any website as you browse the web with the %s"Pyng It" button.%s');
     if ($goodies) {
         $this->view->pin_text = sprintf($pin_text, '<a href="' . WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_goodies')) . '">', '</a>');
     }
     $methods = glob(dirname(__FILE__) . '/Addpin/*.php');
     $this->view->methods = array();
     if ($methods) {
         $front = $this->getFrontController();
         foreach ($methods as $row => $method) {
             $controller = basename($method, 'Controller.php');
             if ($controller) {
                 $name = $front->formatControllerName('addpin_' . strtolower($controller));
                 if (!class_exists($name, true)) {
                     JO_Loader::loadClass($name);
                 }
                 $instance = new $name();
                 $this->view->methods[isset($instance->SORT) ? $instance->SORT : 0] = $this->view->callChildren('addpin_' . strtolower($controller));
             }
         }
     }
     ksort($this->view->methods);
     $this->view->popup_main_box = $this->view->render('popup_main', 'addpin');
     if ($request->isXmlHttpRequest()) {
         $this->noViewRenderer(true);
         echo $this->view->popup_main_box;
     } else {
         $this->forward('error', 'error404');
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:33,代码来源:AddpinController.php

示例6: indexAction

 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
     $this->view->collections = array();
     $collections = Model_Collections::getCollections($data);
     if ($collections) {
         foreach ($collections as $collection) {
             $collection['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=collections&action=view&collection_id=' . $collection['id']);
             $this->view->collections[] = $collection;
         }
     }
     $total_records = Model_Collections::getTotalCollections();
     $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(JO_Registry::get('admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/collections/?page={page}');
     $this->view->pagination = $pagination->render();
 }
开发者ID:noikiy,项目名称:PD,代码行数:26,代码来源:CollectionsController.php

示例7: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $this->noLayout(true);
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->bookmarklet = WM_Router::create($request->getBaseUrl() . '?controller=bookmarklet');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:7,代码来源:PinitController.php

示例8: indexAction

 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
     $this->view->comments = array();
     $comments = Model_Comments::getReportedComments($data);
     if ($comments) {
         $bbcode_parser = new WM_BBCode_Parser();
         $bbcode_parser->loadDefaultCodes();
         foreach ($comments as $comment) {
             $comment['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=items&action=comments&item_id=' . $comment['item_id'] . '&filter=' . ($comment['reply_to'] ? $comment['reply_to'] : $comment['id']));
             $bbcode_parser->parse($comment['comment']);
             $comment['comment'] = $bbcode_parser->getAsHtml();
             $this->view->comments[] = $comment;
         }
     }
     $total_records = Model_Comments::getTotalReportedComments($data);
     $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(JO_Registry::get('admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/comments/?page={page}');
     $this->view->pagination = $pagination->render();
 }
开发者ID:noikiy,项目名称:PD,代码行数:30,代码来源:CommentsController.php

示例9: __construct

 public function __construct($key = null, $secret = null, $redirect_uri = null)
 {
     $this->key = $key ? $key : Helper_Config::get('instagram_oauth_key');
     $this->secret = $secret ? $secret : Helper_Config::get('instagram_oauth_secret');
     if (!$redirect_uri) {
         $redirect_uri = WM_Router::create(JO_Request::getInstance()->getBaseUrl() . '?controller=modules_instagram_login');
     }
     parent::__construct(array('client_id' => $this->key, 'client_secret' => $this->secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri));
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:9,代码来源:Instagram.php

示例10: methodsforinvatesAction

 public function methodsforinvatesAction()
 {
     $request = $this->getRequest();
     //user invate friends
     $this->view->user_invate_friends = array();
     $this->view->user_invate_friends[] = array('title' => $this->translate('Email'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=invates'), 'active' => $request->getController() == 'invates', 'class_icon' => 'icon-invites-email');
     $user_invate_friends = Model_Extensions::getByMethod('user_invate_friends');
     foreach ($user_invate_friends as $id => $method) {
         $this->view->user_invate_friends[] = array('title' => $this->translate(ucfirst(strtolower($method))), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=modules_' . $method . '_invates'), 'active' => $request->getController() == 'modules_' . $method . '_invates', 'class_icon' => 'icon-invites-' . $method);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:11,代码来源:InvatesController.php

示例11: pinitAction

 public function pinitAction()
 {
     $request = $this->getRequest();
     $this->noLayout(true);
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->bookmarklet = WM_Router::create($request->getBaseUrl() . '?controller=bookmarklet');
     $response = $this->getResponse();
     $response->addHeader('Cache-Control: no-cache, must-revalidate');
     $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     $response->addHeader('Content-type: application/javascript');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:11,代码来源:JsController.php

示例12: autocomplete

 public function autocomplete($query)
 {
     $request = $this->getRequest();
     $result = array();
     $boards = new Model_Boards_SearchAutocomplete(array('filter_title' => $query, 'start' => 0, 'limit' => 100));
     if ($boards->count()) {
         foreach ($boards as $board) {
             $result[] = array('template' => 'board', 'title' => $board['board_title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['board_user_id'] . '&board_id=' . $board['board_board_id']));
         }
     }
     return $result;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:12,代码来源:BoardsController.php

示例13: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (!isset($settings['facebook_login_with_facebook']) || !$settings['facebook_login_with_facebook']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['facebook_module_status_enable']) || !$settings['facebook_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $facebook = new Helper_Modules_Facebook();
     $user_data = $facebook->getUser(true);
     if ($user_data) {
         $modelLogin = new Model_Facebook_Login($user_data['id']);
         $error = true;
         if ($modelLogin->row) {
             $userObject = new Model_Users_User($modelLogin->row['user_id']);
             if ($userObject->count()) {
                 if (JO_Session::get('user[user_id]')) {
                     if ($modelLogin->row['user_id'] == JO_Session::get('user[user_id]')) {
                         JO_Session::set('user', $userObject->toArray());
                     }
                 } else {
                     JO_Session::set('user', $userObject->toArray());
                 }
                 new Model_Users_Edit($modelLogin->row['user_id'], array('last_login' => new JO_Db_Expr('NOW()')));
                 $modelLogin->facebook = $facebook;
                 $modelLogin->update($user_data);
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         } elseif (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_facebook_register');
         } elseif (JO_Session::get('user[user_id]')) {
             $this->redirect($request->getBaseUrl());
         }
         $this->setViewChange('no_account');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     } else {
         //not session
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:52,代码来源:LoginController.php

示例14: autocomplete

 public function autocomplete($query)
 {
     $request = $this->getRequest();
     $result = array();
     $has_friends = (int) JO_Session::get('user[following]') + (int) JO_Session::get('user[followers]');
     $users = $has_friends ? new Model_Users_SearchAutocomplete(array('filter_username' => $query, 'start' => 0, 'limit' => 100)) : new ArrayObject();
     if ($has_friends && $users->count()) {
         foreach ($users as $user) {
             $result[] = array('template' => 'user', 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']));
         }
     }
     return $result;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:13,代码来源:PeopleController.php

示例15: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     if (JO_Session::get('msg_success')) {
         $this->view->msg_error = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     }
     if (JO_Session::get('msg_error')) {
         $this->view->msg_error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $this->view->questions = $questions = Model_Quiz::getAllQuestions(0, 0, '', 'RAND()');
     $this->view->answers = $answers = Model_Quiz::getAllAnswers(0, 0, '', true);
     if ($request->isPost()) {
         $rightAnswers = 0;
         $user_answers = $request->getPost('answers');
         if (is_array($user_answers)) {
             foreach ($user_answers as $question => $answer) {
                 if (isset($answers[$question][$answer]) && $answers[$question][$answer]['right'] == 'true') {
                     $rightAnswers++;
                 }
             }
         }
         if ($rightAnswers > 0 && count($questions) == $rightAnswers) {
             $_SESSION['user']['quiz'] = 'true';
             JO_Session::set('quiz', 'true');
             Model_Users::updateQuiz(JO_Session::get('user_id'), 'true');
             JO_Session::set('msg_success', 'You have successfully completed the quiz');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=upload'));
         } else {
             JO_Session::set('msg_error', 'You have to answer all questions correctly. You have ' . $rightAnswers . ' right answers from ' . $question . ' questions');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=quiz'));
         }
     }
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $this->getLayout()->meta_title = $this->translate('Quiz');
     $this->getLayout()->meta_description = $this->translate('Quiz');
     $this->view->page_name = $this->translate('Quiz');
     /* CRUMBS */
     $this->view->crumbs = array();
     $this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:49,代码来源:QuizController.php


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