本文整理汇总了PHP中Piwik_Url::getCurrentQueryStringWithParametersModified方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::getCurrentQueryStringWithParametersModified方法的具体用法?PHP Piwik_Url::getCurrentQueryStringWithParametersModified怎么用?PHP Piwik_Url::getCurrentQueryStringWithParametersModified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::getCurrentQueryStringWithParametersModified方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: buildView
protected function buildView()
{
$view = new Piwik_View($this->dataTableTemplate);
$this->uniqueIdViewDataTable = $this->getUniqueIdViewDataTable();
$view->graphType = $this->graphType;
$this->chartDivId = $this->uniqueIdViewDataTable . "Chart_swf";
$this->parametersToModify['action'] = $this->currentControllerAction;
$this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($this->parametersToModify);
$this->includeData = !Zend_Registry::get('config')->Debug->disable_merged_requests;
$idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
Piwik_API_Request::reloadAuthUsingTokenAuth();
if (!Piwik::isUserHasViewAccess($idSite)) {
throw new Exception(Piwik_TranslateException('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idSite)));
}
if ($this->includeData) {
$this->chartData = $this->getFlashData();
} else {
$this->chartData = null;
}
$view->flashParameters = $this->getFlashParameters();
$view->urlGraphData = $url;
$view->chartDivId = $this->chartDivId;
$view->formEmbedId = "formEmbed" . $this->uniqueIdViewDataTable;
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->properties = $this->getViewProperties();
return $view;
}
示例3: init
function init()
{
$this->addElement('text', 'form_login')
->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('General_Username')));
$password = $this->addElement('password', 'form_password');
$password->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_Password')));
$passwordBis = $this->addElement('password', 'form_password_bis');
$passwordBis->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordRepeat')));
$passwordBis->addRule('eq', Piwik_Translate( 'Login_PasswordsDoNotMatch'), $password);
$this->addElement('text', 'form_token')
->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordResetToken')));
$this->addElement('hidden', 'form_nonce');
$this->addElement('submit', 'submit');
$resetToken = Piwik_Common::getRequestVar('token', '', 'string');
if(!empty($resetToken)) {
// default values
$this->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'form_token' => $resetToken,
)));
$this->attributes['action'] = 'index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified( array('token' => null) );
}
}
示例4: smarty_function_hiddenurl
/**
* Smarty {hiddenurl} function plugin.
* Writes an input Hidden field for every parameter in the URL.
* Useful when using GET forms because we need to print the current parameters
* in hidden input so they are to the next URL after the form is submitted.
*
*
* Examples:
* <pre>
* {hiddenurl module="API"} with a URL 'index.php?action=test&module=CoreHome' will output
* <input type=hidden name=action value=test>
* <input type=hidden name=module value=API>
* </pre>
*
* Set a value to null if you want this value not to be passed in the submitted form.
*
* @param array
* @param Smarty
* @return string
*/
function smarty_function_hiddenurl($params, &$smarty)
{
$queryStringModified = Piwik_Url::getCurrentQueryStringWithParametersModified($params);
$urlValues = Piwik_Common::getArrayFromQueryString($queryStringModified);
$out = '';
foreach ($urlValues as $name => $value) {
$out .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
}
return $out;
}
示例5: 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));
}
示例6: buildView
protected function buildView()
{
$view = new Piwik_View($this->dataTableTemplate);
$this->uniqueIdViewDataTable = $this->getUniqueIdViewDataTable();
$view->graphType = $this->graphType;
$this->chartDivId = $this->uniqueIdViewDataTable . "Chart_swf";
$this->parametersToModify['action'] = $this->currentControllerAction;
$this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($this->parametersToModify);
$view->jsInvocationTag = $this->getFlashInvocationCode($url);
$view->urlGraphData = $url;
$view->chartDivId = $this->chartDivId;
$view->formEmbedId = "formEmbed" . $this->uniqueIdViewDataTable;
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->properties = $this->getViewProperties();
return $view;
}
示例7: setBasicVariablesAdminView
public static function setBasicVariablesAdminView($view)
{
$view->currentAdminMenuName = Piwik_GetCurrentAdminMenuName();
$view->enableFrames = Piwik_Config::getInstance()->General['enable_framed_settings'];
if (!$view->enableFrames) {
$view->setXFrameOptions('sameorigin');
}
$view->isSuperUser = Piwik::isUserIsSuperUser();
// for old geoip plugin warning
$view->usingOldGeoIPPlugin = Piwik_PluginsManager::getInstance()->isPluginActivated('GeoIP');
// for cannot find installed plugin warning
$missingPlugins = Piwik_PluginsManager::getInstance()->getMissingPlugins();
if (!empty($missingPlugins)) {
$pluginsLink = Piwik_Url::getCurrentQueryStringWithParametersModified(array('module' => 'CorePluginsAdmin', 'action' => 'index'));
$view->missingPluginsWarning = Piwik_Translate('CoreAdminHome_MissingPluginsWarning', array('<strong>' . implode('</strong>, <strong>', $missingPlugins) . '</strong>', '<a href="' . $pluginsLink . '"/>', '</a>'));
}
}
示例8: smarty_modifier_urlRewriteBasicView
/**
* Rewrites the given URL so that it looks like a URL that can be loaded directly.
* Useful for users who don't handle javascript / ajax, they can still use piwik with these rewritten URLs.
*
* @return string
*/
function smarty_modifier_urlRewriteBasicView($parameters)
{
// replace module=X by moduleToLoad=X
// replace action=Y by actionToLoad=Y
$parameters['moduleToLoad'] = $parameters['module'];
unset($parameters['module']);
if (isset($parameters['action'])) {
$parameters['actionToLoad'] = $parameters['action'];
unset($parameters['action']);
} else {
$parameters['actionToLoad'] = null;
}
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters);
// add module=CoreHome&action=showInContext
$url = $url . '&module=CoreHome&action=showInContext';
return htmlspecialchars($url);
}
示例9: main
/**
* @see Piwik_ViewDataTable::main()
*
*/
public function main()
{
if ($this->mainAlreadyExecuted) {
return;
}
$this->mainAlreadyExecuted = true;
$view = new Piwik_View($this->dataTableTemplate);
$this->id = $this->getUniqIdTable();
$view->graphType = $this->graphType;
$this->parametersToModify['action'] = $this->currentControllerAction;
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($this->parametersToModify);
$view->jsInvocationTag = $this->getFlashInvocationCode($url);
$view->urlData = $url;
$view->formId = "formEmbed" . $this->id;
$view->codeEmbed = $this->codeEmbed;
$view->id = $this->id;
$view->method = $this->method;
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->showFooter = $this->getShowFooter();
$this->view = $view;
}
示例10: smarty_modifier_urlRewriteAdminView
/**
* Rewrites the given URL so that it looks like an Admin URL.
*
* @return string
*/
function smarty_modifier_urlRewriteAdminView($parameters)
{
// replace module=X by moduleToLoad=X
// replace action=Y by actionToLoad=Y
if (!is_array($parameters)) {
// if parameters is not an array, parse URL parameteres
$parameters = Piwik_Common::getArrayFromQueryString(htmlspecialchars($parameters));
}
$parameters['moduleToLoad'] = $parameters['module'];
unset($parameters['module']);
if (isset($parameters['action'])) {
$parameters['actionToLoad'] = $parameters['action'];
unset($parameters['action']);
} else {
$parameters['actionToLoad'] = null;
}
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters);
// add module=Home&action=showInContext
$url = $url . '&module=AdminHome&action=showInContext';
return $url;
}
示例11: customizeGraph
function customizeGraph()
{
parent::customizeGraph();
$this->prepareData();
$this->set_y_max($this->maxData);
$line_1 = new line_hollow(1, 3, '0x3357A0');
$line_1->key('visits', 10);
$i = 0;
foreach ($this->arrayData as $value) {
// hack until we have proper date handling
$spacePosition = strpos($this->arrayLabel[$i], ' ');
if ($spacePosition === false) {
$spacePosition = strlen($this->arrayLabel[$i]);
}
// generate the link on the dot, to the given day' statistics
$link = Piwik_Url::getCurrentScriptName() . Piwik_Url::getCurrentQueryStringWithParametersModified(array('date' => substr($this->arrayLabel[$i], 0, $spacePosition), 'module' => 'Home', 'action' => 'index', 'viewDataTable' => null));
$line_1->add_link($value, $link);
$i++;
}
$this->data_sets[] = $line_1;
$this->set_x_labels($this->arrayLabel);
$this->area_hollow(1, 3, 4, '0x3357A0', ' visits', 10);
}
示例12: 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), '');
}
示例13: buildView
protected function buildView()
{
$view = new Piwik_View($this->dataTableTemplate);
$this->uniqueIdViewDataTable = $this->getUniqueIdViewDataTable();
$view->graphType = $this->graphType;
$this->chartDivId = $this->uniqueIdViewDataTable . "Chart_swf";
$this->parametersToModify['action'] = $this->currentControllerAction;
$this->parametersToModify = array_merge($this->variablesDefault, $this->parametersToModify);
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($this->parametersToModify);
$this->includeData = Zend_Registry::get('config')->General->serve_widget_and_data;
$idSite = Piwik_Common::getRequestVar('idSite', 1);
if (Piwik::isUserHasViewAccess($idSite) && $this->includeData) {
$this->chartData = $this->getFlashData();
} else {
$this->chartData = null;
}
$view->flashParameters = $this->getFlashParameters();
$view->urlGraphData = $url;
$view->chartDivId = $this->chartDivId;
$view->formEmbedId = "formEmbed" . $this->uniqueIdViewDataTable;
$view->javascriptVariablesToSet = $this->getJavascriptVariablesToSet();
$view->properties = $this->getViewProperties();
return $view;
}
示例14: setHostValidationVariablesView
/**
* Checks if the current host is valid and sets variables on the given view, including:
*
* isValidHost - true if host is valid, false if otherwise
* invalidHostMessage - message to display if host is invalid (only set if host is invalid)
* invalidHost - the invalid hostname (only set if host is invalid)
* mailLinkStart - the open tag of a link to email the super user of this problem (only set
* if host is invalid)
*/
public static function setHostValidationVariablesView($view)
{
// check if host is valid
$view->isValidHost = Piwik_Url::isValidHost();
if (!$view->isValidHost) {
// invalid host, so display warning to user
$validHost = Piwik_Config::getInstance()->General['trusted_hosts'][0];
$invalidHost = Piwik_Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
$emailSubject = rawurlencode(Piwik_Translate('CoreHome_InjectedHostEmailSubject', $invalidHost));
$emailBody = rawurlencode(Piwik_Translate('CoreHome_InjectedHostEmailBody'));
$superUserEmail = Piwik::getSuperUserEmail();
$mailToUrl = "mailto:{$superUserEmail}?subject={$emailSubject}&body={$emailBody}";
$mailLinkStart = "<a href=\"{$mailToUrl}\">";
$invalidUrl = Piwik_Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false);
$validUrl = Piwik_Url::getCurrentScheme() . '://' . $validHost . Piwik_Url::getCurrentScriptName();
$validLink = "<a href=\"{$validUrl}\">{$validUrl}</a>";
$changeTrustedHostsUrl = "index.php" . Piwik_Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreAdminHome', 'action' => 'generalSettings')) . "#trustedHostsSection";
$warningStart = Piwik_Translate('CoreHome_InjectedHostWarningIntro', array('<strong>' . $invalidUrl . '</strong>', '<strong>' . $validUrl . '</strong>')) . ' <br/>';
if (Piwik::isUserIsSuperUser()) {
$view->invalidHostMessage = $warningStart . ' ' . Piwik_Translate('CoreHome_InjectedHostSuperUserWarning', array("<a href=\"{$changeTrustedHostsUrl}\">", $invalidHost, '</a>', "<br/><a href=\"{$validUrl}\">", $validHost, '</a>'));
} else {
$view->invalidHostMessage = $warningStart . ' ' . Piwik_Translate('CoreHome_InjectedHostNonSuperUserWarning', array("<br/><a href=\"{$validUrl}\">", '</a>', $mailLinkStart, '</a>'));
}
$view->invalidHostMessageHowToFix = '<b>How do I fix this problem and how do I login again?</b><br/> The Piwik Super User can manually edit the file piwik/config/config.ini.php
and add the following lines: <pre>[General]' . "\n" . 'trusted_hosts[] = "' . $validHost . '"</pre><br/>After making the change, you will be able to login again.<br/><br/>
You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:
<pre>[General]' . "\n" . 'enable_trusted_host_check=0</pre>';
$view->invalidHost = $invalidHost;
// for UserSettings warning
$view->invalidHostMailLinkStart = $mailLinkStart;
}
}
示例15: smarty_function_url
/**
* Smarty {url} function plugin.
* Generates a piwik URL with the specified parameters modified.
*
* Examples:
* <pre>
* {url module="API"} will rewrite the URL modifying the module GET parameter
* {url module="API" method="getKeywords"} will rewrite the URL modifying the parameters module=API method=getKeywords
* </pre>
*
* @see Piwik_Url::getCurrentQueryStringWithParametersModified()
*
* @param array $params $name=>$value pairs of the parameters to modify in the generated URL
* @param Smarty &smarty Smarty object
* @return string Something like index.php?module=X&action=Y
*/
function smarty_function_url($params, &$smarty)
{
return Piwik_Common::sanitizeInputValue('index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified($params));
}