Source for file ITemplate.php

Documentation is available at ITemplate.php

  1. <?php
  2.  
  3. /**
  4.  * interface that represents a dwoo template
  5.  *
  6.  * This software is provided 'as-is', without any express or implied warranty.
  7.  * In no event will the authors be held liable for any damages arising from the use of this software.
  8.  *
  9.  * This file is released under the LGPL
  10.  * "GNU Lesser General Public License"
  11.  * More information can be found here:
  12.  * {@link http://www.gnu.org/copyleft/lesser.html}
  13.  *
  14.  * @author     Jordi Boggiano <[email protected]>
  15.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  16.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  17.  * @link       http://dwoo.org/
  18.  * @version    0.9.1
  19.  * @date       2008-05-30
  20.  * @package    Dwoo
  21.  */
  22. interface Dwoo_ITemplate
  23. {
  24.     /**
  25.      * returns the cache duration for this template
  26.      *
  27.      * defaults to null if it was not provided
  28.      *
  29.      * @return int|null
  30.      */
  31.     public function getCacheTime();
  32.  
  33.     /**
  34.      * sets the cache duration for this template
  35.      *
  36.      * can be used to set it after the object is created if you did not provide
  37.      * it in the constructor
  38.      *
  39.      * @param int $seconds duration of the cache validity for this template, if
  40.      *  null it defaults to the Dwoo instance's cache time. 0 = disable and
  41.      *  -1 = infinite cache
  42.      */
  43.     public function setCacheTime($seconds null);
  44.  
  45.     /**
  46.      * returns the cached template output file name, true if it's cache-able but not cached
  47.      * or false if it's not cached
  48.      *
  49.      * @param Dwoo $dwoo the dwoo instance that requests it
  50.      * @return string|bool
  51.      */
  52.     public function getCachedTemplate(Dwoo $dwoo);
  53.  
  54.     /**
  55.      * caches the provided output into the cache file
  56.      *
  57.      * @param Dwoo $dwoo the dwoo instance that requests it
  58.      * @param string $output the template output
  59.      * @return mixed full path of the cached file or false upon failure
  60.      */
  61.     public function cache(Dwoo $dwoo$output);
  62.  
  63.     /**
  64.      * clears the cached template if it's older than the given time
  65.      *
  66.      * @param Dwoo $dwoo the dwoo instance that was used to cache that template
  67.      * @param int $olderThan minimum time (in seconds) required for the cache to be cleared
  68.      * @return bool true if the cache was not present or if it was deleted, false if it remains there
  69.      */
  70.     public function clearCache(Dwoo $dwoo$olderThan = -1);
  71.  
  72.     /**
  73.      * returns the compiled template file name
  74.      *
  75.      * @param Dwoo $dwoo the dwoo instance that requests it
  76.      * @param Dwoo_ICompiler $compiler the compiler that must be used
  77.      * @return string 
  78.      */
  79.     public function getCompiledTemplate(Dwoo $dwooDwoo_ICompiler $compiler null);
  80.  
  81.     /**
  82.      * returns the template name
  83.      *
  84.      * @return string 
  85.      */
  86.     public function getName();
  87.  
  88.     /**
  89.      * returns the resource name for this template class
  90.      *
  91.      * @return string 
  92.      */
  93.     public function getResourceName();
  94.  
  95.     /**
  96.      * returns the resource identifier for this template or false if it has no identifier
  97.      *
  98.      * @return string|false
  99.      */
  100.     public function getResourceIdentifier();
  101.  
  102.     /**
  103.      * returns the template source of this template
  104.      *
  105.      * @return string 
  106.      */
  107.     public function getSource();
  108.  
  109.     /**
  110.      * returns an unique string identifying the current version of this template,
  111.      * for example a timestamp of the last modified date or a hash of the template source
  112.      *
  113.      * @return string 
  114.      */
  115.     public function getUid();
  116.  
  117.     /**
  118.      * returns the compiler used by this template, if it was just compiled, or null
  119.      *
  120.      * @return Dwoo_ICompiler 
  121.      */
  122.     public function getCompiler();
  123.  
  124.     /**
  125.      * returns a new template object from the given include name, null if no include is
  126.      * possible (resource not found), or false if include is not permitted by this resource type
  127.      *
  128.      * @param mixed $resourceId the resource identifier
  129.      * @param int $cacheTime duration of the cache validity for this template,
  130.      *                           if null it defaults to the Dwoo instance that will
  131.      *                           render this template
  132.      * @param string $cacheId the unique cache identifier of this page or anything else that
  133.      *                            makes this template's content unique, if null it defaults
  134.      *                            to the current url
  135.      * @param string $compileId the unique compiled identifier, which is used to distinguish this
  136.      *                              template from others, if null it defaults to the filename+bits of the path
  137.      * @return Dwoo_ITemplate|null|false
  138.      */
  139.     public static function templateFactory(Dwoo $dwoo$resourceId$cacheTime null$cacheId null$compileId null);
  140. }

Documentation generated on Sun, 03 Aug 2008 15:12:40 +0200 by phpDocumentor 1.4.0