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


PHP JUri::delVar方法代码示例

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


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

示例1: _buildDataObject

 /**
  * Create and return the pagination data object.
  *
  * @return  object  Pagination data object.
  *
  * @since   1.5
  */
 protected function _buildDataObject()
 {
     $data = new stdClass();
     if (!$this->uri) {
         $this->uri = KunenaRoute::$current;
     }
     // Build the additional URL parameters string.
     foreach ($this->additionalUrlParams as $key => $value) {
         $this->uri->setVar($key, $value);
     }
     $limitstartKey = $this->prefix . 'limitstart';
     $data->all = new JPaginationObject(JText::_('JLIB_HTML_VIEW_ALL'), $this->prefix);
     if (!$this->viewall) {
         $this->uri->delVar($limitstartKey, '');
         $data->all->base = '0';
         $data->all->link = JRoute::_((string) $this->uri);
     }
     // Set the start and previous data objects.
     $data->start = new JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix);
     $data->previous = new JPaginationObject(JText::_('JPREV'), $this->prefix);
     if ($this->pagesCurrent > 1) {
         $page = ($this->pagesCurrent - 2) * $this->limit;
         $this->uri->setVar($limitstartKey, '0');
         $data->start->base = '0';
         $data->start->link = JRoute::_((string) $this->uri);
         $this->uri->setVar($limitstartKey, $page);
         $data->previous->base = $page;
         $data->previous->link = JRoute::_((string) $this->uri);
     }
     // Set the next and end data objects.
     $data->next = new JPaginationObject(JText::_('JNEXT'), $this->prefix);
     $data->end = new JPaginationObject(JText::_('JLIB_HTML_END'), $this->prefix);
     if ($this->pagesCurrent < $this->pagesTotal) {
         $next = $this->pagesCurrent * $this->limit;
         $end = ($this->pagesTotal - 1) * $this->limit;
         $this->uri->setVar($limitstartKey, $next);
         $data->next->base = $next;
         $data->next->link = JRoute::_((string) $this->uri);
         $this->uri->setVar($limitstartKey, $end);
         $data->end->base = $end;
         $data->end->link = JRoute::_((string) $this->uri);
     }
     $data->pages = array();
     $range = range($this->pagesStart, $this->pagesStop);
     $range[] = 1;
     $range[] = $this->pagesTotal;
     sort($range);
     foreach ($range as $i) {
         $offset = ($i - 1) * $this->limit;
         $data->pages[$i] = new JPaginationObject($i, $this->prefix);
         if ($i != $this->pagesCurrent || $this->viewall) {
             $this->uri->setVar($limitstartKey, $offset);
             $data->pages[$i]->base = $offset;
             $data->pages[$i]->link = JRoute::_((string) $this->uri);
         } elseif ($i == $this->pagesCurrent) {
             $data->pages[$i]->active = true;
         }
     }
     return $data;
 }
开发者ID:proyectoseb,项目名称:University,代码行数:67,代码来源:pagination.php

示例2: testDelVar

 /**
  * Test the delVar method.
  *
  * @return  void
  *
  * @since   11.1
  * @covers  JUri::delVar
  */
 public function testDelVar()
 {
     $this->object->parse('http://someuser:somepass@www.example.com:80/path/file.html?var=value#fragment');
     $this->assertThat($this->object->getVar('var'), $this->equalTo('value'));
     $this->object->delVar('var');
     $this->assertThat($this->object->getVar('var'), $this->equalTo(''));
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:15,代码来源:JURITest.php

示例3: getRemote

 /**
  * @param JUri $uri
  *
  * @throws RuntimeException
  *
  * @return mixed
  */
 protected function getRemote($uri, $persistent = false)
 {
     $uri->setScheme('https');
     $uri->setHost('www.warcraftlogs.com');
     $this->url = $uri->toString();
     $result = parent::getRemote($this->url, $persistent);
     $result->body = json_decode($result->body);
     if ($result->code != 200) {
         // hide api key from normal users
         if (!JFactory::getUser()->get('isRoot')) {
             $uri->delVar('api_key');
             $this->url = $uri->toString();
         }
         $msg = JText::sprintf('Server Error: %s url: %s', $result->body->error, JHtml::_('link', $this->url, $result->code, array('target' => '_blank')));
         // TODO JText::_()
         throw new RuntimeException($msg);
     }
     return $result;
 }
开发者ID:b2un0,项目名称:joomla-plugin-system-wow,代码行数:26,代码来源:warcraftlogs.php

示例4: redirectBack

 /**
  * Redirect back to the referrer page.
  *
  * If there's no referrer or it's external, Kunena will return to forum home page.
  * Also redirects back to tasks are prevented.
  *
  * @param string $anchor
  */
 protected function redirectBack($anchor = '')
 {
     $default = JUri::base() . ($this->app->isSite() ? ltrim(KunenaRoute::_('index.php?option=com_kunena'), '/') : '');
     $referrer = $this->app->input->server->getString('HTTP_REFERER');
     $uri = JUri::getInstance($referrer ? $referrer : $default);
     if (JUri::isInternal($uri->toString())) {
         // Parse route.
         $vars = $this->app->getRouter()->parse($uri);
         $uri = new JUri('index.php');
         $uri->setQuery($vars);
         // Make sure we do not return into a task.
         $uri->delVar('task');
         $uri->delVar(JSession::getFormToken());
     } else {
         $uri = JUri::getInstance($default);
     }
     if ($anchor) {
         $uri->setFragment($anchor);
     }
     $this->app->redirect(JRoute::_($uri->toString()));
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:29,代码来源:view.html.php

示例5: getReferrer

	/**
	 * Get the referrer page.
	 *
	 * If there's no referrer or it's external, Kunena will return default page.
	 * Also referrers back to tasks are removed.
	 *
	 * @param string $default  Default page to return into.
	 * @param string $anchor   Anchor (location in the page).
	 *
	 * @return string
	 */
	public static function getReferrer($default = null, $anchor = null)
	{
		$app = JFactory::getApplication();

		$referrer = $app->input->server->getString('HTTP_REFERER');

		if ($referrer)
		{
			$uri = new JUri($referrer);

			// Make sure we do not return into a task -- or if task is SEF encoded, make sure it fails.
			$uri->delVar('task');
			$uri->delVar(JSession::getFormToken());

			// Check that referrer was from the same domain and came from the Joomla frontend or backend.
			$base = $uri->toString(array('scheme', 'host', 'port', 'path'));
			$host = $uri->toString(array('scheme', 'host', 'port'));

			// Referrer should always have host set and it should come from the same base address.
			if (empty($host) || stripos($base, JUri::base()) !== 0)
			{
				$uri = null;
			}
		}

		if (!isset($uri))
		{
			if ($default == null)
			{
				$default = $app->isSite() ? 'index.php?option=com_kunena' : 'administrator/index.php?option=com_kunena';
			}

			$default = self::_($default);
			$uri = new JUri($default);
		}

		if ($anchor)
		{
			$uri->setFragment($anchor);
		}

		return $uri->toString(array('path', 'query', 'fragment'));
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:54,代码来源:route.php

示例6: _getPrototypeURIForPagination

 /**
  * Returns a JUri instance with a prototype URI used as the base for the
  * other URIs created by the JSON renderer
  *
  * @return  JUri  The prototype JUri instance
  */
 protected function _getPrototypeURIForPagination()
 {
     $protoUri = new JUri('index.php');
     $protoUri->setQuery($this->input->getData());
     $protoUri->delVar('savestate');
     $protoUri->delVar('base_path');
     return $protoUri;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:14,代码来源:json.php

示例7: testALegacyComponentRoutersPreprocessMethodIsExecuted

 /**
  * Tests the buildRawRoute() method
  *
  * @return  void
  * @testdox JRouterSite::buildRawRoute() executes a legacy component router's preprocess method
  * @since   3.4
  */
 public function testALegacyComponentRoutersPreprocessMethodIsExecuted()
 {
     $uri = new JUri('index.php');
     $object = new JRouterSite(array(), $this->getMockCmsApp(), TestMockMenu::create($this));
     $buildRawRouteMethod = new ReflectionMethod('JRouterSite', 'buildRawRoute');
     $buildRawRouteMethod->setAccessible(true);
     $uri->setVar('option', 'com_test3');
     $uri->delVar('testvar');
     $buildRawRouteMethod->invokeArgs($object, array(&$uri));
     $this->assertEquals('index.php?option=com_test3', (string) $uri);
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:18,代码来源:JRouterSiteTest.php

示例8: buildRule

 /**
  * @param plgSystemCommunityBuilder $router
  * @param JUri $uri
  */
 public function buildRule(&$router, &$uri)
 {
     $app = JFactory::getApplication();
     if ($app->isSite() && $this->isRerouteSafe()) {
         if ($uri->getVar('option') == 'com_users') {
             $uri->setVar('option', 'com_comprofiler');
             $view = $uri->getVar('task');
             if (!$view) {
                 $view = $uri->getVar('view');
             }
             switch ($view) {
                 case 'profile':
                     if ($uri->getVar('layout') == 'edit') {
                         $userId = (int) $uri->getVar('user_id');
                         $task = 'userdetails';
                         if ($userId) {
                             $task .= '&user=' . $userId;
                         }
                     } else {
                         $task = 'userprofile';
                     }
                     break;
                 case 'registration':
                     $task = 'registers';
                     break;
                 case 'reset':
                 case 'remind':
                     $task = 'lostpassword';
                     break;
                 case 'logout':
                     $task = 'logout';
                     break;
                 case 'login':
                 default:
                     $task = 'login';
                     break;
             }
             $uri->delVar('task');
             $uri->delVar('view');
             $uri->delVar('layout');
             if ($task) {
                 $uri->setVar('view', $task);
             }
             $Itemid = $uri->getVar('Itemid');
             if (!$Itemid) {
                 $Itemid = $this->params->get('itemids', 1) ? $this->getItemid($task) : null;
             }
             $uri->delVar('Itemid');
             if ($Itemid) {
                 $uri->setVar('Itemid', $Itemid);
             }
         }
     }
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:58,代码来源:communitybuilder.php

示例9: smartUrlConvertor

 /**
  * smartUrlConvertor
  *
  * @param JUri  $uri
  * @param array $button
  *
  * @return  mixed
  */
 public function smartUrlConvertor($uri, $button)
 {
     // fix task redirect
     if ($uri->getVar('layout') == 'edit') {
         $uri->setVar('task', "{$uri->getVar('view')}.{$uri->getVar('layout')}");
         $uri->delVar('view');
         $uri->delVar('layout');
     }
     return $uri;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:18,代码来源:model.php


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