本文整理汇总了PHP中WM_Router类的典型用法代码示例。如果您正苦于以下问题:PHP WM_Router类的具体用法?PHP WM_Router怎么用?PHP WM_Router使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WM_Router类的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');
}
示例2: 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');
}
示例3: 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();
}
示例4: 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');
}
}
示例5: 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);
}
}
示例6: 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');
}
示例7: 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');
}
}
示例8: indexAction
public function indexAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
if ($request->getRequest('type') !== 'create') {
return;
}
$settings = Model_Extensions::getSettingsPairs('facebook');
if (isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline']) {
$user_id = $request->getParam('user');
$pin_id = $request->getParam('pin');
if ($user_id && $pin_id) {
$connectObject = new Model_Facebook_Login();
$user_fb = $connectObject->getDataByUserId($user_id);
if ($user_fb && $user_fb['timeline']) {
$facebook = new Helper_Modules_Facebook();
$pin_url = WM_Router::pinAction($pin_id);
$params = array('link' => $pin_url, 'access_token' => $user_fb['access_token'], 'cb' => '');
$response = $facebook->facebook->api('/me/feed', 'post', $params);
if ($settings['facebook_og_namespace'] && $settings['facebook_og_recipe']) {
$params = array($settings['facebook_og_recipe'] => $pin_url, 'access_token' => $user_fb['access_token']);
$response1 = $facebook->facebook->api('/me/' . $settings['facebook_og_namespace'] . ':' . $settings['facebook_og_recipe'], 'post', $params);
}
}
}
}
}
示例9: 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();
}
示例10: __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));
}
示例11: 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);
}
}
示例12: 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');
}
示例13: 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;
}
示例14: 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']));
}
}
}
示例15: 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;
}