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


PHP KRequest::get方法代码示例

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


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

示例1: onBeforeDispatcherDispatch

 public function onBeforeDispatcherDispatch(KEvent $event)
 {
     $application = JFactory::getApplication();
     if ($application->getName() != 'site') {
         return;
     }
     //var_dump($_SERVER); exit();
     // check if SSO header is set
     $personnumber = KRequest::get('server.HTTP_P_SSO_IDENTIFIER', 'alnum');
     if (empty($personnumber) || !preg_match('/P\\d+/is', $personnumber)) {
         // TODO set proper http response
         throw new KException('Access not allowed');
     }
     // check if user is already logged in
     $user = JFactory::getUser();
     // make sure personnumber is still the same
     if (!$user->guest && $user->username != $personnumber) {
         $application->logout();
         $application->redirect(KRequest::url());
     }
     if ($user->guest) {
         $credentials = array('username' => $personnumber, 'password' => $personnumber);
         $result = $application->login($credentials, array());
         if (JError::isError($result)) {
             // TODO set proper http response
             throw new KException($result->getError());
         } else {
             $application->redirect('index.php');
         }
     }
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:31,代码来源:sso.php

示例2: display

 public function display()
 {
     //Set the document link
     $this->_document->link = $this->createRoute('format=html&view=posts&blog_blog_id=' . KRequest::get('get.id', 'int'));
     //Get the list of posts
     $posts = KFactory::get($this->getModel())->getList();
     foreach ($posts as $post) {
         // strip html from feed item title
         $title = html_entity_decode($post->title);
         // url link to article
         $link = $this->createRoute('format=html&view=post&slug=' . $post->slug);
         // generate the description as a hcard
         $description = $post->text;
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = date('r', strtotime($post->created_on));
         $item->category = '';
         // loads item info into rss array
         $doc =& JFactory::getDocument();
         $doc->addItem($item);
     }
     return $this;
 }
开发者ID:raeldc,项目名称:com_blog,代码行数:26,代码来源:feed.php

示例3: beforeAdd

 public function beforeAdd(KCommandContext $context)
 {
     if (!$context->data->file) {
         $context->data->file = KRequest::get('files.file.tmp_name', 'raw');
         $context->data->path = KRequest::get('files.file.name', 'koowa:filter.filename');
     }
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:7,代码来源:file.php

示例4: uploadAvatar

 /**
  * Upload the users avatar
  * 
  * @param	KCommandContext	A command context object
  * @return 	void
  */
 public function uploadAvatar(KCommandContext $context)
 {
     $avatar = KRequest::get('files.avatar', 'raw');
     if (!$avatar['name']) {
         return;
     }
     //Prepare MediaHelper
     JLoader::register('MediaHelper', JPATH_ROOT . '/components/com_media/helpers/media.php');
     // is it an image
     if (!MediaHelper::isImage($avatar['name'])) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because it's not an image."), $avatar['name']));
         return;
     }
     // are we allowed to upload this filetype
     if (!MediaHelper::canUpload($avatar, $error)) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because %s"), $avatar['name'], lcfirst($error)));
         return;
     }
     // @todo put in some max file size checks
     $path = 'images/com_portfolio/avatars/' . $context->data->user_id . '/';
     $ext = JFile::getExt($avatar['name']);
     $name = JFile::makeSafe($this->getService('koowa:filter.slug')->sanitize($context->data->title) . '.' . $ext);
     JFile::upload($avatar['tmp_name'], JPATH_ROOT . '/' . $path . $name);
     $context->data->avatar = $path . $name;
 }
开发者ID:ravenlife,项目名称:Portfolio,代码行数:31,代码来源:person.php

示例5: display

 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->showtopics = false;
     if (isset($this->params['view_settings']['displayed_elements']) && $me->topic_permissions > 0) {
         if (in_array('showtopics', $this->params['view_settings']['displayed_elements'])) {
             $this->showtopics = true;
             //$state		= KFactory::get($this->getModel())->getState();
             /*$this->limit	= KRequest::get('get.limit', 'int', 10);
             		$this->offset	= KRequest::get('get.offset', 'int', 0);
             		$topicsmodel	= KFactory::tmp('site::com.ninjaboard.model.topics')
             							->limit($this->limit)
             							->offset($this->offset)
             							->sort('last_post_date')
             							->direction('desc');
             		$this->total	= $topicsmodel->getTotal();
             		$this->length	= KFactory::tmp('site::com.ninjaboard.model.topics')->getTotal();
             		
             		$this->assign('pagination', 
             			KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))
             				->pagination($this->total, $this->offset, $this->limit, 4)
             		);*/
             $this->limit = KRequest::get('get.limit', 'int', 10);
             $this->offset = KRequest::get('get.offset', 'int', 0);
             $this->total = KFactory::get('site::com.ninjaboard.model.topics')->getTotal();
             $this->assign('topics', KFactory::get('site::com.ninjaboard.controller.topic')->setView(KFactory::get('site::com.ninjaboard.view.topics.html'))->direction('desc')->sort('last_post_on')->limit($this->limit)->offset($this->offset)->layout('list')->display());
             $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))->pagination($this->total, $this->offset, $this->limit, 4, false));
         }
     }
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:32,代码来源:html.php

示例6: getOnClick

 public function getOnClick()
 {
     $id = KRequest::get('get.id', 'int');
     $token = JUtility::getToken();
     $json = "{method:'post', url:'index.php?option=com_create&view=component&id={$id}', formelem:'adminForm', params:{action:'generate', _token:'{$token}'}}";
     return 'new KForm(' . $json . ').submit();';
 }
开发者ID:rpijpers,项目名称:Create,代码行数:7,代码来源:generate.php

示例7: login

 /**
  * Logs in a user.
  *
  * @param array $user     The user as an array
  * @param bool  $remember Flag to whether remember the user or not
  *
  * @return bool
  */
 public function login(array $user, $remember = false)
 {
     $session =& JFactory::getSession();
     // we fork the session to prevent session fixation issues
     $session->fork();
     JFactory::getApplication()->_createSession($session->getId());
     // Import the user plugin group
     JPluginHelper::importPlugin('user');
     $options = array();
     $results = JFactory::getApplication()->triggerEvent('onLoginUser', array($user, $options));
     foreach ($results as $result) {
         if ($result instanceof JException || $result instanceof Exception || $result === false) {
             return false;
         }
     }
     //if remember is true, create a remember cookie that contains the ecrypted username and password
     if ($remember) {
         // Set the remember me cookie if enabled
         jimport('joomla.utilities.simplecrypt');
         jimport('joomla.utilities.utility');
         $key = JUtility::getHash(KRequest::get('server.HTTP_USER_AGENT', 'raw'));
         if ($key) {
             $crypt = new JSimpleCrypt($key);
             $cookie = $crypt->encrypt(serialize(array('username' => $user['username'], 'password' => $user['password'])));
             $lifetime = time() + 365 * 24 * 3600;
             setcookie(JUtility::getHash('JLOGIN_REMEMBER'), $cookie, $lifetime, '/');
         }
     }
     return true;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:38,代码来源:person.php

示例8: setPermissions

 /**
  * Generic function for setting the permissions
  *
  * @return void
  */
 public function setPermissions($context)
 {
     //Temp fix
     if (KInflector::isPlural(KRequest::get('get.view', 'cmd')) || KRequest::type() == 'AJAX') {
         return;
     }
     $model = KFactory::get($this->getModel());
     $table = KFactory::tmp(KFactory::get(KFactory::get('admin::com.ninja.helper.access')->models->assets)->getTable());
     $query = $table->getDatabase()->getQuery();
     $item = $model->getItem();
     $identifier = $this->getIdentifier();
     $id = $identifier->type . '_' . $identifier->package . '.' . $identifier->name . '.' . $item->id . '.';
     $permissions = (array) KRequest::get('post.permissions', 'int');
     $editable = KRequest::get('post.editpermissions', 'boolean', false);
     if (!$permissions && $editable) {
         $query->where('tbl.name', 'LIKE', $id . '%');
         $table->select($query)->delete();
     }
     $safe = array();
     $query = $table->getDatabase()->getQuery()->where('name', 'like', $id . '%');
     foreach ((array) KRequest::get('post.params.permissions', 'raw') as $group => $other) {
         $safe[] = $id . $group;
     }
     if ($safe) {
         $query->where('name', 'not in', $safe);
     }
     $table->select($query, KDatabase::FETCH_ROWSET)->delete();
     foreach ($permissions as $usergroup => $rules) {
         foreach ($rules as $name => $permission) {
             KFactory::tmp(KFactory::get('admin::com.ninja.helper.access')->models->assets)->name($id . $usergroup . '.' . $name)->getItem()->setData(array('name' => $id . $usergroup . '.' . $name, 'level' => $permission))->save();
         }
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:38,代码来源:forum.php

示例9: id

 /**
  * Helper for creating DOM element ids used by javascript behaviors
  *
  * If no type and package identifiers were supplied,
  * uses the current option $_GET variable, and changing com_foo_bar to com-foo_bar.
  * '-' are used as separators, and in our javascript used to parse identifier strings.
  * If a form got the id com-foo_bar-people, 
  * then we can assume that the toolbar will have the id toolbar-people,
  *
  * @author Stian Didriksen <stian@ninjaforge.com>
  * @param  array | int $parts
  * @return string
  */
 public function id($parts = array())
 {
     if (!is_array($parts) && is_int($parts)) {
         $parts['id'] = (int) $parts;
     }
     // If we pass a string, set $parts back as an array in order to proceed.
     if (!is_array($parts)) {
         settype($parts, 'array');
     }
     // Set the defaults, if needed
     $defaults = array();
     if (!isset($parts['type.package'])) {
         // We only want to replace the first underscore, not the rest.
         $defaults['type_package'] = str_replace('com_', 'com-', KRequest::get('get.option', 'cmd'));
     }
     if (!isset($parts['view'])) {
         $view = KRequest::get('get.view', 'cmd');
         // The view part always needs to be plural to allow ajax BREAD.
         if (KInflector::isSingular($view)) {
             $view = KInflector::pluralize($view);
         }
         $defaults['view'] = $view;
     }
     if (!isset($parts['id']) && KRequest::has('get.id', 'int')) {
         $defaults['id'] = KRequest::get('get.id', 'int');
     }
     // Filter away parts that are unset on purpose using a null value, or a negative boolean.
     return implode('-', array_filter(array_merge($defaults, $parts)));
 }
开发者ID:raeldc,项目名称:com_blog,代码行数:42,代码来源:behavior.php

示例10: display

 public function display()
 {
     $category = $this->getService('com://site/weblinks.model.categories')->getItem();
     $items = $this->getService('com://site/weblinks.model.weblinks')->catid(KRequest::get('get.id', 'int'))->getList();
     $xml = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
     $xml .= '<rss version="2.0">' . PHP_EOL;
     $xml .= '<channel>' . PHP_EOL;
     $xml .= '	<title>' . $category->title . '</title>' . PHP_EOL;
     $xml .= '	<description><![CDATA[' . $category->description . ']]></description>' . PHP_EOL;
     $xml .= '	<link>' . KRequest::url() . '</link>' . PHP_EOL;
     $xml .= '	<lastBuildDate>' . date('r') . '</lastBuildDate>' . PHP_EOL;
     $xml .= '	<generator>' . JURI::base() . '</generator>' . PHP_EOL;
     $xml .= '	<language>' . JFactory::getLanguage()->getTag() . '</language>' . PHP_EOL;
     foreach ($items as $item) {
         $xml .= '	<item>' . PHP_EOL;
         $xml .= '		<title>' . htmlspecialchars($item->title) . '</title>' . PHP_EOL;
         $xml .= '		<link>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</link>' . PHP_EOL;
         $xml .= '		<guid>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</guid>' . PHP_EOL;
         $xml .= '		<description><![CDATA[' . htmlspecialchars($item->description) . ']]></description>' . PHP_EOL;
         $xml .= '		<category>' . $category->title . '</category>' . PHP_EOL;
         $xml .= '		<pubDate>' . date('r', strtotime($item->date)) . '</pubDate>' . PHP_EOL;
         $xml .= '	</item>' . PHP_EOL;
     }
     $xml .= '</channel>' . PHP_EOL;
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:28,代码来源:rss.php

示例11: translations

 public function translations($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('row' => null, 'table' => ''));
     // First for our knowledge we get the original language (if exists.)
     $original = $this->_getOriginalLanguage($config->row, $config->table);
     $html = '<style src="media://com_translations/css/translations.css" />';
     $view = KInflector::singularize(KRequest::get('get.view', 'string'));
     foreach ($this->_getLanguages() as $language) {
         $relation = $this->_getLanguage($config, $language->lang_code);
         if ($language->lang_code == $original->iso_code) {
             $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-info">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
         } else {
             if ($relation->translated) {
                 $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-success">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
             } else {
                 if (strtotime('+ 2 weeks', strtotime($original->created_on)) > strtotime(date('d-m-Y H:i:s'))) {
                     $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-warning">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                 } else {
                     if (strtotime('+ 2 weeks', strtotime($original->created_on)) < strtotime(date('d-m-Y H:i:s'))) {
                         $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-important">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                     }
                 }
             }
         }
     }
     return $html;
 }
开发者ID:kedweber,项目名称:com_translations,代码行数:28,代码来源:language.php

示例12: __construct

 /**
  * Constructor
  *
  * @param   object  An optional KConfig object with configuration options.
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     if (KRequest::get('get.action', 'cmd') == 'update') {
         $this->setAction('update');
     }
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:12,代码来源:dashboard.php

示例13: render

 public function render()
 {
     $name = $this->getName();
     $img = KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', '/32/' . $name . '.png');
     if ($img) {
         KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.css', '.toolbar .icon-32-' . $name . ' { background-image: url(' . $img . '); }');
     }
     $text = JText::_($this->_options['text']);
     $view = KRequest::get('get.view', 'cmd');
     $link = ' href="' . JRoute::_($this->getLink()) . '"';
     $html = array();
     // Sanitize the url since we can't trust the server var
     $url = KFactory::get('lib.koowa.filter.url')->sanitize($this->getLink());
     // Create the URI object
     $uri = KFactory::tmp('lib.koowa.http.uri', array('uri' => $url));
     $query = $uri->getQuery(1);
     $html[] = '<td class="button" id="' . $this->getId() . '">';
     $active = $view == KInflector::variablize(KInflector::pluralize($query['view'])) || $view == KInflector::variablize(KInflector::singularize($query['view']));
     $hide = !KInflector::isPlural($view);
     if ($active || $hide || !$this->modal) {
         $html[] = '<a class="toolbar inactive">';
     } else {
         $html[] = '<a' . $link . ' onclick="' . $this->getOnClick() . '" class="toolbar">';
     }
     $html[] = '<span class="' . $this->getClass() . '" title="' . $text . '">';
     $html[] = '</span>';
     $html[] = $text;
     if (!$active && !$hide || $this->modal) {
         $html[] = '</a>';
     } else {
         $html[] = '</a>';
     }
     $html[] = '</td>';
     return implode(PHP_EOL, $html);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:35,代码来源:link.php

示例14: uploadIcon

 /**
  * Upload an icon for a work
  * 
  * @param   KCommandContext A command context object
  * @return  void
  */
 public function uploadIcon(KCommandContext $context)
 {
     $icon = KRequest::get('files.icon', 'raw');
     if (!$icon['name']) {
         return;
     }
     //Prepare MediaHelper
     JLoader::register('MediaHelper', JPATH_ROOT . '/components/com_media/helpers/media.php');
     // is it an image
     if (!MediaHelper::isImage($icon['name'])) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because it's not an image."), $icon['name']));
         return;
     }
     // are we allowed to upload this filetype
     if (!MediaHelper::canUpload($icon, $error)) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because %s"), $icon['name'], lcfirst($error)));
         return;
     }
     $slug = $this->getService('koowa:filter.slug');
     $path = 'images/com_portfolio/work/' . $slug->sanitize($context->data->title) . '/icon/';
     $ext = JFile::getExt($icon['name']);
     $name = JFile::makeSafe($slug->sanitize($context->data->title) . '.' . $ext);
     JFile::upload($icon['tmp_name'], JPATH_ROOT . '/' . $path . $name);
     $context->data->icon = $path . $name;
 }
开发者ID:ravenlife,项目名称:Portfolio,代码行数:31,代码来源:work.php

示例15: display

 public function display()
 {
     $targets = KFactory::tmp('site::com.stream.model.targets')->getList()->getData();
     $thing = reset($targets);
     $string = substr($thing['title'], 3);
     $option = strtolower(substr($string, 0, stripos($string, 'controller')));
     $view = strtolower(substr($string, stripos($string, 'controller') + 10));
     $model = KInflector::pluralize($view);
     $list = KFactory::tmp('site::com.' . $option . '.model.' . $model)->getList()->getData();
     $array = array();
     foreach ($list as $item) {
         $array[] = $item['id'];
     }
     //Get the list of posts
     $activities = KFactory::get($this->getModel())->set('parent_target_id', KRequest::get('get.parent_target_id', 'int'))->getList();
     $myactivities = array();
     foreach (@$activities as $activity) {
         if (!in_array($activity->parent_target_id, $array)) {
             continue;
         } else {
             $myactivities[] = $activity;
         }
     }
     $this->assign('myactivities', $myactivities);
     $this->assign('pagination', KFactory::get($this->getModel())->getState()->pagination);
     return parent::display();
 }
开发者ID:raeldc,项目名称:com_stream,代码行数:27,代码来源:html.php


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