本文整理汇总了PHP中JUri::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::getQuery方法的具体用法?PHP JUri::getQuery怎么用?PHP JUri::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::getQuery方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalize
/**
* @param JUri $uri
* @param bool $object
*
* @return JUri|string
*/
public static function normalize($uri = null, $object = false)
{
if (self::$adminApp)
{
// Use default routing in administration
return $object ? $uri : 'index.php?' . $uri->getQuery ();
}
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
$uri = self::prepare($uri);
if (!$uri)
{
return false;
}
if (!$uri->getVar('Itemid'))
{
self::setItemID ( $uri );
}
$result = $object ? $uri : 'index.php?' . $uri->getQuery ();
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
return $result;
}
示例2: __construct
/**
* Constructor for the class.
*
* @param string $title The title of the node
* @param string $link The node link
* @param string $class The CSS class for the node
* @param boolean $active True if node is active, false otherwise
* @param string $target The link target
* @param string $titleicon The title icon for the node
*/
public function __construct($title, $link = null, $class = null, $active = false, $target = null, $titleicon = null)
{
$this->title = $titleicon ? $title . $titleicon : $title;
$this->link = JFilterOutput::ampReplace($link);
$this->class = $class;
$this->active = $active;
$this->id = null;
if (!empty($link) && $link !== '#') {
$uri = new JUri($link);
$params = $uri->getQuery(true);
$parts = array();
foreach ($params as $value) {
$parts[] = str_replace(array('.', '_'), '-', $value);
}
$this->id = implode('-', $parts);
}
$this->target = $target;
}
示例3: buildRule
/**
* @param JRouter $router
* @param JUri $uri
*/
function buildRule(&$router, &$uri)
{
$MobileJoomla_Device =& MobileJoomla::getDevice();
if ($MobileJoomla_Device['markup'] != $MobileJoomla_Device['default_markup']) {
switch ($uri->getVar('format')) {
case 'feed':
case 'json':
case 'xml':
return;
}
switch ($uri->getVar('type')) {
case 'rss':
case 'atom':
return;
}
if ((is_a($router, 'shRouter') || class_exists('Sh404sefClassRouter')) && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
$itemid = $uri->getVar('Itemid');
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItem($itemid);
$uri->setQuery($item->query);
$uri->setVar('Itemid', $itemid);
$uri->setVar('device', $MobileJoomla_Device['markup']);
} else {
$uri->setVar('device', $MobileJoomla_Device['markup']);
}
}
}
示例4: testGetQuery
/**
* Test the getQuery method.
*
* @return void
*
* @since 11.1
* @covers JUri::getQuery
*/
public function testGetQuery()
{
$this->object->parse('http://someuser:somepass@www.example.com:80/path/file.html?var=value#fragment');
$this->assertThat($this->object->getQuery(), $this->equalTo('var=value'));
$this->assertThat($this->object->getQuery(true), $this->equalTo(array('var' => 'value')));
}
示例5: _processBuildRules
/**
* Process the build uri query data based on custom defined rules
*
* @param JUri $uri The URI
*
* @return void
*/
protected function _processBuildRules($uri)
{
// Make sure any menu vars are used if no others are specified
if ($this->_mode != JROUTER_MODE_SEF && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
$app = JApplication::getInstance('site');
$menu = $app->getMenu();
// Get the active menu item
$itemid = $uri->getVar('Itemid');
$item = $menu->getItem($itemid);
if ($item) {
$uri->setQuery($item->query);
}
$uri->setVar('Itemid', $itemid);
}
// Process the attached build rules
parent::_processBuildRules($uri);
// Get the path data
$route = $uri->getPath();
if ($this->_mode == JROUTER_MODE_SEF && $route) {
if ($limitstart = $uri->getVar('limitstart')) {
$uri->setVar('start', (int) $limitstart);
$uri->delVar('limitstart');
}
}
$uri->setPath($route);
}
示例6: shSefRelToAbs
//.........这里部分代码省略.........
else
shRebuildVars( $shAppendString, $uri);
$pageInfo->shMosConfig_locale = $shOrigLang;
_log('Returning shSefRelToAbs 4 with '.$ret);
return $ret;
}
if (isset($option) && !($option=='com_content' && @$task == 'edit') && (strtolower($option) != 'com_sh404sef')) {
// V x 29/08/2007 23:19:48
// check also that option = com_content, otherwise, breaks some comp
switch ($shComponentType) {
case Sh404sefClassBaseextplugin::TYPE_SKIP : {
$sefstring = $shSaveString; // V 1.2.4.q : restore untouched URL, except anchor which will be added later
// J! 1.6 kill all query vars
$shGETVars = array();
$uri->setQuery( array());
break;
}
case Sh404sefClassBaseextplugin::TYPE_SIMPLE:
// check for custom urls
$sefstring = '';
$urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
// if no custom found, then build default url
if ($urlType != sh404SEF_URLTYPE_CUSTOM) {
// if not found then fall back to Joomla! SEF
if (isset($URI)) {
unset($URI);
}
$sefstring = 'component/';
$URI = new sh_Net_URL(shSortUrl($shSaveString)); // can't remove yet, anchor is use later down
$jUri = new JUri(shSortUrl($shSaveString));
$uriVars = $jUri->getQuery( $asArray = true);
if (count($uriVars) > 0) {
foreach($uriVars as $key => $value) {
if( is_array($value) ) {
foreach($value as $k=>$v) {
// fix for arrays, thanks doorknob
$sefstring .= $key.'[' . $k. '],'. $v . '/';
}
} else {
$sefstring .= $key.','.$value . '/';
}
}
$sefstring = str_replace( 'option,', '', $sefstring );
}
}
break;
default: {
$sefstring='';
// base case:
$urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
// first special case. User may have customized paginated urls
// this will be picked up by the line above, except if we're talking about
// a category or section blog layout, where Joomla does not uses the correct
// value for limit
if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty( $showall) && (!empty($limit) || (!isset($limit) && !empty($limitstart)))) {
if (($option == 'com_content' && isset($layout) && $layout == 'blog')
|| ($option == 'com_content' && isset( $view) && $view == 'frontpage' )) {
$listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
$tmpString = shSetURLVar( $string, 'limit', $listLimit);
$tmpString = shSortUrl($tmpString);
$urlType = shGetSefURLFromCacheOrDB($tmpString, $sefstring);
示例7: getCurrentURI
/**
* Generate a URI based on current URL.
*
* @param JUri $url
*
* @return string
*/
private function getCurrentURI(JUri $url)
{
$uri = $url->getPath();
if ($url->getQuery()) {
$uri .= "?" . $url->getQuery();
}
return $uri;
}
示例8: getPagination
/**
* Method to get a JPagination object for the data set.
*
* @return JPagination A JPagination object for the data set.
*/
public function getPagination()
{
if ($this->getState('list.limit', 20) == 0) {
return;
}
$pagination = parent::getPagination();
$pagination->prefix = 'slicomments';
$url = ContentHelperRoute::getArticleRoute($this->getState('article.slug'), $this->getState('article.catid'));
$uri = new JUri($url);
$query = $uri->getQuery(true);
foreach ($query as $key => $value) {
$pagination->setAdditionalUrlParam($key, $value);
}
return $pagination;
}
示例9: onJHarvestRetrieve
/**
* Captures the onJHarvestRetrieve event, retrieving records via the configured
* OpenSearch results.
*
* @param JObject $harvest The harvest information.
*/
public function onJHarvestRetrieve($harvest)
{
if ($harvest->get('params')->get('discovery.type') != 'opensearch') {
return;
}
$templateUrl = $harvest->get('params')->get('discovery.url');
$http = JHttpFactory::getHttp();
$parameters = array("{startIndex?}" => 0, "{startPage?}" => 0, "{count?}" => 100, "{language}" => urlencode(JFactory::getLanguage()->getName()), "{inputEncoding}" => "UTF-8", "{outputEncoding}" => "UTF-8");
$dom = new DomDocument();
$count = 0;
// the number of records to retrieve.
do {
$url = new JUri($templateUrl);
$queries = $url->getQuery(true);
foreach ($queries as $keyq => $valueq) {
if (array_key_exists($valueq, $parameters)) {
$queries[$keyq] = $parameters[$valueq];
}
}
$url->setQuery($queries);
$response = $http->get($url);
if ((int) $response->code === 200) {
$reader = new XMLReader();
$reader->xml($response->body);
while ($reader->read()) {
if ($reader->nodeType == XmlReader::ELEMENT) {
if ($reader->localName == 'entry') {
$entry = simplexml_import_dom($dom->importNode($reader->expand(), true));
$this->cache($harvest, $entry);
}
if ($reader->localName == 'item') {
$entry = simplexml_import_dom($dom->importNode($reader->expand(), true));
$this->cache($harvest, $entry);
}
if ($reader->localName == 'totalResults') {
$totalResults = simplexml_import_dom($dom->importNode($reader->expand(), true));
if (!$count) {
$count = (int) $totalResults;
}
}
}
}
}
$parameters['{startIndex?}'] += $parameters['{count?}'];
$parameters['{startPage?}'] += 1;
} while ($parameters['{startIndex?}'] < $count);
}