Skip to content

Instantly share code, notes, and snippets.

@dragoonis
Created June 11, 2011 19:35
Show Gist options
  • Save dragoonis/1020871 to your computer and use it in GitHub Desktop.
Save dragoonis/1020871 to your computer and use it in GitHub Desktop.
<?php
$modules = isset($_GET['mod']) ? explode(',', str_replace('../', '', $_GET['mod'])) : array();
$js = '';
foreach($modules as $module) {
if(file_exists("{$module}.js")) {
$js .= "/* ---- {$module}.js ---- */ \n\n" . file_get_contents($module . '.js') . "\n\n";
}
}
if($js !== '') {
header('Content-type: text/javascript');
echo $js;
}
<?php
$modules = isset($_GET['mod']) ? explode(',', str_replace('../', '', $_GET['mod'])) : array();
$css = '';
foreach($modules as $module) {
if(file_exists("{$module}.css")) {
$css .= "/* ---- {$module}.css ---- */ \n\n" . file_get_contents($module . '.css') . "\n\n";
}
}
if($css !== '') {
header('Content-type: text/css');
echo $css;
}
@dragoonis
Copy link
Author

<script type="text/javascript" src="scripts/js.php?mod="></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment