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


PHP ProxyHttp::serverStaticFile方法代码示例

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


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

示例1:

    exit;
}
/**
 * piwik.js proxy
 *
 * @see core/Piwik.php
 */
define('PIWIK_INCLUDE_PATH', '..');
define('PIWIK_DOCUMENT_ROOT', '..');
define('PIWIK_USER_PATH', '..');
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
// Composer autoloader
if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')) {
    $path = PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
    // Piwik is the main project
} else {
    $path = PIWIK_INCLUDE_PATH . '/../../autoload.php';
    // Piwik is installed as a dependency
}
require $path;
$file = '../piwik.js';
$daysExpireFarFuture = 10;
$byteStart = $byteEnd = false;
if (!defined("PIWIK_KEEP_JS_TRACKER_COMMENT") || !PIWIK_KEEP_JS_TRACKER_COMMENT) {
    $byteStart = 369;
    // length of comment header in bytes
}
$environment = new \Piwik\Application\Environment(null);
$environment->init();
ProxyHttp::serverStaticFile($file, "application/javascript; charset=UTF-8", $daysExpireFarFuture, $byteStart, $byteEnd);
exit;
开发者ID:GovanifY,项目名称:piwik,代码行数:31,代码来源:tracker.php

示例2: serveJsFile

 /**
  * @param UIAsset $uiAsset
  */
 private function serveJsFile($uiAsset)
 {
     ProxyHttp::serverStaticFile($uiAsset->getAbsoluteLocation(), self::JS_MIME_TYPE);
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:7,代码来源:Controller.php

示例3: Exception

 * the execution of Piwik:serverStaticFile(). In this case, unit tests won't be executed
 */
// Getting the server mode
$staticFileServerMode = Common::getRequestVar(SRV_MODE_REQUEST_VAR, "");
// Setting zlib output compression as requested
ini_set('zlib.output_compression', Common::getRequestVar(ZLIB_OUTPUT_REQUEST_VAR, '0'));
if ($staticFileServerMode === "") {
    throw new Exception("When this testing file is used as a static file server, the request parameter " . SRV_MODE_REQUEST_VAR . " must be provided.");
}
switch ($staticFileServerMode) {
    // The static file server calls Piwik::serverStaticFile with a null file
    case NULL_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(null, TEST_FILE_CONTENT_TYPE);
        break;
        // The static file server calls Piwik::serverStaticFile with a non-existing file
    // The static file server calls Piwik::serverStaticFile with a non-existing file
    case GHOST_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION . ".ghost", TEST_FILE_CONTENT_TYPE);
        break;
        // The static file server calls Piwik::serverStaticFile with the test file
    // The static file server calls Piwik::serverStaticFile with the test file
    case TEST_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION, TEST_FILE_CONTENT_TYPE);
        break;
    case PARTIAL_TEST_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION, TEST_FILE_CONTENT_TYPE, $expireFarFutureDays = 100, PARTIAL_BYTE_START, PARTIAL_BYTE_END);
        break;
    case WHOLE_TEST_FILE_WITH_RANGE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION, TEST_FILE_CONTENT_TYPE, $expireFarFutureDays = 100, 0, filesize(TEST_FILE_LOCATION));
        break;
}
开发者ID:a4tunado,项目名称:piwik,代码行数:31,代码来源:staticFileServer.php

示例4:

<?php

/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
use Piwik\ProxyHttp;
/**
 * Tracker proxy
 */
if ($_SERVER['REQUEST_METHOD'] == 'POST' || !empty($_SERVER['QUERY_STRING'])) {
    include '../piwik.php';
    exit;
}
/**
 * piwik.js proxy
 *
 * @see core/Piwik.php
 */
define('PIWIK_INCLUDE_PATH', '..');
define('PIWIK_DOCUMENT_ROOT', '..');
define('PIWIK_USER_PATH', '..');
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
$file = '../piwik.js';
// There is no cache buster parameter so we don't set Expires: header
$expireFarFuture = false;
ProxyHttp::serverStaticFile($file, "application/javascript; charset=UTF-8", $expireFarFuture);
exit;
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:31,代码来源:index.php

示例5: download

 public function download()
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->dieIfPluginsAdminIsDisabled();
     $pluginName = new PluginName();
     $pluginName = $pluginName->getPluginName();
     Nonce::checkNonce($pluginName);
     $filename = $pluginName . '.zip';
     try {
         $pathToPlugin = $this->marketplaceApi->download($pluginName);
         ProxyHttp::serverStaticFile($pathToPlugin, 'application/zip', $expire = 0, $start = false, $end = false, $filename);
     } catch (Exception $e) {
         Common::sendResponseCode(500);
         Log::warning('Could not download file . ' . $e->getMessage());
     }
     if (!empty($pathToPlugin)) {
         Filesystem::deleteFileIfExists($pathToPlugin);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:19,代码来源:Controller.php

示例6: Exception

// These constants define which action will be performed by the static server.
define("NULL_FILE_SRV_MODE", "nullFile");
define("GHOST_FILE_SRV_MODE", "ghostFile");
define("TEST_FILE_SRV_MODE", "testFile");
/**
 * If the static file server has been requested, the response sent back to the browser will be the content produced by
 * the execution of Piwik:serverStaticFile(). In this case, unit tests won't be executed
 */
// Getting the server mode
$staticFileServerMode = Common::getRequestVar(SRV_MODE_REQUEST_VAR, "");
// Setting zlib output compression as requested
ini_set('zlib.output_compression', Common::getRequestVar(ZLIB_OUTPUT_REQUEST_VAR, '0'));
if ($staticFileServerMode === "") {
    throw new Exception("When this testing file is used as a static file server, the request parameter " . SRV_MODE_REQUEST_VAR . " must be provided.");
}
switch ($staticFileServerMode) {
    // The static file server calls Piwik::serverStaticFile with a null file
    case NULL_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(null, TEST_FILE_CONTENT_TYPE);
        break;
        // The static file server calls Piwik::serverStaticFile with a non-existing file
    // The static file server calls Piwik::serverStaticFile with a non-existing file
    case GHOST_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION . ".ghost", TEST_FILE_CONTENT_TYPE);
        break;
        // The static file server calls Piwik::serverStaticFile with the test file
    // The static file server calls Piwik::serverStaticFile with the test file
    case TEST_FILE_SRV_MODE:
        ProxyHttp::serverStaticFile(TEST_FILE_LOCATION, TEST_FILE_CONTENT_TYPE);
        break;
}
开发者ID:carriercomm,项目名称:piwik,代码行数:31,代码来源:staticFileServer.php


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