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


PHP Piwik_Url::getCurrentScriptPath方法代码示例

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


在下文中一共展示了Piwik_Url::getCurrentScriptPath方法的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), '');
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:33,代码来源:Url.test.php

示例2: getStaticSrvUrl

 /**
  * Helper methods
  */
 private function getStaticSrvUrl()
 {
     $path = Piwik_Url::getCurrentScriptPath();
     if (substr($path, -7) == '/tests/') {
         $path = substr($path, 0, -7);
     } else {
         if (substr($path, -18) == '/tests/core/Piwik/') {
             $path = substr($path, 0, -18);
         } else {
             throw new Exception('unsupported test path: ' . $path);
         }
     }
     return "http://" . $_SERVER['HTTP_HOST'] . $path;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:jsProxy.test.php

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

示例4: getStaticSrvUrl

 /**
  * Helper methods
  */
 private function getStaticSrvUrl()
 {
     $path = Piwik_Url::getCurrentScriptPath();
     if (substr($path, -7) == '/tests/') {
         $path .= 'core/Piwik/';
     } else {
         if (substr($path, -18) != '/tests/core/Piwik/') {
             throw new Exception('unsupported test path: ' . $path);
         }
     }
     return "http://" . $_SERVER['HTTP_HOST'] . $path . "serveStaticFile.test.php?" . FILE_MODE_REQUEST_VAR . "=" . STATIC_SERVER_MODE . "&" . SRV_MODE_REQUEST_VAR . "=";
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:15,代码来源:serveStaticFile.test.php


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