Horde::contentSent PHP Method

contentSent() public static method

Has any content been sent to the browser?
public static contentSent ( ) : boolean
return boolean True if content has been sent.
    public static function contentSent()
    {
        return self::$_bufferLevel && self::$_contentSent || !self::$_bufferLevel && (ob_get_length() || headers_sent());
    }

Usage Example

Example #1
0
 /**
  * Add inline javascript to the output buffer.
  *
  * @param mixed $script    The script text to add (can be stored in an
  *                         array).
  * @param boolean $onload  Load the script after the page (DOM) has
  *                         loaded?
  * @param boolean $top     Add script to top of stack?
  */
 public function addInlineScript($script, $onload = false, $top = false)
 {
     $script = is_array($script) ? implode(';', array_map('trim', $script)) : trim($script);
     if (!strlen($script)) {
         return;
     }
     $onload = intval($onload);
     $script = rtrim($script, ';') . ';';
     if ($top && isset($this->inlineScript[$onload])) {
         array_unshift($this->inlineScript[$onload], $script);
     } else {
         $this->inlineScript[$onload][] = $script;
     }
     // If headers have already been sent, we need to output a
     // <script> tag directly.
     if (!$this->deferScripts && Horde::contentSent()) {
         $this->outputInlineScript();
     }
 }
All Usage Examples Of Horde::contentSent