示例#1
0
 /**
  * Performs buffered replacements using a breadth-first technique
  *
  * @return void
  */
 private function placeBuffered()
 {
     if (!$this->buffered_id) {
         return;
     }
     $contents = fBuffer::get();
     fBuffer::erase();
     // We are gonna use a regex replacement that is eval()'ed as PHP code
     $regex = '/%%fTemplating::' . $this->buffered_id . '::(.*?)::(.*?)%%/';
     // Remove the buffered id, thus making any nested place() calls be executed immediately
     $this->buffered_id = NULL;
     echo preg_replace_callback($regex, array($this, 'placeBufferedCallback'), $contents);
 }
示例#2
0
 /**
  * Performs buffered replacements using a breadth-first technique
  * 
  * @return void
  */
 private function placeBuffered()
 {
     if (!$this->buffered_id) {
         return;
     }
     $contents = fBuffer::get();
     fBuffer::erase();
     // We are gonna use a regex replacement that is eval()'ed as PHP code
     $regex = '/%%fTemplating::' . $this->buffered_id . '::(.*?)::(.*?)%%/e';
     $replacement = 'fBuffer::startCapture() . $this->placeElement("$1", "$2") . fBuffer::stopCapture()';
     // Remove the buffered id, thus making any nested place() calls be executed immediately
     $this->buffered_id = NULL;
     echo preg_replace($regex, $replacement, $contents);
 }
 public function testEraseDuringCapture()
 {
     $this->setExpectedException('fProgrammerException');
     fBuffer::start();
     $this->started_buffer = TRUE;
     fBuffer::startCapture();
     $this->started_capture = TRUE;
     fBuffer::erase();
 }