當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Common::sanitizeInputValues方法代碼示例

本文整理匯總了PHP中Piwik\Common::sanitizeInputValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP Common::sanitizeInputValues方法的具體用法?PHP Common::sanitizeInputValues怎麽用?PHP Common::sanitizeInputValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Common的用法示例。


在下文中一共展示了Common::sanitizeInputValues方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 $piwikUrl
  * @param bool $mergeSubdomains
  * @param bool $groupPageTitlesByDomain
  * @param bool $mergeAliasUrls
  * @param bool $visitorCustomVariables
  * @param bool $pageCustomVariables
  * @param bool $customCampaignNameQueryParam
  * @param bool $customCampaignKeywordParam
  * @param bool $doNotTrack
  * @param bool $disableCookies
  * @return string The Javascript tag ready to be included on the HTML pages
  */
 public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false, $mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false, $customCampaignNameQueryParam = false, $customCampaignKeywordParam = false, $doNotTrack = false, $disableCookies = false)
 {
     Piwik::checkUserHasViewAccess($idSite);
     if (empty($piwikUrl)) {
         $piwikUrl = SettingsPiwik::getPiwikUrl();
     }
     $piwikUrl = Common::sanitizeInputValues($piwikUrl);
     $htmlEncoded = Piwik::getJavascriptCode($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain, $mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables, $customCampaignNameQueryParam, $customCampaignKeywordParam, $doNotTrack, $disableCookies);
     $htmlEncoded = str_replace(array('<br>', '<br />', '<br/>'), '', $htmlEncoded);
     return $htmlEncoded;
 }
開發者ID:a4tunado,項目名稱:piwik,代碼行數:28,代碼來源:API.php

示例2: testSanitizeInputValues

 /**
  * @dataProvider getInputValues
  */
 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, Common::sanitizeInputValues($input));
         $this->assertTrue(@set_magic_quotes_runtime(0));
         $this->assertEquals(0, @get_magic_quotes_runtime());
     }
     $this->assertEquals($output, Common::sanitizeInputValues($input));
 }
開發者ID:cemo,項目名稱:piwik,代碼行數:14,代碼來源:CommonTest.php

示例3: sendMessage

 public function sendMessage($content, $fromAdmin = false, $idAutoMsg = false)
 {
     $hexVisitorId = Common::convertVisitorIdToBin($this->idvisitor);
     $sanitizeContent = Common::sanitizeInputValues($content);
     $additionnalParams = "";
     $microtime = microtime(true);
     $arguments = array($this->idsite, $hexVisitorId, $sanitizeContent, $microtime);
     if ($idAutoMsg) {
         $additionnalParams .= ", idautomsg = ?";
         $arguments[] = $idAutoMsg;
     }
     if ($fromAdmin) {
         $additionnalParams .= ", answerfrom = ?";
         $arguments[] = $fromAdmin;
     }
     $queryResult = Db::query("INSERT INTO " . Common::prefixTable('chat') . " SET idsite = ?, idvisitor = ?, content = ?, microtime = ?{$additionnalParams}", $arguments);
     if (!$fromAdmin) {
         ChatAcknowledgment::setLastSent($this->idsite, $this->idvisitor, $microtime);
         //ChatMail::sendNotificationToAdmin($this->idsite, $this->idvisitor, $sanitizeContent);
     }
     $insertedRow = Db::fetchRow("SELECT idmessage,microtime FROM " . Common::prefixTable('chat') . " WHERE idvisitor = ? AND microtime = ?", array($hexVisitorId, $microtime));
     return $insertedRow;
 }
開發者ID:WHATNEXTLIMITED,項目名稱:piwik-chat,代碼行數:23,代碼來源:ChatConversation.php

示例4: printDebug

 /**
  * @todo This method is weird, it's debugging statements but seem to only work for the tracker, maybe it
  * should be moved elsewhere
  */
 public static function printDebug($info = '')
 {
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
         if (!headers_sent()) {
             // prevent XSS in tracker debug output
             header('Content-type: text/plain');
         }
         if (is_object($info)) {
             $info = var_export($info, true);
         }
         if (is_array($info) || is_object($info)) {
             $info = Common::sanitizeInputValues($info);
             $out = var_export($info, true);
             foreach (explode("\n", $out) as $line) {
                 echo $line . "\n";
             }
         } else {
             foreach (explode("\n", $info) as $line) {
                 echo $line . "\n";
             }
         }
     }
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:27,代碼來源:Common.php

示例5: printDebug

 public static function printDebug($info = '')
 {
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
         if (is_object($info)) {
             $info = var_export($info, true);
         }
         Log::getInstance()->setLogLevel(Log::DEBUG);
         if (is_array($info) || is_object($info)) {
             $info = Common::sanitizeInputValues($info);
             $out = var_export($info, true);
             foreach (explode("\n", $out) as $line) {
                 Log::debug($line);
             }
         } else {
             foreach (explode("\n", $info) as $line) {
                 Log::debug(htmlspecialchars($line, ENT_QUOTES));
             }
         }
     }
 }
開發者ID:emersonmatsumoto,項目名稱:piwik,代碼行數:20,代碼來源:Common.php

示例6: printDebug

 public static function printDebug($info = '')
 {
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
         if (is_object($info)) {
             $info = var_export($info, true);
         }
         if (is_array($info)) {
             print "<pre>";
             $info = Common::sanitizeInputValues($info);
             $out = var_export($info, true);
             echo $out;
             print "</pre>";
         } else {
             print htmlspecialchars($info, ENT_QUOTES) . "<br />\n";
         }
     }
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:17,代碼來源:Common.php

示例7: printDebug

 /**
  * @todo This method is weird, it's debugging statements but seem to only work for the tracker, maybe it
  * should be moved elsewhere
  */
 public static function printDebug($info = '')
 {
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
         if (!headers_sent()) {
             // prevent XSS in tracker debug output
             Common::sendHeader('Content-type: text/plain');
         }
         if (is_object($info)) {
             $info = var_export($info, true);
         }
         $logger = StaticContainer::get('Psr\\Log\\LoggerInterface');
         if (is_array($info) || is_object($info)) {
             $info = Common::sanitizeInputValues($info);
             $out = var_export($info, true);
             foreach (explode("\n", $out) as $line) {
                 $logger->debug($line);
             }
         } else {
             foreach (explode("\n", $info) as $line) {
                 $logger->debug($line);
             }
         }
     }
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:28,代碼來源:Common.php


注:本文中的Piwik\Common::sanitizeInputValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。