[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/cache/handler/ -> output.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: output.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla.Framework
   5  * @subpackage    Cache
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * Joomla! Cache output type object
  20   *
  21   * @package        Joomla.Framework
  22   * @subpackage    Cache
  23   * @since        1.5
  24   */
  25  class JCacheOutput extends JCache
  26  {
  27      /**
  28       * Start the cache
  29       *
  30       * @access    public
  31       * @param    string    $id        The cache data id
  32       * @param    string    $group    The cache data group
  33       * @return    boolean    True if the cache is hit (false else)
  34       * @since    1.5
  35       */
  36  	function start( $id, $group=null)
  37      {
  38          // If we have data in cache use that...
  39          $data = $this->get($id, $group);
  40          if ($data !== false) {
  41              echo $data;
  42              return true;
  43          } else {
  44              // Nothing in cache... lets start the output buffer and start collecting data for next time.
  45              ob_start();
  46              ob_implicit_flush( false );
  47              // Set id and group placeholders
  48              $this->_id        = $id;
  49              $this->_group    = $group;
  50              return false;
  51          }
  52      }
  53  
  54      /**
  55       * Stop the cache buffer and store the cached data
  56       *
  57       * @access    public
  58       * @return    boolean    True if cache stored
  59       * @since    1.5
  60       */
  61  	function end()
  62      {
  63          // Get data from output buffer and echo it
  64          $data = ob_get_contents();
  65          ob_end_clean();
  66          echo $data;
  67  
  68          // Get id and group and reset them placeholders
  69          $id        = $this->_id;
  70          $group    = $this->_group;
  71          $this->_id        = null;
  72          $this->_group    = null;
  73  
  74          // Get the storage handler and store the cached data
  75          $this->store($data, $id, $group);
  76      }
  77  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1