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


PHP Request::getWord方法代码示例

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


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

示例1: saveTask

 /**
  * Save permissions to asset
  *
  * @return void
  */
 public function saveTask()
 {
     $scope = Request::getWord('scope', false);
     $scope_id = Request::getInt('scope_id', false);
     if (!$scope || !$scope_id) {
         echo json_encode(array('success' => false));
         exit;
     }
     // Process Rules
     $data = Request::getVar(strtolower($scope));
     $rules = array();
     if ($data && count($data) > 0) {
         foreach ($data as $rule => $parts) {
             if ($parts && count($parts) > 0) {
                 foreach ($parts as $group => $perms) {
                     if ($perms == '') {
                         continue;
                     }
                     $rules[$rule][$group] = $perms;
                 }
             }
         }
     }
     $class = 'Components\\Time\\Models\\' . $scope;
     $model = $class::oneOrFail($scope_id);
     $model->assetRules = new \JAccessRules($rules);
     $model->save();
     echo json_encode(array('success' => true));
     exit;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:35,代码来源:permissions.php

示例2: onCourseViewAfter

 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param      object  $course Current course
  * @param      string  $active Current active area
  * @return     array
  */
 public function onCourseViewAfter($course)
 {
     $instructors = $course->instructors();
     if (count($instructors) <= 0) {
         return;
     }
     $ids = array();
     foreach ($instructors as $instructor) {
         $ids[] = (int) $instructor->get('user_id');
     }
     $database = App::get('db');
     $query = "SELECT DISTINCT c.*\n\t\t\t\t\tFROM `#__courses` AS c\n\t\t\t\t\tJOIN `#__courses_members` AS m ON m.course_id=c.id AND m.student=0\n\t\t\t\t\tLEFT JOIN `#__courses_roles` AS r ON r.id=m.role_id\n\t\t\t\t\tWHERE r.alias='instructor'\n\t\t\t\t\tAND m.user_id IN (" . implode(",", $ids) . ")\n\t\t\t\t\tAND m.student=0\n\t\t\t\t\tAND c.state=1\n\t\t\t\t\tAND c.id !=" . $database->Quote($course->get('id')) . " LIMIT " . (int) $this->params->get('display_limit', 3);
     $database->setQuery($query);
     if ($courses = $database->loadObjectList()) {
         $view = $this->view('default', 'overview');
         $view->option = Request::getCmd('option', 'com_courses');
         $view->controller = Request::getWord('controller', 'course');
         $view->course = $course;
         $view->name = $this->_name;
         $view->courses = $courses;
         $view->ids = $ids;
         // Return the output
         return $view->loadTemplate();
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:32,代码来源:related.php

示例3: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (User::isGuest()) {
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (App::isSite()) {
             $pages = ['com_users.login'];
             $granted = Session::get('user_consent', false);
             if (in_array($current, $pages) && !$granted) {
                 Request::setVar('option', 'com_users');
                 Request::setVar('view', 'userconsent');
             }
         } else {
             if (App::isAdmin()) {
                 $exceptions = ['com_login.grantconsent'];
                 $granted = Session::get('user_consent', false);
                 if (!in_array($current, $exceptions) && !$granted) {
                     Request::setVar('option', 'com_login');
                     Request::setVar('task', 'consent');
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:userconsent.php

示例4: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_members.changepassword', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         $badpassword = Session::get('badpassword', false);
         $expiredpassword = Session::get('expiredpassword', false);
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && ($badpassword || $expiredpassword)) {
             Request::setVar('option', 'com_members');
             Request::setVar('task', 'changepassword');
             Request::setVar('id', 0);
             if ($badpassword) {
                 Request::setVar('Your password does not meet current site requirements. Please change your password now.');
             }
             if ($expiredpassword) {
                 Request::setVar('Your password has expired. Please change your password now.');
             }
             $this->event->stop();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:30,代码来源:password.php

示例5: onPublicationSub

 /**
  * Return data on a publication sub view (this will be some form of HTML)
  *
  * @param   object   $publication  Current publication
  * @param   string   $option       Name of the component
  * @param   integer  $miniview     View style
  * @return  array
  */
 public function onPublicationSub($publication, $option, $miniview = 0)
 {
     $arr = array('html' => '', 'metadata' => '', 'name' => 'watch');
     // Check if our area is in the array of areas we want to return results for
     $areas = array('watch');
     if (!array_intersect($areas, $this->onPublicationSubAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationSubAreas($publication)))) {
         return false;
     }
     // Only show for logged-in users
     if (User::isGuest()) {
         return false;
     }
     $this->publication = $publication;
     $this->action = strtolower(Request::getWord('action', ''));
     switch ($this->action) {
         case 'subscribe':
         case 'unsubscribe':
             $arr['html'] = $this->_subscribe();
             break;
         default:
             $arr['html'] = $this->_status();
             break;
     }
     return $arr;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:33,代码来源:watch.php

示例6: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (in_array(App::get('client')->id, $this->params->get('clients', [1]))) {
         $exceptions = ['com_login.logout', 'com_users.logout'];
         $current = Request::getWord('option', '');
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!User::isGuest() && !in_array($current, $exceptions)) {
             // Get factor status
             $status = App::get('session')->get('authfactors.status', null);
             if ($status === false) {
                 // If not a guest, and auth factors checks are done and have failed,
                 // log out so we start over
                 $logout = 'logout' . ucfirst(App::get('client')->alias);
                 self::$logout();
             } else {
                 if ($status === null) {
                     // If not a guest, but no factor verification has been completed,
                     // procede with auth factor checks as applicable
                     $factors = 'factors' . ucfirst(App::get('client')->alias);
                     self::$factors();
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:32,代码来源:authfactors.php

示例7: onCourseView

 /**
  * Return data on a resource view (this will be some form of HTML)
  *
  * @param      object  $resource Current resource
  * @param      string  $option    Name of the component
  * @param      array   $areas     Active area(s)
  * @param      string  $rtrn      Data to be returned
  * @return     array
  */
 public function onCourseView($course, $active = null)
 {
     // Prepare the response
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)));
     $this->option = Request::getCmd('option', 'com_courses');
     $this->controller = Request::getWord('controller', 'course');
     $database = App::get('db');
     $tbl = new \Hubzero\Item\Comment($database);
     // Build the HTML meant for the tab's metadata overview
     $view = $this->view('default', 'metadata');
     $view->set('option', $this->option)->set('controller', $this->controller)->set('course', $course)->set('tbl', $tbl);
     $response->set('metadata', $view->loadTemplate());
     // Check if our area is in the array of areas we want to return results for
     if ($response->get('name') == $active) {
         $this->view = $this->view('default', 'view');
         $this->view->database = $this->database = $database;
         $this->view->option = $this->option;
         $this->view->controller = $this->controller;
         $this->view->obj = $this->obj = $course;
         $this->view->obj_type = $this->obj_type = substr($this->option, 4);
         $this->view->url = $this->url = Route::url($course->link() . '&active=' . $this->_name, false, true);
         $this->view->depth = 0;
         $this->view->tbl = $tbl;
         $this->_authorize();
         $this->view->params = $this->params;
         $this->view->task = $this->task = Request::getVar('action', '');
         switch ($this->task) {
             // Entries
             case 'save':
                 $this->_save();
                 break;
             case 'new':
                 $this->_view();
                 break;
             case 'edit':
                 $this->_view();
                 break;
             case 'delete':
                 $this->_delete();
                 break;
             case 'view':
                 $this->_view();
                 break;
             case 'vote':
                 $this->_vote();
                 break;
             default:
                 $this->_view();
                 break;
         }
         foreach ($this->getErrors() as $error) {
             $this->view->setError($error);
         }
         // Return the output
         $response->set('html', $this->view->loadTemplate());
     }
     return $response;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:67,代码来源:reviews.php

示例8: parse

 /**
  * Parse the segments of a URL.
  *
  * @param   array  &$segments  The segments of the URL to parse.
  * @return  array  The URL attributes to be used by the application.
  */
 public function parse(&$segments)
 {
     $vars = array();
     if (empty($segments)) {
         return $vars;
     }
     //$vars['task'] = 'view';
     $e = array_pop($segments);
     $s = implode(DS, $segments);
     if ($s) {
         $vars['scope'] = $s;
     }
     $vars['pagename'] = $e;
     if (!isset($vars['task']) || !$vars['task']) {
         $vars['task'] = \Request::getWord('task', '');
     }
     switch ($vars['task']) {
         case 'upload':
         case 'download':
         case 'deletefolder':
         case 'deletefile':
         case 'media':
         case 'list':
             $vars['controller'] = 'media';
             break;
         case 'history':
         case 'compare':
         case 'approve':
         case 'deleterevision':
             $vars['controller'] = 'history';
             break;
         case 'editcomment':
         case 'addcomment':
         case 'savecomment':
         case 'reportcomment':
         case 'removecomment':
         case 'comments':
             $vars['controller'] = 'comments';
             break;
         case 'delete':
         case 'edit':
         case 'save':
         case 'rename':
         case 'saverename':
         case 'approve':
         default:
             $vars['controller'] = 'page';
             break;
     }
     if (substr(strtolower($vars['pagename']), 0, strlen('image:')) == 'image:' || substr(strtolower($vars['pagename']), 0, strlen('file:')) == 'file:') {
         $vars['controller'] = 'media';
         $vars['task'] = 'download';
     }
     return $vars;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:61,代码来源:router.php

示例9: onCourseView

 /**
  * Return data on a course view (this will be some form of HTML)
  * 
  * @param      object  $course Current course
  * @param      string  $active Current active area
  * @return     array
  */
 public function onCourseView($course, $active = null)
 {
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)));
     // Check if our area is in the array of areas we want to return results for
     if ($response->get('name') == $active) {
         $view = $this->view('default', 'overview');
         $view->set('option', Request::getCmd('option', 'com_courses'))->set('controller', Request::getWord('controller', 'course'))->set('course', $course);
         $response->set('html', $view->loadTemplate());
     }
     // Return the output
     return $response;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:19,代码来源:overview.php

示例10: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_support.tickets.save.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && User::getInstance()->reputation->isJailed()) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'spamjail');
         }
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:20,代码来源:spamjail.php

示例11: onResources

 /**
  * Return data on a resource view (this will be some form of HTML)
  *
  * @param   object  $resource  Current resource
  * @param   string  $option    Name of the component
  * @param   array   $areas     Active area(s)
  * @param   string  $rtrn      Data to be returned
  * @return  void
  */
 public function onResources($model, $option, $areas, $rtrn = 'all')
 {
     if (!App::isSite()) {
         return;
     }
     if (Request::getWord('tmpl') || Request::getWord('format') || Request::getInt('no_html')) {
         return;
     }
     $view = $this->view();
     Document::addCustomTag('<meta property="og:title" content="' . $view->escape($model->resource->title) . '" />');
     Document::addCustomTag('<meta property="og:description" content="' . $view->escape($model->resource->introtext) . '" />');
     Document::addCustomTag('<meta property="og:type" content="article" />');
     $url = Route::url('index.php?option=com_resources&' . ($model->resource->alias ? 'alias=' . $model->resource->alias : 'id=' . $model->resource->id));
     $url = rtrim(Request::root(), '/') . '/' . trim($url, '/');
     Document::addCustomTag('<meta property="og:url" content="' . $url . '" />');
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:25,代码来源:opengraph.php

示例12: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && !User::get('approved')) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'unapproved');
             $this->event->stop();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:21,代码来源:unapproved.php

示例13: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles', 'com_members.register.unconfirmed.profiles', 'com_members.register.change.profiles', 'com_members.register.resend.profiles', 'com_members.register.resend', 'com_members.register.confirm.profiles', 'com_members.register.confirm', 'com_members.save.profiles', 'com_members.profiles.save', 'com_members.profiles.save.profiles', 'com_members.changepassword'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (User::get('id') && User::get('activation') != 1 && User::get('activation') != 3 && !in_array($current, $exceptions)) {
             Request::setVar('option', 'com_members');
             Request::setVar('controller', 'register');
             Request::setVar('task', 'unconfirmed');
             $this->event->stop();
         }
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:21,代码来源:unconfirmed.php

示例14: login

 /**
  * Method to call when redirected back from twitter after authentication
  * Grab the return URL if set and handle denial of app privileges from twitter
  *
  * @param   object  $credentials
  * @param   object  $options
  * @return  void
  */
 public function login(&$credentials, &$options)
 {
     if ($return = Request::getVar('return', '', 'method', 'base64')) {
         $b64dreturn = base64_decode($return);
         if (!\Hubzero\Utility\Uri::isInternal($b64dreturn)) {
             $b64dreturn = '';
         }
     }
     $options['return'] = $b64dreturn;
     // Check to make sure they didn't deny our application permissions
     if (Request::getWord('denied', false)) {
         // User didn't authorize our app or clicked cancel
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return), Lang::txt('PLG_AUTHENTICATION_TWITTER_MUST_AUTHORIZE_TO_LOGIN', Config::get('sitename')), 'error');
         return;
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:24,代码来源:twitter.php

示例15: display

 function display($tpl = null)
 {
     // Assign variables to the view
     $authenticator = \Request::getWord('authenticator', false);
     \Hubzero\Document\Assets::addComponentStylesheet('com_user', 'login.css');
     // Get the site name
     $sitename = \Config::get('sitename');
     // Get the display name for the current plugin being used
     $plugin = Plugin::byType('authentication', $authenticator);
     $pparams = new \Hubzero\Config\Registry($plugin->params);
     $display_name = $pparams->get('display_name', ucfirst($plugin->name));
     $this->assign('authenticator', $authenticator);
     $this->assign('sitename', $sitename);
     $this->assign('display_name', $display_name);
     parent::display($tpl);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:16,代码来源:view.html.php


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