Example #1
0
 /**
  * Start output buffering for saving into a new cache file.
  * 
  * @param string $identifier 	An identifier to be saved as, by convention a URI
  * @return boolean 				If the creation was successful
  */
 public static function create($identifier)
 {
     if (static::$authorized_override) {
         return false;
     }
     if (!static::$enabled) {
         return false;
     }
     static::$started = true;
     static::$identifier = $identifier;
     fBuffer::start();
     return true;
 }
Example #2
0
 /**
  * Enables buffered output, allowing ::set() and ::add() to happen after a ::place() but act as if they were done before
  * 
  * Please note that using buffered output will affect the order in which
  * code is executed since the elements are not actually ::place()'ed until
  * the destructor is called.
  * 
  * If the non-template code depends on template code being executed
  * sequentially before it, you may not want to use output buffering.
  * 
  * @return void
  */
 public function buffer()
 {
     static $id_sequence = 1;
     if ($this->buffered_id) {
         throw new fProgrammerException('Buffering has already been started');
     }
     if (!fBuffer::isStarted()) {
         fBuffer::start();
     }
     $this->buffered_id = $id_sequence;
     $id_sequence++;
 }
 public function testStopDuringCapture()
 {
     $this->setExpectedException('fProgrammerException');
     fBuffer::start();
     $this->started_buffer = TRUE;
     fBuffer::startCapture();
     $this->started_capture = TRUE;
     fBuffer::stop();
 }