/** * This filter is run as the last thing before the output buffer is sent to the browser. * It inserts the string registered with Head::add() does some output compression if possible. * @param string $buffer * @param integer $mode OB mode * @return string */ function outputBufferFilter($buffer, $mode) { //FIXME: Uncomment? //$buffer = trim($buffer); /** * Mail replace */ $buffer = SafeEmails::replace($buffer); $headadd = Head::finalize(); if (is_array($headadd)) { $buffer = preg_replace('#</head>#i', $headadd[0] . "\r\n</head>", $buffer, 1); $buffer = preg_replace('#</body>#i', $headadd[1] . "\r\n</body>", $buffer, 1); } return $buffer; }