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


PHP Common::sendHeader方法代码示例

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


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

示例1: getUpdaterJs

 /**
  * Return the base.less compiled to css
  *
  * @return string
  */
 public function getUpdaterJs()
 {
     Common::sendHeader('Content-Type: application/javascript; charset=UTF-8');
     Common::sendHeader('Cache-Control: max-age=' . 60 * 60);
     $files = array('libs/bower_components/jquery/dist/jquery.min.js', 'libs/bower_components/jquery-ui/ui/minified/jquery-ui.min.js', 'libs/bower_components/materialize/dist/js/materialize.min.js', 'plugins/Morpheus/javascripts/piwikHelper.js', 'plugins/CoreHome/javascripts/donate.js', 'plugins/CoreUpdater/javascripts/updateLayout.js', 'libs/bower_components/angular/angular.min.js', 'libs/bower_components/angular-sanitize/angular-sanitize.js', 'libs/bower_components/angular-animate/angular-animate.js', 'libs/bower_components/angular-cookies/angular-cookies.js', 'libs/bower_components/ngDialog/js/ngDialog.min.js', 'plugins/CoreHome/angularjs/common/services/service.module.js', 'plugins/CoreHome/angularjs/common/filters/filter.module.js', 'plugins/CoreHome/angularjs/common/filters/translate.js', 'plugins/CoreHome/angularjs/common/directives/directive.module.js', 'plugins/CoreHome/angularjs/common/directives/focus-anywhere-but-here.js', 'plugins/CoreHome/angularjs/piwikApp.config.js', 'plugins/CoreHome/angularjs/piwikApp.js', 'plugins/Installation/javascripts/installation.js');
     return AssetManager::compileCustomJs($files);
 }
开发者ID:piwik,项目名称:piwik,代码行数:12,代码来源:Controller.php

示例2: exitWithErrorMessage

 /**
  * Display the message in a nice red font with a nice icon
  * ... and dies
  *
  * @param string $message
  */
 public static function exitWithErrorMessage($message)
 {
     Common::sendHeader('Content-Type: text/html; charset=utf-8');
     $output = "<style>a{color:red;}</style>\n" . "<div style='color:red;font-family:Georgia;font-size:120%'>" . "<p><img src='plugins/Morpheus/images/error_medium.png' style='vertical-align:middle; float:left;padding:20px' />" . $message . "</p></div>";
     print $output;
     exit;
 }
开发者ID:GovanifY,项目名称:piwik,代码行数:13,代码来源:Piwik.php

示例3: exitWithErrorMessage

 /**
  * Display the message in a nice red font with a nice icon
  * ... and dies
  *
  * @param string $message
  */
 public static function exitWithErrorMessage($message)
 {
     Common::sendHeader('Content-Type: text/html; charset=utf-8');
     $message = str_replace("\n", "<br/>", $message);
     $output = "<html><body>" . "<style>a{color:red;}</style>\n" . "<div style='color:red;font-size:120%; width:100%;margin: 30px;'>" . " <div style='width: 50px; float: left;'><img src='plugins/Morpheus/images/error_medium.png' /></div>" . "  <div style='margin-left: 70px; min-width: 950px;'>" . $message . "  </div>" . " </div>" . "</div>" . "</body></html>";
     print $output;
     exit;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:14,代码来源:Piwik.php

示例4: sendHeader

 public function sendHeader()
 {
     if ($this->isJsonp()) {
         Common::sendHeader('Content-Type: application/javascript; charset=utf-8');
     } else {
         Renderer\Json::sendHeaderJSON();
     }
     ProxyHttp::overrideCacheControlHeaders();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:Json.php

示例5: formatScreenMessage

 public static function formatScreenMessage(&$message, $level, $tag, $datetime, $log)
 {
     if ($message instanceof \Exception) {
         Common::sendHeader('Content-Type: text/html; charset=utf-8');
         $outputFormat = strtolower(Common::getRequestVar('format', 'html', 'string'));
         $response = new ResponseBuilder($outputFormat);
         $message = $response->getResponseException(new \Exception($message->getMessage()));
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:9,代码来源:ExceptionHandler.php

示例6: factory

 /**
  * Creates a new instance of a class using a string ID.
  *
  * @param string $classId The ID of the class.
  * @return BaseFactory
  * @throws Exception if $classId is invalid.
  */
 public static function factory($classId)
 {
     $className = static::getClassNameFromClassId($classId);
     if (!class_exists($className)) {
         Common::sendHeader('Content-Type: text/plain; charset=utf-8');
         throw new Exception(static::getInvalidClassIdExceptionMessage($classId));
     }
     return new $className();
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:16,代码来源:BaseFactory.php

示例7: sendResponseToBrowserDirectly

 public function sendResponseToBrowserDirectly()
 {
     while (ob_get_level() > 1) {
         ob_end_flush();
     }
     Common::sendHeader("Connection: close\r\n", true);
     Common::sendHeader("Content-Encoding: none\r\n", true);
     Common::sendHeader('Content-Length: ' . ob_get_length(), true);
     ob_end_flush();
     flush();
 }
开发者ID:ruchitrami,项目名称:plugin-QueuedTracking,代码行数:11,代码来源:Response.php

示例8: handle

 public function handle()
 {
     // allow Piwik to serve data to all domains
     if (in_array("*", $this->domains)) {
         Common::sendHeader('Access-Control-Allow-Origin: *');
         return;
     }
     // specifically allow if it is one of the whitelisted CORS domains
     if (!empty($_SERVER['HTTP_ORIGIN'])) {
         $origin = $_SERVER['HTTP_ORIGIN'];
         if (in_array($origin, $this->domains, true)) {
             Common::sendHeader('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
         }
     }
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:15,代码来源:CORSHandler.php

示例9: checkHeaderInTracker

 /**
  * Checks for DoNotTrack headers and if found, sets `$exclude` to `true`.
  */
 public function checkHeaderInTracker(&$exclude)
 {
     if ($exclude) {
         Common::printDebug("Visit is already excluded, no need to check DoNotTrack support.");
         return;
     }
     $exclude = $this->isDoNotTrackFound();
     if ($exclude) {
         $trackingCookie = IgnoreCookie::getTrackingCookie();
         $trackingCookie->delete();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression (draft)
         Common::sendHeader('Tk: 1');
     }
 }
开发者ID:sebastianpiskorski,项目名称:piwik,代码行数:19,代码来源:DoNotTrackHeaderChecker.php

示例10: checkHeaderInTracker

 /**
  * Checks for DoNotTrack headers and if found, sets `$exclude` to `true`.
  */
 public function checkHeaderInTracker(&$exclude)
 {
     if ($exclude) {
         Common::printDebug("Visit is already excluded, no need to check DoNotTrack support.");
         return;
     }
     $exclude = $this->isDoNotTrackFound();
     if ($exclude) {
         IgnoreCookie::deleteThirdPartyCookieUIDIfExists();
         // this is an optional supplement to the site's tracking status resource at:
         //     /.well-known/dnt
         // per Tracking Preference Expression
         //Tracking Perference Expression has been updated to require Tk: N rather than Tk: 1
         Common::sendHeader('Tk: N');
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:19,代码来源:DoNotTrackHeaderChecker.php

示例11: render

    /**
     * Outputs the data.
     *
     * @return string  html
     */
    public function render()
    {
        // set response headers
        @Common::sendHeader('Content-Type: text/html; charset=UTF-8');
        @Common::sendHeader('Pragma: ');
        @Common::sendHeader('Expires: ');
        @Common::sendHeader('Cache-Control: must-revalidate');
        @Common::sendHeader('X-Frame-Options: deny');
        $error = htmlspecialchars($this->error, ENT_QUOTES, 'UTF-8');
        $messages = htmlspecialchars(serialize($this->feedbackMessages), ENT_QUOTES, 'UTF-8');
        $tokenAuth = $this->tokenAuth;
        $httpsFail = (int) $this->httpsFail;
        // use a heredoc instead of an external file
        echo <<<END_OF_TEMPLATE
<!DOCTYPE html>
<html>
 <head>
  <meta name="robots" content="noindex,nofollow">
  <meta charset="utf-8">
  <title></title>
 </head>
 <body>
  <form name="myform" method="post" action="?module=CoreUpdater&amp;action=oneClickResults">
   <input type="hidden" name="token_auth" value="{$tokenAuth}" />
   <input type="hidden" name="error" value="{$error}" />
   <input type="hidden" name="messages" value="{$messages}" />
   <input type="hidden" name="httpsFail" value="{$httpsFail}" />
   <noscript>
    <button type="submit">Continue</button>
   </noscript>
  </form>
  <script type="text/javascript">
   document.myform.submit();
  </script>
 </body>
</html>
END_OF_TEMPLATE;
    }
开发者ID:diosmosis,项目名称:piwik,代码行数:43,代码来源:OneClickDone.php

示例12: getBaseCss

 /**
  * Prints out the CSS for installer/updater
  *
  * During installation and update process, we load a minimal Less file.
  * At this point Piwik may not be setup yet to write files in tmp/assets/
  * so in this case we compile and return the string on every request.
  */
 public function getBaseCss()
 {
     Common::sendHeader('Content-Type: text/css');
     return AssetManager::getInstance()->getCompiledBaseCss()->getContent();
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:12,代码来源:Controller.php

示例13: render

 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsAnonymous = Piwik::isUserIsAnonymous();
         $this->userIsSuperUser = Piwik::hasUserSuperUserAccess();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         $piwikAds = StaticContainer::get('Piwik\\ProfessionalServices\\Advertising');
         $this->areAdsForProfessionalServicesEnabled = $piwikAds->areAdsForProfessionalServicesEnabled();
         if (Development::isEnabled()) {
             $cacheBuster = rand(0, 10000);
         } else {
             $cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster();
         }
         $this->cacheBuster = $cacheBuster;
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($this->userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         Log::debug($e);
         // can fail, for example at installation (no plugin loaded yet)
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     Common::sendHeader('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads
     // - when calling sendHeader() multiple times, the last one prevails
     Common::sendHeader('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:41,代码来源:View.php

示例14: sendHeader

 public function sendHeader()
 {
     if ($this->shouldSerialize()) {
         Common::sendHeader('Content-Type: text/plain; charset=utf-8');
     }
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:6,代码来源:Original.php

示例15: sendHeaderJSON

 public static function sendHeaderJSON()
 {
     Common::sendHeader('Content-Type: application/json; charset=utf-8');
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:4,代码来源:Json.php


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