Ejemplo n.º 1
0
<?php

include_once "build.php";
$depender = new Depender();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>Depender - A MooTools Dependency Builder</title>
		<link rel="stylesheet" href="../styles/reset.css" type="text/css" media="screen" title="no title" charset="utf-8">
		<link rel="stylesheet" href="../styles/depender.css" type="text/css" media="screen" title="no title" charset="utf-8">
		<script src="build.php?requireLibs=mootools-core&require=Fx.Reveal,URI,Element.Position,String.QueryString"></script>
		<script src="interface.js" type="text/javascript" charset="utf-8"></script>
		<script src="zeroclipboard/ZeroClipboard.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
<h1>MooTools Library Builder
	<a class="button" id="help_link">Help</a>
</h1>

<form action="build.php" method="GET">
<div class="includes">
	<dl class="sources">
	<?php 
foreach ($depender->getLibraries() as $source => $data) {
    ?>
		<dt class="sourceHeader">
			<div class="select">
				<span class="button sourceAll">include entire library
					<input type="checkbox" value="<?php 
Ejemplo n.º 2
0
<?php

include_once 'depender.php';
if (!file_exists('cache')) {
    mkdir('cache');
}
$depender = new Depender();
if ($depender->getVar('require') || $depender->getVar('requireLibs') || $depender->getVar('client')) {
    $depender->build();
} else {
    if ($depender->getVar('reset')) {
        $depender->deleteCache('flat');
    }
}
Ejemplo n.º 3
0
 private function getFlatData()
 {
     if (isset(self::$flat)) {
         return self::$flat;
     }
     $config = $this->getConfig();
     $flat = array();
     $all = array();
     $cacheId = 'flat';
     $cached = $this->getCache($cacheId);
     if ($cached && isset($config['php: cache scripts.json']) && $config['php: cache scripts.json']) {
         self::$flat = $cached;
         return $cached;
     }
     foreach ($config['libs'] as $libraryName => $library) {
         $scripts = $this->getScriptsFromLibraryName($libraryName);
         if (!is_array($scripts)) {
             die($libraryName . ' scripts.json file did not parse correctly. (Located at ' . realpath($this->addRoot($library['scripts']) . '/' . self::ScriptsFilename) . ')');
         }
         foreach ($scripts as $categoryName => $categotyScripts) {
             foreach ($categotyScripts as $scriptName => $script) {
                 $script['library'] = $libraryName;
                 $script['category'] = $categoryName;
                 $script['name'] = $scriptName;
                 $script['path'] = $this->addRoot($library['scripts']) . '/' . $script['category'] . '/' . $script['name'] . '.js';
                 $all[$scriptName] = $script;
             }
         }
     }
     $this->setCache($cacheId, $all);
     self::$flat = $all;
     return $all;
 }
Ejemplo n.º 4
0
        foreach ($exclude as $script) {
            $excludes[] = $script;
        }
        $excludes = array_unique($excludes);
        //No duplicate
        $includes = array_diff($includes, $excludes);
        $config = $this->getConfig();
        $out = join($config['copyright'], PHP_EOL) . PHP_EOL . PHP_EOL;
        $out .= '//Contents: ' . join($includes, ', ') . PHP_EOL . PHP_EOL;
        $out .= '//This lib: ' . $this->getPageUrl() . PHP_EOL . PHP_EOL;
        if ($_SERVER['HTTP_IF_MODIFIED_SINCE']) {
            $browserCache = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
            if ($browserCache >= $this->getLastModifiedDate($includes)) {
                header('HTTP/1.1 304 Not Modified');
                exit;
            }
        }
        header('Last-modified: ' . date('r', $this->getLastModifiedDate($includes)));
        foreach ($includes as $include) {
            $out .= $this->getScriptFile($include, $this->getVar('compression'));
        }
        print $out;
    }
}
if (!file_exists('cache')) {
    mkdir('cache');
}
$depender = new Depender();
if ($depender->getVar('require') || $depender->getVar('requireLibs')) {
    $depender->build();
}