- Timestamp:
- May 31, 2012, 2:39:20 AM (12 years ago)
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/cache.php
r264 r265 31 31 public $verbose = false; // print html comments and errors 32 32 33 public $cache_file; 34 public $test_files = array(); 33 // these must be set after constructing! 34 public $cache_file; // must be set! 35 public $test_files = array(); // must be set! 35 36 36 37 private $mtime_cache_file = null; // needed for cache header output … … 61 62 } 62 63 64 /** 65 * Calculates and compares the mtimes of the cache file and testing files. 66 * Doesn't obey any debug/skip/purge rules, just gives out if the cache file 67 * is valid or not. 68 * The result is cached in $is_valid, so you can call this (heavy to calc) 69 * method frequently. 70 **/ 63 71 function is_valid() { 64 72 // no double calculation … … 89 97 } 90 98 99 /** 100 * The "front end" to is_valid: Takes skipping and purging rules into 101 * account to decide whether you shall use the cache or not. 102 * @returns boolean value if cache is supposed to be valid or not. 103 **/ 91 104 function shall_use() { 92 105 $test = $this->is_valid() && !$this->skip && !$this->purge; … … 97 110 } 98 111 112 /** 113 * Prints out cache file with according HTTP headers and HTTP caching 114 * (HTTP_IF_MODIFIED_SINCE). You must not print out anything after such a http 115 * header! Therefore consider using the convenience method print_cache_and_exit() 116 * instead of this one or exit on yourself. 117 **/ 99 118 function print_cache() { 100 119 // make sure we already have called is_valid … … 124 143 } 125 144 145 /** 146 * Convenience method which will exit the program after calling print_cache(). 147 **/ 126 148 function print_cache_and_exit() { 127 149 $this->print_cache(); … … 129 151 } 130 152 153 /** 154 * Convenience method for calling the typical workflow: Test if the cache file 155 * shall be used, and if yes, print it out and exit the program. If this method 156 * returns, you can be sure that you have to create a (new) cache file. So your 157 * typical code will look like: 158 * 159 * $cache = new t29Cache(); 160 * // initialization stuff $cache->... = ... 161 * $cache->try_cache_and_exit(); 162 * // so we are still alive - go making content! 163 * $cache->start_cache(...); 164 * echo "be happy"; 165 * $cache->write_cache(); // at least if you didn't use any registered shutdown function. 166 * 167 **/ 131 168 function try_cache_and_exit() { 132 169 if($this->shall_use()) … … 216 253 } 217 254 218 function print_info($string, $even_if_nonverbose=false) { 255 256 private function print_info($string, $even_if_nonverbose=false) { 219 257 if($this->verbose || $even_if_nonverbose) 220 258 echo "<!-- t29Cache: $string -->\n"; 221 259 } 222 260 223 function print_error($string, $even_if_nonverbose=false) {261 private function print_error($string, $even_if_nonverbose=false) { 224 262 if($this->verbose || $even_if_nonverbose) 225 263 echo "<div class='error t29cache'>t29Cache: $string</div>\n"; -
lib/template.php
r264 r265 134 134 </section> 135 135 <hr> 136 <section class="sidebar ">136 <section class="sidebar top"> 137 137 <h2 class="visuallyhidden"><?php $p("sidebar-h2-tour"); ?></h2> 138 138 <nav class="side"> … … 140 140 </nav> 141 141 <!-- menu changing buttons are made with javascript --> 142 </section> 143 <section class="sidebar bottom"> 144 <!-- inhalte die unten ueber dem header sind --> 142 145 </section> 143 146 </div><!-- div id="background-color-container" helper end -->
Note: See TracChangeset
for help on using the changeset viewer.