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


PHP Common::sanitizeLineBreaks方法代码示例

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


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

示例1: getRequestsArrayFromBulkRequest

 public function getRequestsArrayFromBulkRequest($rawData)
 {
     $rawData = trim($rawData);
     $rawData = Common::sanitizeLineBreaks($rawData);
     // POST data can be array of string URLs or array of arrays w/ visit info
     $jsonData = json_decode($rawData, $assoc = true);
     $tokenAuth = Common::getRequestVar('token_auth', false, 'string', $jsonData);
     $requests = array();
     if (isset($jsonData['requests'])) {
         $requests = $jsonData['requests'];
     }
     return array($requests, $tokenAuth);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:Requests.php

示例2: authenticateBulkTrackingRequests

 private function authenticateBulkTrackingRequests($rawData)
 {
     $rawData = trim($rawData);
     $rawData = Common::sanitizeLineBreaks($rawData);
     // POST data can be array of string URLs or array of arrays w/ visit info
     $jsonData = json_decode($rawData, $assoc = true);
     if (isset($jsonData['requests'])) {
         $this->requests = $jsonData['requests'];
     }
     $tokenAuth = Common::getRequestVar('token_auth', false, 'string', $jsonData);
     if (empty($tokenAuth)) {
         throw new Exception("token_auth must be specified when using Bulk Tracking Import. See <a href='http://developer.piwik.org/api-reference/tracking-api'>Tracking Doc</a>");
     }
     if (!empty($this->requests)) {
         $idSitesForAuthentication = array();
         foreach ($this->requests as &$request) {
             // if a string is sent, we assume its a URL and try to parse it
             if (is_string($request)) {
                 $params = array();
                 $url = @parse_url($request);
                 if (!empty($url)) {
                     @parse_str($url['query'], $params);
                     $request = $params;
                 }
             }
             // We need to check access for each single request
             if (isset($request['idsite']) && !in_array($request['idsite'], $idSitesForAuthentication)) {
                 $idSitesForAuthentication[] = $request['idsite'];
             }
         }
         foreach ($idSitesForAuthentication as $idSiteForAuthentication) {
             // a Bulk Tracking request that is not authenticated should fail
             if (!Request::authenticateSuperUserOrAdmin($tokenAuth, $idSiteForAuthentication)) {
                 throw new Exception("token_auth specified does not have Admin permission for site " . intval($idSiteForAuthentication));
             }
         }
     }
     return $tokenAuth;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:39,代码来源:Tracker.php


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