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


PHP Piwik_Common::sanitizeInputValues方法代码示例

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


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

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

示例2: testSanitizeInputValues

 /**
  * @dataProvider getInputValues
  * @group Core
  * @group Common
  * @group sanitizeInputValues
  */
 public function testSanitizeInputValues($input, $output)
 {
     if (version_compare(PHP_VERSION, '5.4') < 0) {
         $this->assertTrue(@set_magic_quotes_runtime(1));
         $this->assertEquals(1, @get_magic_quotes_runtime());
         $this->assertEquals($output, Piwik_Common::sanitizeInputValues($input));
         $this->assertTrue(@set_magic_quotes_runtime(0));
         $this->assertEquals(0, @get_magic_quotes_runtime());
         $this->assertEquals($output, Piwik_Common::sanitizeInputValues($input));
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:CommonTest.php

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

示例4: escapeValue

 /**
  * Escape values from the cookie before sending them back to the client 
  * (when using the get() method).
  * 
  * @return mixed The value once cleaned.
  */
 protected static function escapeValue($value)
 {
     return Piwik_Common::sanitizeInputValues($value);
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:10,代码来源:Cookie.php

示例5: test_sanitizeInputValues_php

 function test_sanitizeInputValues_php()
 {
     $a = true;
     $b = true;
     $this->assertEqual($b, Piwik_Common::sanitizeInputValues($a));
     $a = false;
     $b = false;
     $this->assertEqual($b, Piwik_Common::sanitizeInputValues($a));
     $a = null;
     $b = null;
     $this->assertEqual($b, Piwik_Common::sanitizeInputValues($a));
     $a = "";
     $b = "";
     $this->assertEqual($b, Piwik_Common::sanitizeInputValues($a));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:15,代码来源:Common.test.php

示例6: getUserSettingsInformation

 /**
  * Gets the UserSettings information and returns them in an array of name => value
  * 
  * @return array
  */
 protected function getUserSettingsInformation()
 {
     // we already called this method before, simply returns the result
     if (is_array($this->userSettingsInformation)) {
         return $this->userSettingsInformation;
     }
     require_once PIWIK_INCLUDE_PATH . '/libs/UserAgentParser/UserAgentParser.php';
     $plugin_Flash = Piwik_Common::getRequestVar('fla', 0, 'int', $this->request);
     $plugin_Java = Piwik_Common::getRequestVar('java', 0, 'int', $this->request);
     $plugin_Director = Piwik_Common::getRequestVar('dir', 0, 'int', $this->request);
     $plugin_Quicktime = Piwik_Common::getRequestVar('qt', 0, 'int', $this->request);
     $plugin_RealPlayer = Piwik_Common::getRequestVar('realp', 0, 'int', $this->request);
     $plugin_PDF = Piwik_Common::getRequestVar('pdf', 0, 'int', $this->request);
     $plugin_WindowsMedia = Piwik_Common::getRequestVar('wma', 0, 'int', $this->request);
     $plugin_Gears = Piwik_Common::getRequestVar('gears', 0, 'int', $this->request);
     $plugin_Silverlight = Piwik_Common::getRequestVar('ag', 0, 'int', $this->request);
     $plugin_Cookie = Piwik_Common::getRequestVar('cookie', 0, 'int', $this->request);
     $userAgent = Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_USER_AGENT']);
     $aBrowserInfo = UserAgentParser::getBrowser($userAgent);
     $browserName = $aBrowserInfo !== false && $aBrowserInfo['id'] !== false ? $aBrowserInfo['id'] : 'UNK';
     $browserVersion = $aBrowserInfo !== false && $aBrowserInfo['version'] !== false ? $aBrowserInfo['version'] : '';
     $os = UserAgentParser::getOperatingSystem($userAgent);
     $os = $os === false ? 'UNK' : $os['id'];
     $resolution = Piwik_Common::getRequestVar('res', 'unknown', 'string', $this->request);
     $ip = Piwik_Common::getIp();
     $browserLang = Piwik_Common::getBrowserLanguage();
     $configurationHash = $this->getConfigHash($os, $browserName, $browserVersion, $resolution, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ip, $browserLang);
     $this->userSettingsInformation = array('config_md5config' => $configurationHash, 'config_os' => $os, 'config_browser_name' => $browserName, 'config_browser_version' => $browserVersion, 'config_resolution' => $resolution, 'config_pdf' => $plugin_PDF, 'config_flash' => $plugin_Flash, 'config_java' => $plugin_Java, 'config_director' => $plugin_Director, 'config_quicktime' => $plugin_Quicktime, 'config_realplayer' => $plugin_RealPlayer, 'config_windowsmedia' => $plugin_WindowsMedia, 'config_gears' => $plugin_Gears, 'config_silverlight' => $plugin_Silverlight, 'config_cookie' => $plugin_Cookie, 'location_ip' => $ip, 'location_browser_lang' => $browserLang);
     return $this->userSettingsInformation;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:35,代码来源:Visit.php

示例7: getUserSettingsInformation

 /**
  * Gets the UserSettings information and returns them in an array of name => value
  * 
  * @return array
  */
 protected function getUserSettingsInformation()
 {
     // we already called this method before, simply returns the result
     if (is_array($this->userSettingsInformation)) {
         return $this->userSettingsInformation;
     }
     require_once "UserAgentParser/UserAgentParser.php";
     $plugin_Flash = Piwik_Common::getRequestVar('fla', 0, 'int', $this->request);
     $plugin_Director = Piwik_Common::getRequestVar('dir', 0, 'int', $this->request);
     $plugin_RealPlayer = Piwik_Common::getRequestVar('realp', 0, 'int', $this->request);
     $plugin_Pdf = Piwik_Common::getRequestVar('pdf', 0, 'int', $this->request);
     $plugin_WindowsMedia = Piwik_Common::getRequestVar('wma', 0, 'int', $this->request);
     $plugin_Cookie = Piwik_Common::getRequestVar('cookie', 0, 'int', $this->request);
     $userAgent = Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_USER_AGENT']);
     $aBrowserInfo = UserAgentParser::getBrowser($userAgent);
     # the !==false does not match the NULL and we have NOT NULL in the colums, so change to !empty.
     $browserName = !empty($aBrowserInfo) && !empty($aBrowserInfo['id']) ? $aBrowserInfo['id'] : 'UNK';
     $browserVersion = !empty($aBrowserInfo) && !empty($aBrowserInfo['version']) ? $aBrowserInfo['version'] : '';
     $os = UserAgentParser::getOperatingSystem($userAgent);
     $os = $os === false ? 'UNK' : $os['id'];
     $resolution = Piwik_Common::getRequestVar('res', 'unknown', 'string', $this->request);
     $ip = Piwik_Common::getIp();
     $browserLang = Piwik_Common::getBrowserLanguage();
     $configurationHash = $this->getConfigHash($os, $browserName, $browserVersion, $resolution, $plugin_Flash, $plugin_Director, $plugin_RealPlayer, $plugin_Pdf, $plugin_WindowsMedia, $plugin_Cookie, $ip, $browserLang);
     $this->userSettingsInformation = array('config_md5config' => $configurationHash, 'config_os' => $os, 'config_browser_name' => $browserName, 'config_browser_version' => $browserVersion, 'config_resolution' => $resolution, 'config_pdf' => $plugin_Pdf, 'config_flash' => $plugin_Flash, 'config_director' => $plugin_Director, 'config_realplayer' => $plugin_RealPlayer, 'config_windowsmedia' => $plugin_WindowsMedia, 'config_cookie' => $plugin_Cookie, 'location_ip' => $ip, 'location_browser_lang' => $browserLang);
     return $this->userSettingsInformation;
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:32,代码来源:Visit.php

示例8: getBrowserLanguage

 /**
  * Returns the browser language code, eg. "en-gb,en;q=0.5"
  *
  * @return string
  */
 public static function getBrowserLanguage($browserLang = NULL)
 {
     static $replacementPatterns = array('/(\\\\.)/', '/(\\s+)/', '/(\\([^)]*\\))/', '/(;q=[0-9.]+)/');
     if (is_null($browserLang)) {
         $browserLang = Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
     }
     if (is_null($browserLang)) {
         // a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
         $browserLang = "";
     } else {
         // language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
         // underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
         // but we guard against a bad user agent which naively uses its locale
         $browserLang = strtolower(str_replace('_', '-', $browserLang));
         // filters
         $browserLang = preg_replace($replacementPatterns, '', $browserLang);
         $browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1);
         // Firefox bug
         $browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1);
         // unregistered language tag
         $browserLang = str_replace('sr-sp', 'sr-rs', $browserLang);
         // unofficial (proposed) code in the wild
     }
     return $browserLang;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:Common.php

示例9: getUserSettingsInformation

 /**
  * Gets the UserSettings information and returns them in an array of name => value
  * 
  * @return array
  */
 private function getUserSettingsInformation()
 {
     // we already called this method before, simply returns the result
     if (is_array($this->userSettingsInformation)) {
         return $this->userSettingsInformation;
     }
     $plugin_Flash = Piwik_Common::getRequestVar('fla', 0, 'int');
     $plugin_Director = Piwik_Common::getRequestVar('dir', 0, 'int');
     $plugin_Quicktime = Piwik_Common::getRequestVar('qt', 0, 'int');
     $plugin_RealPlayer = Piwik_Common::getRequestVar('realp', 0, 'int');
     $plugin_Pdf = Piwik_Common::getRequestVar('pdf', 0, 'int');
     $plugin_WindowsMedia = Piwik_Common::getRequestVar('wma', 0, 'int');
     $plugin_Java = Piwik_Common::getRequestVar('java', 0, 'int');
     $plugin_Cookie = Piwik_Common::getRequestVar('cookie', 0, 'int');
     $userAgent = Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_USER_AGENT']);
     $aBrowserInfo = Piwik_Common::getBrowserInfo($userAgent);
     $browserName = $aBrowserInfo['name'];
     $browserVersion = $aBrowserInfo['version'];
     $os = Piwik_Common::getOs($userAgent);
     $resolution = Piwik_Common::getRequestVar('res', 'unknown', 'string');
     $colorDepth = Piwik_Common::getRequestVar('col', 32, 'numeric');
     $ip = Piwik_Common::getIp();
     $ip = ip2long($ip);
     $browserLang = substr(Piwik_Common::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']), 0, 20);
     if (is_null($browserLang)) {
         $browserLang = '';
     }
     $configurationHash = $this->getConfigHash($os, $browserName, $browserVersion, $resolution, $colorDepth, $plugin_Flash, $plugin_Director, $plugin_RealPlayer, $plugin_Pdf, $plugin_WindowsMedia, $plugin_Java, $plugin_Cookie, $ip, $browserLang);
     $this->userSettingsInformation = array('config_md5config' => $configurationHash, 'config_os' => $os, 'config_browser_name' => $browserName, 'config_browser_version' => $browserVersion, 'config_resolution' => $resolution, 'config_color_depth' => $colorDepth, 'config_pdf' => $plugin_Pdf, 'config_flash' => $plugin_Flash, 'config_java' => $plugin_Java, 'config_director' => $plugin_Director, 'config_quicktime' => $plugin_Quicktime, 'config_realplayer' => $plugin_RealPlayer, 'config_windowsmedia' => $plugin_WindowsMedia, 'config_cookie' => $plugin_RealPlayer, 'location_ip' => $ip, 'location_browser_lang' => $browserLang);
     return $this->userSettingsInformation;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:36,代码来源:Visit.php

示例10: getFirstIpFromList

 /**
  * Returns the first element of a comma separated list of IPs
  *
  * @param string $ip
  *
  * @return string first element before ','
  */
 private static function getFirstIpFromList($ip)
 {
     $p = strpos($ip, ',');
     if ($p !== false) {
         return trim(Piwik_Common::sanitizeInputValues(substr($ip, 0, $p)));
     }
     return trim(Piwik_Common::sanitizeInputValues($ip));
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:15,代码来源:Common.php


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