本文整理汇总了PHP中Piwik_Url::getCurrentQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::getCurrentQueryString方法的具体用法?PHP Piwik_Url::getCurrentQueryString怎么用?PHP Piwik_Url::getCurrentQueryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::getCurrentQueryString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($action = '')
{
if (empty($action)) {
$action = Piwik_Url::getCurrentQueryString();
}
parent::HTML_QuickForm('form', 'POST', $action);
$this->registerRule('checkEmail', 'function', 'Piwik_Form_isValidEmailString');
$this->registerRule('fieldHaveSameValue', 'function', 'Piwik_Form_fieldHaveSameValue');
$this->init();
}
示例2: getArrayFromCurrentQueryString
static function getArrayFromCurrentQueryString()
{
$queryString = Piwik_Url::getCurrentQueryString();
$queryString = htmlspecialchars($queryString);
$urlValues = Piwik_Common::getArrayFromQueryString($queryString);
return $urlValues;
}
示例3: login
function login($messageNoAccess = null)
{
$form = new Piwik_Login_Form();
// get url from POSTed form or GET parameter (getting back from password remind form)
$currentUrl = 'index.php' . Piwik_Url::getCurrentQueryString();
$urlToRedirect = Piwik_Common::getRequestVar('form_url', htmlspecialchars($currentUrl), 'string');
$urlToRedirect = htmlspecialchars_decode($urlToRedirect);
if ($form->validate()) {
$login = $form->getSubmitValue('form_login');
$password = $form->getSubmitValue('form_password');
$md5Password = md5($password);
$authenticated = $this->authenticateAndRedirect($login, $md5Password, $urlToRedirect);
if ($authenticated === false) {
$messageNoAccess = Piwik_Translate('Login_LoginPasswordNotCorrect');
}
}
$view = new Piwik_View('Login/templates/login.tpl');
// make navigation login form -> reset password -> login form remember your first url
$view->urlToRedirect = $urlToRedirect;
$view->AccessErrorString = $messageNoAccess;
$view->linkTitle = Piwik::getRandomTitle();
$view->addForm($form);
$view->subTemplate = 'genericForm.tpl';
echo $view->render();
}
示例4: 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), '');
}
示例5: __construct
function __construct($id, $method = 'post', $attributes = null, $trackSubmit = false)
{
if (!isset($attributes['action'])) {
$attributes['action'] = Piwik_Url::getCurrentQueryString();
}
if (!isset($attributes['name'])) {
$attributes['name'] = $id;
}
parent::__construct($id, $method, $attributes, $trackSubmit);
$this->init();
}
示例6: 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));
}
示例7: init
function init()
{
$urlToGoAfter = 'index.php' . Piwik_Url::getCurrentQueryString();
$urlExample = 'http://example.org';
$javascriptOnClickUrlExample = "\"javascript:if(this.value=='{$urlExample}'){this.value='http://';} this.style.color='black';\"";
$formElements = array(array('text', 'siteName', 'website name'), array('text', 'url', 'website URL', "style='color:rgb(153, 153, 153);' value={$urlExample} onfocus=" . $javascriptOnClickUrlExample . " onclick=" . $javascriptOnClickUrlExample));
$this->addElements($formElements);
$formRules = array();
foreach ($formElements as $row) {
$formRules[] = array($row[1], sprintf('%s required', $row[2]), 'required');
}
$this->addRules($formRules);
$this->addElement('submit', 'submit', 'Go!');
}
示例8: init
function init()
{
// if form_url is not defined go to current url
$currentUrl = 'index.php' . Piwik_Url::getCurrentQueryString();
$urlToGoAfter = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string');
// if the current url to redirect contains module=login we insteaed redirect to the referer url
if (stripos($urlToGoAfter, 'module=Login') !== false) {
$urlToGoAfter = Piwik_Url::getReferer();
}
$formElements = array(array('text', 'form_login'), array('password', 'form_password'), array('hidden', 'form_url', $urlToGoAfter));
$this->addElements($formElements);
$formRules = array(array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Login')), 'required'), array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'));
$this->addRules($formRules);
$this->addElement('submit', 'submit');
}
示例9: 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), '');
}
示例10: init
function init()
{
$urlToGoAfter = Piwik_Url::getCurrentQueryString();
$formElements = array(array('text', 'login', Piwik_Translate('Installation_SuperUserLogin')), array('password', 'password', Piwik_Translate('Installation_Password')), array('password', 'password_bis', Piwik_Translate('Installation_PasswordRepeat')), array('text', 'email', Piwik_Translate('Installation_Email')), array('checkbox', 'subscribe_newsletter_security', '', ' ' . Piwik_Translate('Installation_SecurityNewsletter')), array('checkbox', 'subscribe_newsletter_community', '', ' ' . Piwik_Translate('Installation_CommunityNewsletter')));
$this->addElements($formElements);
if (!$this->isSubmitted() || $this->getSubmitValue('subscribe_newsletter_community') == '1') {
$this->setChecked('subscribe_newsletter_community');
}
if (!$this->isSubmitted() || $this->getSubmitValue('subscribe_newsletter_security') == '1') {
$this->setChecked('subscribe_newsletter_security');
}
$formRules = array();
foreach ($formElements as $row) {
// checkboxes are not required (form should validate when unchecked)
if (in_array($row[1], array('subscribe_newsletter_security', 'subscribe_newsletter_community'))) {
continue;
}
$formRules[] = array($row[1], sprintf(Piwik_Translate('General_Required'), $row[2]), 'required');
}
$formRules[] = array('email', Piwik_Translate('UsersManager_ExceptionInvalidEmail'), 'checkEmail');
$formRules[] = array('password', Piwik_Translate('Installation_PasswordDoNotMatch'), 'fieldHaveSameValue', 'password_bis');
$this->addRules($formRules);
$this->addElement('submit', 'submit', Piwik_Translate('Installation_SubmitGo'));
}
示例11: checkForceSslLogin
/**
* Check force_ssl_login and redirect if connection isn't secure and not using a reverse proxy
*
* @param none
* @return void
*/
protected function checkForceSslLogin()
{
$forceSslLogin = Zend_Registry::get('config')->General->force_ssl_login;
if ($forceSslLogin) {
if (!Piwik::isHttps()) {
$url = 'https://' . Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName() . Piwik_Url::getCurrentQueryString();
Piwik_Url::redirectToUrl($url);
}
}
}
示例12: checkForceSslLogin
/**
* Check force_ssl_login and redirect if connection isn't secure and not using a reverse proxy
*
* @param none
* @return void
*/
protected function checkForceSslLogin()
{
$forceSslLogin = Piwik_Config::getInstance()->General['force_ssl_login'];
if ($forceSslLogin && !Piwik::isHttps()) {
$url = 'https://' . Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName() . Piwik_Url::getCurrentQueryString();
Piwik_Url::redirectToUrl($url);
}
}