예제 #1
0
파일: Output.php 프로젝트: jaubourg/tulip
function Tulip_Output_shutdown()
{
    // Report fatal errors
    $fatal_errors = array();
    preg_match_all('/fatal\\s+error.*?:(.*)/i', $tmp = ob_get_clean(), $fatal_errors);
    $fatal_errors = $fatal_errors[1];
    if (count($fatal_errors)) {
        $last = end(end(Tulip::modules())->units());
        foreach ($fatal_errors as &$fatal_error) {
            $last->add(false, preg_replace('/^\\s+|\\s+$|<.*?>/', "", $fatal_error), false);
        }
    }
    // Get the template
    $template = Tulip::config("TEMPLATE");
    if (substr($template, 0, 1) == "#") {
        $template = dirname(__FILE__) . DIRECTORY_SEPARATOR . "Output" . DIRECTORY_SEPARATOR . substr($template, 1) . ".php";
    }
    // If template does not exist, try to get it from path
    if (!file_exists($template)) {
        $file = false;
        $dirs = explode(PATH_SEPARATOR, Tulip::config("PATH"));
        foreach ($dirs as $dir) {
            if (file_exists($dir . DIRECTORY_SEPARATOR . $template)) {
                $file = $dir . DIRECTORY_SEPARATOR . $template;
                break;
            }
        }
        if (!$file) {
            echo "Tulip: couldn't find template file {$template}";
            exit;
        }
        $template = $file;
    }
    // Include the template and render
    require_once $template;
}
예제 #2
0
파일: html.php 프로젝트: jaubourg/tulip
echo Tulip::config("PASS") ? "pass" : "fail";
?>
"></h2>
	<h2 id="tulip-info">PHP Version <?php 
echo Tulip::config("PHP_VERSION");
?>
 - <?php 
echo Tulip::config("PHP_ENGINE");
?>
</h2>
	<ol id="tulip-tests">
<?php 
$pass = 0;
$fail = 0;
$id = 0;
$modules =& Tulip::modules();
foreach ($modules as &$module) {
    $units =& $module->units();
    foreach ($units as &$unit) {
        $id++;
        $pass += $unit->nbPass();
        $fail += $unit->nbFail();
        $name = htmlentities($module->name() . ": " . $unit->name(), ENT_QUOTES, "UTF-8");
        ?>
		<li class="<?php 
        echo $unit->pass() ? "pass" : "fail" . ($unit->wouldPass() ? " softFail" : "");
        ?>
">
			<strong>
				<span onclick="Tulip.toggle( 'tulip-<?php 
        echo $id;