本文整理汇总了PHP中Piwik_Url::getCurrentUrlWithoutFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::getCurrentUrlWithoutFileName方法的具体用法?PHP Piwik_Url::getCurrentUrlWithoutFileName怎么用?PHP Piwik_Url::getCurrentUrlWithoutFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::getCurrentUrlWithoutFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($templateFile, $smConf = array(), $filter = true)
{
$this->template = $templateFile;
$this->smarty = new Piwik_Smarty();
if (count($smConf) == 0) {
$smConf = Zend_Registry::get('config')->smarty;
}
foreach ($smConf as $key => $value) {
$this->smarty->{$key} = $value;
}
$this->smarty->template_dir = $smConf->template_dir->toArray();
array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH);
$this->smarty->plugins_dir = $smConf->plugins_dir->toArray();
array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH);
$this->smarty->compile_dir = $smConf->compile_dir;
Piwik_View::addPiwikPath($this->smarty->compile_dir, null, PIWIK_USER_PATH);
$this->smarty->cache_dir = $smConf->cache_dir;
Piwik_View::addPiwikPath($this->smarty->cache_dir, null, PIWIK_USER_PATH);
$error_reporting = $smConf->error_reporting;
if ($error_reporting != (string) (int) $error_reporting) {
$error_reporting = self::bitwise_eval($error_reporting);
}
$this->smarty->error_reporting = $error_reporting;
$this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION);
if ($filter) {
$this->smarty->load_filter('output', 'cachebuster');
$this->smarty->load_filter('output', 'ajaxcdn');
$this->smarty->load_filter('output', 'trimwhitespace');
}
// global value accessible to all templates: the piwik base URL for the current request
$this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
}
示例2: __construct
public function __construct($templateFile, $smConf = array())
{
require_once "Smarty.php";
$this->template = $templateFile;
$this->smarty = new Piwik_Smarty();
if (count($smConf) == 0) {
$smConf = Zend_Registry::get('config')->smarty;
}
foreach ($smConf as $key => $value) {
$this->smarty->{$key} = $value;
}
$this->smarty->template_dir = $smConf->template_dir->toArray();
array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath"));
$this->smarty->plugins_dir = $smConf->plugins_dir->toArray();
array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath"));
$this->smarty->compile_dir = $smConf->compile_dir;
Piwik_View::addPiwikPath($this->smarty->compile_dir, null);
$this->smarty->cache_dir = $smConf->cache_dir;
Piwik_View::addPiwikPath($this->smarty->cache_dir, null);
$this->smarty->error_reporting = $smConf->debugging;
$this->smarty->error_reporting = $smConf->error_reporting;
$this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION);
$this->smarty->load_filter('output', 'cachebuster');
$this->smarty->load_filter('output', 'trimwhitespace');
// global value accessible to all templates: the piwik base URL for the current request
$this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
}
示例3: getFlashInvocationCode
protected function getFlashInvocationCode($url = 'libs/open-flash-chart/data-files/nodata.txt', $use_swfobject = true)
{
$width = $this->width;
$height = $this->height;
$libPathInPiwik = 'libs/open-flash-chart/';
$currentPath = Piwik_Url::getCurrentUrlWithoutFileName();
$pathToLibraryOpenChart = $currentPath . $libPathInPiwik;
$url = Piwik_Url::getCurrentUrlWithoutQueryString() . $url;
// escape the & and stuff:
$url = urlencode($url);
$obj_id = $this->id . "Chart";
$div_name = $this->id . "FlashContent";
$return = '';
if ($use_swfobject) {
// Using library for auto-enabling Flash object on IE, disabled-Javascript proof
$return .= '
<div id="' . $div_name . '"></div>
<script type="text/javascript">
var so = new SWFObject("' . $pathToLibraryOpenChart . 'open-flash-chart.swf", "' . $obj_id . '_swf", "' . $width . '", "' . $height . '", "9", "#FFFFFF");
so.addVariable("data", "' . $url . '");
so.addParam("allowScriptAccess", "sameDomain");
so.write("' . $div_name . '");
</script>
<noscript>
';
}
$urlGraph = $pathToLibraryOpenChart . "open-flash-chart.swf?data=" . $url;
$this->codeEmbed .= "<div><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" . $width . "' height='" . $height . "' id='" . $obj_id . "' >" . "<param name='movie' value='" . $urlGraph . "' />" . "<param name='allowScriptAccess' value='sameDomain' /> " . "<embed src='{$urlGraph}' allowScriptAccess='sameDomain' quality='high' bgcolor='#FFFFFF' width='" . $width . "' height='" . $height . "' name='open-flash-chart' type='application/x-shockwave-flash' id='" . $obj_id . "' />" . "</object></div>";
$return .= $this->codeEmbed;
if ($use_swfobject) {
$return .= '</noscript>';
}
return $return;
}
示例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: renderTable
/**
* Computes the output for the given data table
*
* @param Piwik_DataTable $table
* @return string
* @throws Exception
*/
protected function renderTable($table)
{
if (!$table instanceof Piwik_DataTable_Array || $table->getKeyName() != 'date') {
throw new Exception("RSS feeds can be generated for one specific website &idSite=X." . "\nPlease specify only one idSite or consider using &format=XML instead.");
}
$idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
$period = Piwik_Common::getRequestVar('period');
$piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName() . "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period;
$out = "";
$moreRecentFirst = array_reverse($table->getArray(), true);
foreach ($moreRecentFirst as $date => $subtable) {
$timestamp = $table->metadata[$date]['timestamp'];
$site = $table->metadata[$date]['site'];
$pudDate = date('r', $timestamp);
$dateInSiteTimezone = Piwik_Date::factory($timestamp)->setTimezone($site->getTimezone())->toString('Y-m-d');
$thisPiwikUrl = Piwik_Common::sanitizeInputValue($piwikUrl . "&date={$dateInSiteTimezone}");
$siteName = $site->getName();
$title = $siteName . " on " . $date;
$out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
$out .= Piwik_Common::sanitizeInputValue($this->renderDataTable($subtable));
$out .= "</description>\n\t</item>\n";
}
$header = $this->getRssHeader();
$footer = $this->getRssFooter();
return $header . $out . $footer;
}
示例6: renderTable
protected function renderTable($table)
{
if (!$table instanceof Piwik_DataTable_Array) {
throw new Exception("RSS Feed only used on DataTable_Array");
}
$idSite = Piwik_Common::getRequestVar('idSite', 1);
$period = Piwik_Common::getRequestVar('period');
$currentUrl = Piwik_Url::getCurrentUrlWithoutFileName();
$piwikUrl = $currentUrl . "?module=Home&action=index&idSite=" . $idSite . "&period=" . $period;
$out = "";
$moreRecentFirst = array_reverse($table->getArray(), true);
foreach ($moreRecentFirst as $date => $subtable) {
$timestamp = $table->metaData[$date]['timestamp'];
$site = $table->metaData[$date]['site'];
$pudDate = date('r', $timestamp);
$dateUrl = date('Y-m-d', $timestamp);
$thisPiwikUrl = htmlentities($piwikUrl . "&date={$dateUrl}");
$siteName = $site->getName();
$title = $siteName . " on " . $date;
$out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
$out .= htmlspecialchars($this->renderDataTable($subtable));
$out .= "</description>\n\t</item>\n";
}
$header = $this->getRssHeader();
$footer = $this->getRssFooter();
return $this->output($header . $out . $footer);
}
示例7: __construct
public function __construct($templateFile, $smConf = array(), $filter = true)
{
$this->template = $templateFile;
$this->smarty = new Piwik_Smarty($smConf, $filter);
// global value accessible to all templates: the piwik base URL for the current request
$this->piwik_version = Piwik_Version::VERSION;
$this->cacheBuster = md5(Piwik_Common::getSalt() . PHP_VERSION . Piwik_Version::VERSION);
$this->piwikUrl = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName());
}
示例8: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = new Piwik_View('SitesManager/templates/DisplayJavascriptCode.tpl');
$view->menu = Piwik_GetAdminMenu();
$view->jsTag = $jsTag;
echo $view->render();
}
示例9: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = Piwik_View::factory('DisplayJavascriptCode');
$this->setGeneralVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$view->jsTag = $jsTag;
echo $view->render();
}
示例10: getJavascriptTag
/**
* Returns the javascript tag for the given idSite.
* This tag must be included on every page to be tracked by Piwik
*
* @param int $idSite
* @param string $customTitle Custom title given to the pageview
* @return string The Javascript tag ready to be included on the HTML pages
*/
public function getJavascriptTag($idSite, $piwikUrl = '')
{
Piwik::checkUserHasViewAccess($idSite);
if (empty($piwikUrl)) {
$piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
}
$piwikUrl = Piwik_Common::sanitizeInputValues($piwikUrl);
$htmlEncoded = Piwik::getJavascriptCode($idSite, $piwikUrl);
$htmlEncoded = str_replace(array('<br>', '<br />', '<br/>'), '', $htmlEncoded);
return $htmlEncoded;
}
示例11: js
function js()
{
$controllerName = Piwik_Common::getRequestVar('moduleToWidgetize');
$actionName = Piwik_Common::getRequestVar('actionToWidgetize');
$parameters = array($fetch = true);
$content = Piwik_FrontController::getInstance()->fetchDispatch($controllerName, $actionName, $parameters);
$view = Piwik_View::factory('js');
$view->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
$content = str_replace(array("\t", "\n", "\r\n", "\r"), "", $content);
$view->content = $content;
echo $view->render();
}
示例12: getJavascriptTag
/**
* Returns the javascript tag for the given idSite.
* This tag must be included on every page to be tracked by Piwik
*
* @param int $idSite
* @return string The Javascript tag ready to be included on the HTML pages
*/
public static function getJavascriptTag($idSite, $piwikUrl = '', $actionName = '')
{
Piwik::checkUserHasViewAccess($idSite);
$actionName = "'" . addslashes(Piwik_Common::sanitizeInputValues($actionName)) . "'";
if (empty($piwikUrl)) {
$piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
}
$piwikUrl = addslashes(Piwik_Common::sanitizeInputValues($piwikUrl));
$htmlEncoded = Piwik::getJavascriptCode($idSite, $piwikUrl, $actionName);
$htmlEncoded = str_replace(array('<br>', '<br />', '<br/>'), '', $htmlEncoded);
return html_entity_decode($htmlEncoded);
}
示例13: displayJavascriptCode
/**
* Displays the admin UI page showing all tracking tags
* @return unknown_type
*/
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idSite');
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$view = Piwik_View::factory('Tracking');
$this->setBasicVariablesView($view);
$view->menu = Piwik_GetAdminMenu();
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->displaySiteName = $site->getName();
$view->jsTag = $jsTag;
echo $view->render();
}
示例14: __construct
public function __construct($templateFile, $smConf = array())
{
$this->template = $templateFile;
$this->smarty = new Smarty();
if (count($smConf) == 0) {
$smConf = Zend_Registry::get('config')->smarty;
}
foreach ($smConf as $key => $value) {
$this->smarty->{$key} = $value;
}
$this->smarty->template_dir = $smConf->template_dir->toArray();
$this->smarty->plugins_dir = $smConf->plugins_dir->toArray();
$this->smarty->compile_dir = $smConf->compile_dir;
$this->smarty->cache_dir = $smConf->cache_dir;
$this->smarty->load_filter('output', 'trimwhitespace');
// global value accessible to all templates: the piwik base URL for the current request
$this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName();
}
示例15: renderTable
protected function renderTable($table)
{
if(!($table instanceof Piwik_DataTable_Array)
|| $table->getKeyName() != 'date')
{
throw new Exception("RSS Feed only used on Piwik_DataTable_Array with keyName = 'date'");
}
$idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
$period = Piwik_Common::getRequestVar('period');
$piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName()
. "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period;
$out = "";
$moreRecentFirst = array_reverse($table->getArray(), true);
foreach($moreRecentFirst as $date => $subtable )
{
$timestamp = $table->metadata[$date]['timestamp'];
$site = $table->metadata[$date]['site'];
$pudDate = date('r', $timestamp);
$dateInSiteTimezone = Piwik_Date::factory($timestamp)->setTimezone($site->getTimezone())->toString('Y-m-d');
$thisPiwikUrl = Piwik_Common::sanitizeInputValue($piwikUrl . "&date=$dateInSiteTimezone");
$siteName = $site->getName();
$title = $siteName . " on ". $date;
$out .= "\t<item>
<pubDate>$pudDate</pubDate>
<guid>$thisPiwikUrl</guid>
<link>$thisPiwikUrl</link>
<title>$title</title>
<author>http://piwik.org</author>
<description>";
$out .= Piwik_Common::sanitizeInputValue( $this->renderDataTable($subtable) );
$out .= "</description>\n\t</item>\n";
}
$header = $this->getRssHeader();
$footer = $this->getRssFooter();
return $header . $out . $footer;
}