本文整理汇总了PHP中Piwik_Url::getArrayFromCurrentQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::getArrayFromCurrentQueryString方法的具体用法?PHP Piwik_Url::getArrayFromCurrentQueryString怎么用?PHP Piwik_Url::getArrayFromCurrentQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::getArrayFromCurrentQueryString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_allMethods
/**
* display output of all methods
*/
public function test_allMethods()
{
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
$this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified(array()), Piwik_Url::getCurrentQueryString());
$expectedUrl = parse_url(Piwik_Url::getCurrentUrl());
$port = isset($expectedUrl['port']) ? ":{$expectedUrl['port']}" : '';
$expectedUrl = $expectedUrl['scheme'] . '://' . $expectedUrl['host'] . $port . $expectedUrl['path'];
$this->assertEqual($expectedUrl, Piwik_Url::getCurrentUrlWithoutQueryString());
$this->assertEqual($expectedUrl, Piwik_Url::getCurrentScheme() . '://' . Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName());
print "<br/>\nPiwik_Url::getCurrentUrl() -> " . Piwik_Url::getCurrentUrl();
print "<br/>\nPiwik_Url::getCurrentUrlWithoutQueryString() -> " . Piwik_Url::getCurrentUrlWithoutQueryString();
print "<br/>\nPiwik_Url::getCurrentUrlWithoutFileName() -> " . Piwik_Url::getCurrentUrlWithoutFileName();
print "<br/>\nPiwik_Url::getCurrentScriptPath() -> " . Piwik_Url::getCurrentScriptPath();
print "<br/>\nPiwik_Url::getCurrentHost() -> " . Piwik_Url::getCurrentHost();
print "<br/>\nPiwik_Url::getCurrentScriptName() -> " . Piwik_Url::getCurrentScriptName();
print "<br/>\nPiwik_Url::getCurrentQueryString() -> " . Piwik_Url::getCurrentQueryString();
print "<br/>\nPiwik_Url::getArrayFromCurrentQueryString() -> ";
var_dump(Piwik_Url::getArrayFromCurrentQueryString());
print "<br/>\nPiwik_Url::getCurrentQueryStringWithParametersModified() -> " . Piwik_Url::getCurrentQueryStringWithParametersModified(array());
echo "<br/>\n\n";
// setting parameter to null should remove it from url
// test on Url.test.php?test=value
$parameters = array_keys(Piwik_Url::getArrayFromCurrentQueryString());
$parametersNameToValue = array();
foreach ($parameters as $name) {
$parametersNameToValue[$name] = null;
}
$this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified($parametersNameToValue), '');
}
示例2: testAllMethods
/**
* @group Core
* @group Url
*/
public function testAllMethods()
{
$this->assertEquals(Piwik_Url::getCurrentQueryStringWithParametersModified(array()), Piwik_Url::getCurrentQueryString());
$this->assertEquals(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentUrlWithoutQueryString());
$this->assertEquals(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentScheme() . '://' . Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName());
$_SERVER['QUERY_STRING'] = 'q=test';
$parameters = array_keys(Piwik_Url::getArrayFromCurrentQueryString());
$parametersNameToValue = array();
foreach ($parameters as $name) {
$parametersNameToValue[$name] = null;
}
$this->assertEquals('', Piwik_Url::getCurrentQueryStringWithParametersModified($parametersNameToValue));
}
示例3: test_allMethods
/**
* display output of all methods
*/
public function test_allMethods()
{
$this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified(array()), Piwik_Url::getCurrentQueryString());
$this->assertEqual(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentUrlWithoutQueryString());
$this->assertEqual(Piwik_Url::getCurrentUrl(), Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName());
print "<br>\nPiwik_Url::getCurrentQueryStringWithParametersModified() " . Piwik_Url::getCurrentQueryStringWithParametersModified(array());
print "<br>\nPiwik_Url::getCurrentUrl() " . Piwik_Url::getCurrentUrl();
print "<br>\nPiwik_Url::getCurrentUrlWithoutQueryString() " . Piwik_Url::getCurrentUrlWithoutQueryString();
print "<br>\nPiwik_Url::getCurrentUrlWithoutFileName() " . Piwik_Url::getCurrentUrlWithoutFileName();
print "<br>\nPiwik_Url::getCurrentScriptName() " . Piwik_Url::getCurrentScriptName();
print "<br>\nPiwik_Url::getCurrentScriptPath() " . Piwik_Url::getCurrentScriptPath();
print "<br>\nPiwik_Url::getCurrentHost() " . Piwik_Url::getCurrentHost();
print "<br>\nPiwik_Url::getCurrentQueryString() " . Piwik_Url::getCurrentQueryString();
print "<br>\nPiwik_Url::getArrayFromCurrentQueryString() ";
var_dump(Piwik_Url::getArrayFromCurrentQueryString());
// setting parameter to null should remove it from url
// test on Url.test.php?test=value
$parameters = array_keys(Piwik_Url::getArrayFromCurrentQueryString());
$parametersNameToValue = array();
foreach ($parameters as $name) {
$parametersNameToValue[$name] = null;
}
$this->assertEqual(Piwik_Url::getCurrentQueryStringWithParametersModified($parametersNameToValue), '');
}
示例4: getQueryStringAsHash
/**
* We link the graph dots to the same report as currently being displayed (only the date would change).
*
* In some cases the widget is loaded within a report that doesn't exist as such.
* For example, the dashboards loads the 'Last visits graph' widget which can't be directly linked to.
* Instead, the graph must link back to the dashboard.
*
* In other cases, like Visitors>Overview or the Goals graphs, we can link the graph clicks to the same report.
*
* To detect whether or not we can link to a report, we simply check if the current URL from which it was loaded
* belongs to the menu or not. If it doesn't belong to the menu, we do not append the hash to the URL,
* which results in loading the dashboard.
*
* @return array Query string array to append to the URL hash or false if the dashboard should be displayed
*/
private function getQueryStringAsHash()
{
$queryString = Piwik_Url::getArrayFromCurrentQueryString();
$piwikParameters = array('idSite', 'date', 'period', 'XDEBUG_SESSION_START', 'KEY');
foreach ($piwikParameters as $parameter) {
unset($queryString[$parameter]);
}
if (Piwik_IsMenuUrlFound($queryString)) {
return $queryString;
}
return false;
}