Example #1
0
/**
 * Stop and exit limonade application
 *
 * @access private
 * @param boolean exit or not
 * @return void
 */
function stop_and_exit($exit = true)
{
    call_if_exists('before_exit');
    $flash_sweep = true;
    $headers = headers_list();
    foreach ($headers as $header) {
        // If a Content-Type header exists, flash_sweep only if is text/html
        // Else if there's no Content-Type header, flash_sweep by default
        if (stripos($header, 'Content-Type:') === 0) {
            $flash_sweep = stripos($header, 'Content-Type: text/html') === 0;
            break;
        }
    }
    if ($flash_sweep) {
        flash_sweep();
    }
    if (defined('SID')) {
        session_write_close();
    }
    if (request_is_head()) {
        ob_end_clean();
    }
    if ($exit) {
        exit;
    }
}
Example #2
0
function stop_may_exit($exit = true)
{
    //call_if_exists('before_exit', $exit);
    //$headers = headers_list();
    if (request_is_head()) {
        ob_end_clean();
    }
    //if(defined('SID')) session_write_close();
    if ($exit) {
        exit;
    }
}