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


PHP ob_list_handlers函数代码示例

本文整理汇总了PHP中ob_list_handlers函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_list_handlers函数的具体用法?PHP ob_list_handlers怎么用?PHP ob_list_handlers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: sendResponse

 /**
  * send response (file)
  * @access public
  *
  */
 function sendResponse()
 {
     if (!function_exists('ob_list_handlers') || !ob_list_handlers()) {
         @ob_end_clean();
     }
     header("Content-Encoding: none");
     $this->checkConnector();
     $this->checkRequest();
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["FileName"]);
     $_resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$_resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     if ($_resourceTypeInfo->checkIsHiddenFile($fileName) || !file_exists($filePath) || !is_file($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName);
     header("Cache-Control: cache, must-revalidate");
     header("Pragma: public");
     header("Expires: 0");
     header("Content-type: application/octet-stream; name=\"" . $fileName . "\"");
     header("Content-Disposition: attachment; filename=\"" . str_replace("\"", "\\\"", $fileName) . "\"");
     header("Content-Length: " . filesize($filePath));
     CKFinder_Connector_Utils_FileSystem::readfileChunked($filePath);
     exit;
 }
开发者ID:BGCX067,项目名称:facebooksurveyom-svn-to-git,代码行数:38,代码来源:DownloadFile.php

示例2: printHeader

 /**
  * Prints any header information for this output module
  *
  * @access	public
  * @return	null		Prints header() information
  */
 public function printHeader()
 {
     //-----------------------------------------
     // Start GZIP compression
     //-----------------------------------------
     if ($this->settings['disable_gzip'] != 1) {
         $buffer = "";
         if (count(ob_list_handlers())) {
             $buffer = ob_get_contents();
             ob_end_clean();
         }
         @ob_start('ob_gzhandler');
         print $buffer;
     }
     if (isset($_SERVER['SERVER_PROTOCOL']) and strstr($_SERVER['SERVER_PROTOCOL'], '/1.0')) {
         header("HTTP/1.0 200 OK");
     } else {
         header("HTTP/1.1 200 OK");
     }
     /* This now forces UTF-8 */
     header("Content-type: text/xml;charset=UTF-8");
     if ($this->settings['nocache']) {
         header("Cache-Control: no-cache, must-revalidate, max-age=0");
         header("Expires: 0");
         header("Pragma: no-cache");
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:33,代码来源:xmlOutput.php

示例3: log

 function log($text, $data = '')
 {
     if (empty($this->isActive) || empty($text)) {
         return;
     }
     // sometimes some system plugins can use the router. If we use
     // print_r in this situatation, this generates an error
     // Cannot use output buffering in output buffering display handlers
     // so we must check first that no handler is being used
     $logData = '';
     if (!empty($data)) {
         $handlers = ob_list_handlers();
         if (empty($handlers)) {
             $logData = ":\t" . print_r($data, true);
         } else {
             // we can't use print_r
             if (is_object($data)) {
                 $logData .= $this->logObject($data);
             } else {
                 if (is_array($data)) {
                     $logData .= ":\n";
                     $logData .= $this->logArray($data);
                 } else {
                     $logData .= ":\t" . $data;
                 }
             }
         }
     }
     fWrite($this->logFile, $this->logTime() . "\t" . $text . $logData . "\n");
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:30,代码来源:shSimpleLogger.class.php

示例4: show

 public function show()
 {
     if (count(ob_list_handlers()) > 0) {
         ob_clean();
     }
     header('Content-Type: image/png');
     $this->generate();
     $red = rand(200, 255);
     $green = rand(200, 250);
     $blue = rand(200, 200);
     $image = imagecreate(90, 30);
     $background_color = imagecolorallocate($image, 0, 0, 0);
     $textcolor = imagecolorallocate($image, $red, $green, $blue);
     imagestring($image, 5, 18, 8, $_SESSION['captcha'], $textcolor);
     for ($i = 0; $i < 20; ++$i) {
         $x1 = rand(1, 80);
         $y1 = rand(1, 25);
         $x2 = $x1 + 4;
         $y2 = $y1 + 4;
         $color = imagecolorallocate($image, ~$green, ~$blue, ~$red);
         imageline($image, $x1, $y1, $x2, $y2, $color);
     }
     imagepng($image);
     imagedestroy($image);
 }
开发者ID:RoxasShadow,项目名称:nerdz.eu,代码行数:25,代码来源:captcha.class.php

示例5: __construct

 /**
  * class constructor will include the external console class, initialize it and store
  * its instance as $console property. the class can not be instantiated other
  * then using singleton method create. the loaded console class will be init and map
  * with its log types to this classed log types.
  *
  * @error 10901
  * @param string $driver expects the driver string to load
  * @param array $options expects an driver dependent option array
  * @throws Xapp_Error
  */
 protected function __construct($driver, array $options = array())
 {
     $this->_driver = strtolower(trim($driver));
     switch ($this->_driver) {
         case 'firephp':
             xapp_import('firephp.firephp-core.*');
             if (sizeof(ob_list_handlers()) === 0) {
                 ob_start();
             }
             $this->console = FirePHP::init();
             $this->console->setOptions($options);
             self::$_typeMap = array_merge(self::$_typeMap, array('log' => FirePHP::LOG, 'warn' => FirePHP::WARN, 'info' => FirePHP::INFO, 'error' => FirePHP::ERROR, 'dump' => FirePHP::DUMP, 'trace' => FirePHP::TRACE, 'group' => FirePHP::GROUP_START, 'ungroup' => FirePHP::GROUP_END));
             break;
         case 'chromephp':
             xapp_import('xapp.Ext.ChromePhp');
             $this->console = ChromePhp::getInstance();
             if (!isset($options[ChromePhp::BACKTRACE_LEVEL])) {
                 $options[ChromePhp::BACKTRACE_LEVEL] = 2;
             }
             $this->console->addSettings($options);
             self::$_typeMap = array_merge(self::$_typeMap, array('log' => ChromePhp::LOG, 'warn' => ChromePhp::WARN, 'info' => ChromePhp::INFO, 'error' => ChromePhp::ERROR, 'dump' => ChromePhp::INFO, 'trace' => ChromePhp::INFO, 'group' => ChromePhp::GROUP, 'ungroup' => ChromePhp::GROUP_END));
             break;
         default:
             throw new Xapp_Error(xapp_sprintf(_("xapp console driver: %s not supported"), $driver), 1090101);
     }
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:37,代码来源:Console.php

示例6: checkAndClean

function checkAndClean()
{
    print_r(ob_list_handlers());
    while (ob_get_level() > 0) {
        ob_end_flush();
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:ob_start_basic_005.php

示例7: renderErrorGui

 /**
  *
  */
 public function renderErrorGui(\fbenard\Zero\Classes\Error $error)
 {
     // Clean the buffer
     $handlers = ob_list_handlers();
     while (empty($handlers) === false) {
         ob_end_clean();
         $handlers = ob_list_handlers();
     }
     // Get HTTP request headers
     $requestHeaders = apache_request_headers();
     $requestHeaders = array_change_key_case($requestHeaders, CASE_LOWER);
     // Build HTTP response headers
     $responseHeaders = ['cache-control' => 'private, no-cache, no-store, must-revalidate', 'content-type' => 'text/html; charset=UTF-8'];
     // Build the result
     $result = [];
     if (array_key_exists('accept-content', $requestHeaders) === true && $requestHeaders['accept-content'] === 'application/json') {
         // Content-Type is application/json
         $responseHeaders['content-type'] = 'application/json; charset=UTF-8';
         // Render the error
         $result = $this->renderErrorJson($error);
     } else {
         $result = $this->renderErrorHtml($error);
     }
     // Send HTTP response headers
     if (headers_sent() === false) {
         foreach ($responseHeaders as $headerCode => $headerValue) {
             header($headerCode . ': ' . $headerValue);
         }
     }
     return $result;
 }
开发者ID:fbenard,项目名称:zero,代码行数:34,代码来源:ErrorRenderer.php

示例8: headway_gzip

/**
 * Starts the GZIP output buffer.
 *
 * @return bool
 **/
function headway_gzip()
{
    //If zlib is not loaded, we can't gzip.
    if (!extension_loaded('zlib')) {
        return false;
    }
    //If zlib.output_compression is on, do not gzip
    if (ini_get('zlib.output_compression') == 1) {
        return false;
    }
    //If a cache system is active then do not gzip
    if (defined('WP_CACHE') && WP_CACHE) {
        return false;
    }
    //Allow headway_gzip filter to cancel gzip compression.
    if (!($gzip = apply_filters('headway_gzip', HeadwayOption::get('enable-gzip', false, true)))) {
        return false;
    }
    //If gzip has already happened, then just return.
    if (in_array('ob_gzhandler', ob_list_handlers())) {
        return;
    }
    ob_start('ob_gzhandler');
    return true;
}
开发者ID:danaiser,项目名称:hollandLawns,代码行数:30,代码来源:functions.php

示例9: wrap_layout

function wrap_layout($template)
{
    if ($template) {
        $template = realpath($template);
        if (!file_exists($template)) {
            trigger_error('Could not locate layout: (' . $template . ')', E_USER_ERROR);
            return false;
        }
        view_set('layout', $template);
        if (!in_array('layout_capture_content', ob_list_handlers())) {
            ob_start('layout_capture_content');
            register_shutdown_function('render_layout');
        }
    } else {
        // clear all pre-existing layout handling
        while (ob_list_handlers()) {
            @ob_get_clean();
        }
        view_set('layout', $template);
        view_set('content', '');
        ob_start();
        //echo "hi patrick [$template]"; global $mf_view; print_r($mf_view);
    }
    return true;
}
开发者ID:patsplat,项目名称:Greenroom,代码行数:25,代码来源:layout.php

示例10: _clearObFilters

 /**
  * clear ob filters.
  */
 protected static function _clearObFilters()
 {
     $handlers = ob_list_handlers();
     while (!empty($handlers)) {
         ob_end_clean();
         $handlers = ob_list_handlers();
     }
 }
开发者ID:neuroinformatics,项目名称:xcl-module-cosmoapi,代码行数:11,代码来源:LoginAction.class.php

示例11: move_output_buffer

 /**
  * Move output buffer after Above The Fold optimization output buffer
  */
 public function move_output_buffer()
 {
     // get callbacks
     $ob_callbacks = ob_list_handlers();
     if (!empty($ob_callbacks) && in_array('WebSharks\\CometCache\\Classes\\AdvancedCache::outputBufferCallbackHandler', $ob_callbacks)) {
         // move
         $this->CTRL->optimization->move_ob_to_front();
     }
 }
开发者ID:optimalisatie,项目名称:above-the-fold-optimization,代码行数:12,代码来源:comet-cache.inc.php

示例12: redirect_abs301

 public static function redirect_abs301($url)
 {
     $handlers = ob_list_handlers();
     for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) {
         ob_end_clean();
     }
     header("HTTP/1.1 301 Moved Permanently");
     header("Location: " . $url);
 }
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:9,代码来源:class.cge_redirect.php

示例13: fix_output_buffer

 private static function fix_output_buffer()
 {
     $ob_list_handlers = ob_list_handlers();
     $ob_list_handlers_count = count($ob_list_handlers);
     $exclude = array('ob_gzhandler', 'zlib output compression');
     if ($ob_list_handlers_count && !in_array($ob_list_handlers[$ob_list_handlers_count - 1], $exclude)) {
         ob_clean();
     }
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:9,代码来源:response.php

示例14: error_handler

function error_handler($errNo, $errStr, $errFile, $errLine)
{
    $handlers = ob_list_handlers();
    while (!empty($handlers)) {
        ob_end_clean();
        $handlers = ob_list_handlers();
    }
    $error_message = 'ERRNO: ' . $errNo . '<br>' . 'TEXT: ' . $errStr . '<br>' . 'LOCATION: ' . $errFile . ', line ' . $errLine;
    send_error('<span style="color:red;font-weight:400;font-size:12pt">' . $error_message . '</span><br><br><br><pre>' . print_r(debug_backtrace(), true) . '</pre>', 'Ошибка: ' . $errNo . ' - ' . $errFile . ', ' . $errLine . '');
}
开发者ID:themiddleearth,项目名称:RPG.SU,代码行数:10,代码来源:config.inc.php

示例15: wds_stop_title_buffer

 /**
  * Stops buffering the output - the title should now be in the buffer.
  */
 function wds_stop_title_buffer()
 {
     if (function_exists('ob_list_handlers')) {
         $active_handlers = ob_list_handlers();
     } else {
         $active_handlers = array();
     }
     if (count($active_handlers) > 0 && preg_match('/::wds_process_title_buffer$/', trim($active_handlers[count($active_handlers) - 1]))) {
         ob_end_flush();
     }
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:14,代码来源:wds-onpage.php


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