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


PHP Piwik_Url::getCurrentScriptName方法代码示例

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


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

示例1: 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);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:23,代码来源:ChartEvolution.php

示例2: 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), '');
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:27,代码来源:Url.test.php

示例3: 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;
        }
    }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:41,代码来源:Controller.php

示例4: 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);
         }
     }
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:16,代码来源:Controller.php

示例5: 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 $name=$value of the parameters to modify in the generated URL
 * @return	string Something like index.php?module=X&action=Y 
 */
function smarty_function_url($params, &$smarty)
{
    return Piwik_Url::getCurrentScriptName() . Piwik_Url::getCurrentQueryStringWithParametersModified($params);
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:18,代码来源:function.url.php

示例6: 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);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:14,代码来源:Controller.php

示例7: test_getCurrentScriptName

 /**
  * @group Core
  * @group Url
  */
 public function test_getCurrentScriptName()
 {
     $names = array('PATH_INFO', 'REQUEST_URI', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'argv', 'HTTPS', 'HTTP_HOST', 'QUERY_STRING', 'HTTP_REFERER');
     foreach ($names as $name) {
         unset($_SERVER[$name]);
     }
     $tests = array(array('/', 'http://example.com/', null), array('/', '/', null), array('/index.php', '/index.php', null), array('/index.php', '/index.php?module=Foo', null), array('/index.php', '/index.php/route/1', '/route/1'), array('/index.php', '/index.php/route/2?module=Bar', '/route/2'), array('/path/index.php', '/path/index.php/route/3/?module=Fu&action=Bar#Hash', '/route/3/'));
     foreach ($tests as $test) {
         list($expected, $uri, $pathInfo) = $test;
         $_SERVER['REQUEST_URI'] = $uri;
         $_SERVER['PATH_INFO'] = $pathInfo;
         $scriptPathName = Piwik_Url::getCurrentScriptName();
         $this->assertEquals($expected, $scriptPathName);
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:19,代码来源:UrlTest.php


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