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


PHP KRequest::url方法代码示例

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


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

示例1: _actionApply

 protected function _actionApply(KCommandContext $context)
 {
     $data = $context->caller->execute('edit', $context);
     $url = clone KRequest::url();
     $this->setRedirect($url);
     return $data;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:7,代码来源:editable.php

示例2: _actionRequest

 protected function _actionRequest(KCommandContext $context)
 {
     if (!($email = KRequest::get('post.email', 'email'))) {
         $this->setRedirect(KRequest::referrer(), JText::_('INVALID_EMAIL_ADDRESS'), 'error');
         return false;
     }
     $user = $this->getService('com://site/users.model.users')->set('email', $email)->getItem();
     if (!$user->id || $user->block) {
         $this->setRedirect(KRequest::referrer(), JText::_('COULD_NOT_FIND_USER'), 'error');
         return false;
     }
     $helper = $this->getService('com://site/users.helper.password');
     $token = $helper->getHash($helper->getRandom());
     $salt = $helper->getSalt($token);
     $user->activation = md5($token . $salt) . ':' . $salt;
     $user->save();
     $configuration = JFactory::getConfig();
     $site_name = $configuration->getValue('sitename');
     $site_url = KRequest::url()->get(KHttpUrl::SCHEME | KHttpUrl::HOST | KHttpUrl::PORT);
     $url = $site_url . JRoute::_('index.php?option=com_users&view=reset&layout=confirm');
     $from_email = $configuration->getValue('mailfrom');
     $from_name = $configuration->getValue('fromname');
     $subject = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TITLE', $site_name);
     $body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $site_name, $token, $url);
     if (!JUtility::sendMail($from_email, $from_name, $email, $subject, $body)) {
         $this->setRedirect(KRequest::referrer(), JText::_('ERROR_SENDING_CONFIRMATION_EMAIL'), 'error');
         return false;
     } else {
         $this->_redirect = 'index.php?option=com_users&view=reset&layout=confirm';
     }
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:31,代码来源:reset.php

示例3: sort

 /**
  * Render a sorting header
  * more language string suckyneess
  *
  * @param 	array 	An optional array with configuration options
  * @return	string	Html
  */
 public function sort($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('title' => '', 'column' => '', 'direction' => 'asc', 'sort' => ''));
     //Set the title
     if (empty($config->title)) {
         $config->title = ucfirst($config->column);
     }
     //Set the direction
     $direction = strtolower($config->direction);
     $direction = in_array($direction, array('asc', 'desc')) ? $direction : 'asc';
     //Set the class
     $class = '';
     if ($config->column == $config->sort) {
         $direction = $direction == 'desc' ? 'asc' : 'desc';
         // toggle
         $class = 'class="-koowa-' . $direction . '"';
     }
     $url = clone KRequest::url();
     $query = $url->getQuery(1);
     $query['sort'] = $config->column;
     $query['direction'] = $direction;
     $url->setQuery($query);
     $html = '<a href="' . $url . '" title="' . JText::_('COM_PORTFOLIO_CLICK_TO_SORT') . '"  ' . $class . '>';
     $html .= JText::_($config->title);
     $html .= '</a>';
     return $html;
 }
开发者ID:ravenlife,项目名称:Portfolio,代码行数:35,代码来源:grid.php

示例4: 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

示例5: display

 public function display()
 {
     $items = $this->getModel()->getList();
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
     $xml .= '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
     $xml .= '<channel>';
     $xml .= '<title>Posts RSS feed</title>';
     $xml .= '<description>RSS description</description>';
     $xml .= '<generator>' . JURI::base() . '</generator>';
     foreach ($items as $item) {
         $xml .= '<item>';
         $xml .= '<title>' . htmlspecialchars($item->title) . '</title>';
         $xml .= '<link>' . $root . JRoute::_('index.php?option=com_ninjaboard&view=topic&id=' . $item->ninjaboard_topic_id . '&post=' . $item->id . '#p' . $item->id) . '</link>';
         $xml .= '<description>' . htmlspecialchars(KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->text))) . '</description>';
         $xml .= '<guid isPermaLink="false">' . $item->uuid . '</guid>';
         $xml .= '<media:title>' . htmlspecialchars($item->title) . '</media:title> ';
         $xml .= '<media:content url="' . $root . JRoute::_('index.php?option=com_ninjaboard&view=avatar&id=' . $item->created_by . '&format=file') . '"/>';
         $xml .= '</item>';
     }
     $xml .= '</channel>';
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:25,代码来源:rss.php

示例6: 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

示例7: redirectHttps

 /**
  * Redirects to HTTPs 
  * 
  * @param KCommandContext $context
  * 
  * @return void
  */
 public function redirectHttps(KCommandContext $context)
 {
     if (KRequest::url()->scheme == 'http') {
         $url = clone KRequest::url();
         $url->scheme = 'https';
         $context->response->setRedirect($url);
         return false;
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:16,代码来源:dispatcher.php

示例8: _actionDispatch

 /**
  * Dispatch the controller and redirect
  * 
  * This function divert the standard behavior and will redirect if no view
  * information can be found in the request.
  * 
  * @param   string      The view to dispatch. If null, it will default to
  *                      retrieve the controller information from the request or
  *                      default to the component name if no controller info can
  *                      be found.
  *
  * @return  KDispatcherDefault
  */
 protected function _actionDispatch(KCommandContext $context)
 {
     //Redirect if no view information can be found in the request
     if (!KRequest::has('get.view')) {
         $url = clone KRequest::url();
         $url->query['view'] = $this->getController()->getView()->getName();
         JFactory::getApplication()->redirect($url);
     }
     return parent::_actionDispatch($context);
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:23,代码来源:dispatcher.php

示例9: _validate

 /**
  * Validate a value
  *
  * @param   scalar  Value to be validated
  * @return  bool    True when the variable is valid
  */
 protected function _validate($value)
 {
     if (!is_string($value)) {
         return false;
     }
     if (stripos($value, (string) dirname(KRequest::url()->get(KHttpUrl::BASE))) !== 0) {
         return false;
     }
     return true;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:16,代码来源:internalurl.php

示例10: _validate

 /**
  * Validate a value
  *
  * @param   scalar  Value to be validated
  * @return  bool    True when the variable is valid
  */
 protected function _validate($value)
 {
     if (!is_string($value)) {
         return false;
     }
     if (stripos($value, (string) KRequest::url()->get(KHttpUrl::AUTHORITY)) !== 0) {
         return false;
     }
     return true;
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:16,代码来源:internalurl.php

示例11: setCanonical

 /**
  * Set the canonical meta info to eliminate duplicate content
  */
 public function setCanonical(KCommandContext $context)
 {
     $document = KFactory::get('lib.joomla.document');
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $base = 'index.php?option=com_ninjaboard&view=forum';
     //@TODO figure out a way to get the states from the posts model
     $canonical = $root . JRoute::_($base . '&id=' . $context->result->id);
     if (method_exists($document, 'addCustomTag')) {
         $document->addCustomTag('<link rel="canonical" href="' . $canonical . '" />');
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:14,代码来源:forum.php

示例12: _actionDispatch

 /**
  * Dispatch the controller and redirect
  * 
  * This function divert the standard behavior and will redirect if no view
  * information can be found in the request.
  * 
  * @param   string      The view to dispatch. If null, it will default to
  *                      retrieve the controller information from the request or
  *                      default to the component name if no controller info can
  *                      be found.
  *
  * @return  KDispatcherDefault
  */
 protected function _actionDispatch(KCommandContext $context)
 {
     //Redirect if no view information can be found in the request
     if (!KRequest::has('get.view')) {
         $view = count($context->data) ? $context->data : $this->_controller_default;
         $url = clone KRequest::url();
         $url->query['view'] = $view;
         KFactory::get('lib.joomla.application')->redirect($url);
     }
     return parent::_actionDispatch($context);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:24,代码来源:dispatcher.php

示例13: _actionPurge

 protected function _actionPurge(KCommandContext $context)
 {
     //Purge the cache
     if (JFactory::getCache('')->gc()) {
         $this->_redirect_message = JText::_('Expired items have been purged');
     } else {
         $this->_redirect_message = JText::_('Error purging expired items');
     }
     $this->_redirect = KRequest::url();
     return true;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:11,代码来源:default.php

示例14: getLink

 public function getLink()
 {
     // Unset limit and offset
     $url = clone KRequest::url();
     $query = parse_str($url->getQuery(), $vars);
     unset($vars['limit']);
     unset($vars['offset']);
     $vars['format'] = 'csv';
     $url->setQuery(http_build_query($vars));
     return (string) $url;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:11,代码来源:csv.php

示例15: setCanonical

 /**
  * Set the canonical meta info to eliminate duplicate content
  */
 public function setCanonical(KCommandContext $context)
 {
     $document = KFactory::get('lib.joomla.document');
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $base = 'index.php?option=com_ninjaboard&view=topic';
     $append = $this->getRequest()->layout != 'default' ? '&layout=' . $this->getRequest()->layout : '';
     $state = $this->getModel()->getState();
     $canonical = $root . JRoute::_($base . '&id=' . $context->id . '&limit=' . $state->limit . '&offset=' . $state->offset . $append);
     if (method_exists($document, 'addCustomTag')) {
         $document->addCustomTag('<link rel="canonical" href="' . $canonical . '" />');
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:15,代码来源:topic.php


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