Ejemplo n.º 1
0
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * The source code of this package is available online at 
 * <http://github.com/atelierspierrot/assets-library>.
 */
@ini_set('display_errors', 1);
@error_reporting(E_ALL ^ E_NOTICE);
require_once __DIR__ . '/../../assets-library.php';
javascript_header();
?>
// Utiliataire d'inclusion JS
function include(fileName)
{
    "use strict";
    document.write("<script type='text/javascript' src='/<?php 
echo _ASSETSLIB_JS_HTTP;
?>
"+fileName+"'><\/"+"script>" );
    if (typeof window._dbg === 'function') {
        _dbg("Inclusion of file ["+fileName+"]");
    }
}

// from http://javascript.about.com/library/bladdjs.htm
 /**
  * Build a preset requirements and include it
  *
  * @param string $type 'js' or 'css'
  * @param string $preset
  * @return void
  */
 function prepare_preset_include($type, $preset)
 {
     require_once __DIR__ . '/DependenciesManager.php';
     $presets = new DependenciesManager(_ASSETSLIB_MANIFEST);
     $deps = $presets->findDependencies($preset);
     if (!empty($deps) && isset($deps[$type])) {
         $str = '';
         foreach ($deps[$type] as $item) {
             $str .= library_include($item);
         }
         if (!empty($str)) {
             if ($type === 'css') {
                 css_header();
             } elseif ($type === 'js') {
                 javascript_header();
             }
             echo $str;
         }
     }
 }