Example #1
0
 public static function end()
 {
     $content = gzuncompress(gzcompress(ob_get_contents()));
     ob_end_clean();
     $r = RenderingStack::peek();
     if (self::$store_mode == self::STORE_MODE_OVERWRITE || self::$store_mode == self::STORE_MODE_ERROR_ON_OVERWRITE) {
         $r->set(self::$sector_path, $content);
     }
     if (self::$store_mode == self::STORE_MODE_APPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $old_content . $content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     if (self::$store_mode == self::STORE_MODE_PREPEND) {
         if ($r->is_set(self::$sector_path)) {
             $old_content = $r->get(self::$sector_path);
             $r->set(self::$sector_path, $content . $old_content);
         } else {
             $r->set(self::$sector_path, $content);
         }
     }
     self::$sector_opened = false;
     self::$store_mode = null;
     self::$sector_path = null;
 }