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


PHP Piwik_Common::sanitizeInputValue方法代码示例

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


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

示例1: 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;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:33,代码来源:Rss.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
     $this->goals = Piwik_Goals_API::getInstance()->getGoals($this->idSite);
     foreach ($this->goals as &$goal) {
         $goal['name'] = Piwik_Common::sanitizeInputValue($goal['name']);
         if (isset($goal['pattern'])) {
             $goal['pattern'] = Piwik_Common::sanitizeInputValue($goal['pattern']);
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:12,代码来源:Controller.php

示例3: render

 /**
  * Renders the current view.
  *
  * @return string Generated template
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $userLogin = Piwik::getCurrentUserLogin();
         $this->userLogin = $userLogin;
         // workaround for #1331
         $count = method_exists('Piwik', 'getWebsitesCountToDisplay') ? Piwik::getWebsitesCountToDisplay() : 1;
         $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
         usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
         $this->sites = $sites;
         $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
         if (Zend_Registry::get('config')->General->autocomplete_min_sites <= count($sites)) {
             $this->show_autocompleter = true;
         } else {
             $this->show_autocompleter = false;
         }
         // workaround for #1331
         $this->loginModule = method_exists('Piwik', 'getLoginPluginName') ? Piwik::getLoginPluginName() : 'Login';
         $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     try {
         $this->totalNumberOfQueries = Piwik::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     // workaround for #1331
     if (method_exists('Piwik', 'overrideCacheControlHeaders')) {
         Piwik::overrideCacheControlHeaders('no-store');
     }
     @header('Content-Type: ' . $this->contentType);
     if ($this->xFrameOptions) {
         @header('X-Frame-Options: ' . $this->xFrameOptions);
     }
     return $this->smarty->fetch($this->template);
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:52,代码来源:View.php

示例4: 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 . '&amp;module=CoreHome&amp;action=showInContext';
    return Piwik_Common::sanitizeInputValue($url);
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:23,代码来源:modifier.urlRewriteBasicView.php

示例5: 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;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:44,代码来源:Rss.php

示例6: render

 /**
  * Renders the current view.
  *
  * @return string Generated template
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $userLogin = Piwik::getCurrentUserLogin();
         $this->userLogin = $userLogin;
         $count = Piwik::getWebsitesCountToDisplay();
         $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
         usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
         $this->sites = $sites;
         $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsSuperUser = Piwik::isUserIsSuperUser();
         $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
         if (Piwik_Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) {
             $this->show_autocompleter = true;
         } else {
             $this->show_autocompleter = false;
         }
         $this->loginModule = Piwik::getLoginPluginName();
         $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     try {
         $this->totalNumberOfQueries = Piwik::getQueryCount();
     } catch (Exception $e) {
         $this->totalNumberOfQueries = 0;
     }
     Piwik::overrideCacheControlHeaders('no-store');
     @header('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail)
     @header('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->smarty->fetch($this->template);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:46,代码来源:View.php

示例7: 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));
}
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:20,代码来源:function.url.php

示例8: getCurrentHost

 /**
  * If current URL is "http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"
  * will return "example.org"
  *	
  * @param string $default Default value to return if host unknown
  * @return string
  */
 public static function getCurrentHost($default = 'unknown')
 {
     $hostHeaders = @Piwik_Config::getInstance()->General['proxy_host_headers'];
     if (!is_array($hostHeaders)) {
         $hostHeaders = array();
     }
     $host = self::getHost();
     $default = Piwik_Common::sanitizeInputValue($host ? $host : $default);
     return Piwik_IP::getNonProxyIpFromHeader($default, $hostHeaders);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:Url.php

示例9: getArrayFromQueryString

 /**
  * Returns an URL query string in an array format
  *
  * @param string  $urlQuery
  * @return array  array( param1=> value1, param2=>value2)
  */
 public static function getArrayFromQueryString($urlQuery)
 {
     if (strlen($urlQuery) == 0) {
         return array();
     }
     if ($urlQuery[0] == '?') {
         $urlQuery = substr($urlQuery, 1);
     }
     $separator = '&';
     $urlQuery = $separator . $urlQuery;
     //		$urlQuery = str_replace(array('%20'), ' ', $urlQuery);
     $refererQuery = trim($urlQuery);
     $values = explode($separator, $refererQuery);
     $nameToValue = array();
     foreach ($values as $value) {
         $pos = strpos($value, '=');
         if ($pos !== false) {
             $name = substr($value, 0, $pos);
             $value = substr($value, $pos + 1);
             if ($value === false) {
                 $value = '';
             }
         } else {
             $name = $value;
             $value = false;
         }
         if (!empty($name)) {
             $name = Piwik_Common::sanitizeInputValue($name);
         }
         if (!empty($value)) {
             $value = Piwik_Common::sanitizeInputValue($value);
         }
         // if array without indexes
         $count = 0;
         $tmp = preg_replace('/(\\[|%5b)(]|%5d)$/i', '', $name, -1, $count);
         if (!empty($tmp) && $count) {
             $name = $tmp;
             if (isset($nameToValue[$name]) == false || is_array($nameToValue[$name]) == false) {
                 $nameToValue[$name] = array();
             }
             array_push($nameToValue[$name], $value);
         } else {
             if (!empty($name)) {
                 $nameToValue[$name] = $value;
             }
         }
     }
     return $nameToValue;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:55,代码来源:Common.php

示例10: cleanParameterUrls

 /**
  * Clean the parameter URLs:
  * - if the parameter is a string make it an array
  * - remove the trailing slashes if found
  * 
  * @param string|array urls
  * @return array the array of cleaned URLs
  */
 private function cleanParameterUrls($urls)
 {
     if (!is_array($urls)) {
         $urls = array($urls);
     }
     $urls = array_filter($urls);
     $urls = array_map('urldecode', $urls);
     foreach ($urls as &$url) {
         $url = $this->removeTrailingSlash($url);
         if (strpos($url, 'http') !== 0) {
             $url = 'http://' . $url;
         }
         $url = Piwik_Common::sanitizeInputValue($url);
     }
     $urls = array_unique($urls);
     return $urls;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:25,代码来源:API.php

示例11: checkPreviousStepIsValid

	/**
	 * The previous step is valid if it is either
	 * - any step before (OK to go back)
	 * - the current step (case when validating a form)
	 * If step is invalid, then exit.
	 *
	 * @param string $currentStep Current step
	 */
	protected function checkPreviousStepIsValid( $currentStep )
	{
		$error = false;

		if(empty($this->session->currentStepDone))
		{
			$error = true;
		}
		else if($currentStep == 'finished' && $this->session->currentStepDone == 'finished')
		{
			// ok to refresh this page or use language selector
		}
		else
		{
			if(file_exists(Piwik_Config::getDefaultUserConfigPath()))
			{
				$error = true;
			}

			$steps = array_keys($this->steps);

			// the currentStep
			$currentStepId = array_search($currentStep, $steps);

			// the step before
			$previousStepId = array_search($this->session->currentStepDone, $steps);

			// not OK if currentStepId > previous+1
			if( $currentStepId > $previousStepId + 1 )
			{
				$error = true;
			}
		}
		if($error)
		{
			Piwik_Login_Controller::clearSession();
			$message = Piwik_Translate('Installation_ErrorInvalidState',
						array( '<br /><b>',
								'</b>',
								'<a href=\''.Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()).'\'>',
								'</a>')
					);
			Piwik::exitWithErrorMessage( $message );
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:53,代码来源:Controller.php

示例12: getCurrentHost

 /**
  * If current URL is "http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"
  * will return "example.org"
  *
  * @param string $default Default value to return if host unknown
  * @return string
  */
 public static function getCurrentHost($default = 'unknown')
 {
     $hostHeaders = @Piwik_Config::getInstance()->General['proxy_host_headers'];
     if (!is_array($hostHeaders)) {
         $hostHeaders = array();
     }
     $default = Piwik_Common::sanitizeInputValue($default);
     if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
         $default = Piwik_Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
     }
     return Piwik_IP::getNonProxyIpFromHeader($default, $hostHeaders);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:19,代码来源:Url.php

示例13: smarty_modifier_urlRewriteWithParameters

/**
 * Rewrites the given URL and modify the given parameters.
 * @see Piwik_Url::getCurrentQueryStringWithParametersModified()
 *
 * @param $parameters
 * @return string
 */
function smarty_modifier_urlRewriteWithParameters($parameters)
{
    $parameters['updated'] = null;
    $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters);
    return Piwik_Common::sanitizeInputValue($url);
}
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:13,代码来源:modifier.urlRewriteWithParameters.php

示例14: getLastIpFromList

	/**
	 * Returns the last IP address in a comma separated list, subject to an optional exclusion list.
	 *
	 * @param string $csv Comma separated list of elements
	 * @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges)
	 * @return string Last (non-excluded) IP address in the list
	 */
	static public function getLastIpFromList($csv, $excludedIps = null)
	{
		$p = strrpos($csv, ',');
		if($p !== false)
		{
			$elements = explode(',', $csv);
			for($i = count($elements); $i--; )
			{
				$element = trim(Piwik_Common::sanitizeInputValue($elements[$i]));
				if(empty($excludedIps) || (!in_array($element, $excludedIps) && !self::isIpInRange(self::P2N(self::sanitizeIp($element)), $excludedIps)))
				{
					return $element;
				}
			}
		}
		return trim(Piwik_Common::sanitizeInputValue($csv));
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:24,代码来源:IP.php

示例15: extractEvolutionReport

 protected function extractEvolutionReport($report)
 {
     $this->dataTable = $report['reportData'];
     $this->rowLabel = Piwik_Common::sanitizeInputValue($report['label']);
     $this->rowIcon = !empty($report['logo']) ? $report['logo'] : false;
     $this->availableMetrics = $report['metadata']['metrics'];
     $this->dimension = $report['metadata']['dimension'];
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:8,代码来源:RowEvolution.php


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