Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/cache/handlers/output.php

Documentation is available at output.php

  1. <?php
  2. /**
  3. @version        $Id: output.php 6472 2007-02-03 10:47:26Z pasamio $
  4. @package        Joomla.Framework
  5. @subpackage    Cache
  6. @copyright    Copyright (C) 2005 - 2007 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.  * @author        Louis Landry <[email protected]>
  22.  * @package        Joomla.Framework
  23.  * @subpackage    Cache
  24.  * @since        1.5
  25.  */
  26. class JCacheOutput extends JCache
  27. {
  28.     /**
  29.      * Start the cache
  30.      *
  31.      * @access    public
  32.      * @param    string    $id        The cache data id
  33.      * @param    string    $group    The cache data group
  34.      * @return    boolean    True if the cache is hit (false else)
  35.      * @since    1.5
  36.      */
  37.     function start$id$group=null)
  38.     {
  39.         // If we have data in cache use that...
  40.         $data $this->get($id$group);
  41.         if ($data !== false{
  42.             echo $data;
  43.             return true;
  44.         else {
  45.             // Nothing in cache... lets start the output buffer and start collecting data for next time.
  46.             ob_start();
  47.             ob_implicit_flushfalse );
  48.             // Set id and group placeholders
  49.             $this->_id        $id;
  50.             $this->_group    $group;
  51.             return false;
  52.         }
  53.     }
  54.  
  55.     /**
  56.      * Stop the cache buffer and store the cached data
  57.      *
  58.      * @access    public
  59.      * @return    boolean    True if cache stored
  60.      * @since    1.5
  61.      */
  62.     function end()
  63.     {
  64.         // Get data from output buffer and echo it
  65.         $data ob_get_contents();
  66.         ob_end_clean();
  67.         echo $data;
  68.  
  69.         // Get id and group and reset them placeholders
  70.         $id        $this->_id;
  71.         $group    $this->_group;
  72.         $this->_id        null;
  73.         $this->_group    null;
  74.  
  75.         // Get the storage handler and store the cached data
  76.         $this->store($data$id$group);
  77.     }
  78. }
  79. ?>

Documentation generated on Mon, 05 Mar 2007 21:12:28 +0000 by phpDocumentor 1.3.1