} if (self::$recursive) { foreach (self::find_contents($dir . DIRECTORY_SEPARATOR . $value) as $value) { self::$files[] = $result[] = $value; } } } // Return required for recursive search return $result; } } // ############################################################################# // Set application type header('Content-type: application/javascript'); // Set variables $str_output = ""; $dirs = array('app'); $file_ext = array("js", "JS", "Js", "jS"); // Scan for JS files in add directory $files = scanDir::scan($dirs, $file_ext, true); $files = array_unique($files); #print_r($files); foreach ($files as $file) { $str_output .= file_get_contents($file); } // Remove single line comments #$str_output = preg_replace('#//.*#', '', $str_output); // Remove line breaks and indents #$str_output = preg_replace('#\n|\n\r|\r|\t#', '', $str_output); // Send fake js echo $str_output;
$gdbo->sql = "\nSELECT\na.id_sys_module,\na.sys_module,\nb.id_sys_module_sub,\nb.sys_module_sub,\nb.sys_module_sub_href,\nUNHEX(b.sys_module_sub_icon) as sys_module_sub_icon\nFROM _sys_module a\nJOIN _sys_module_sub b ON a.id_sys_module=b.id_sys_module\nWHERE b.sys_module_sub_enabled=1 " . $moduleFilter . "\nORDER BY a.sys_module_order asc,b.sys_module_sub_order"; $gdbo->getRec(); $aModules = $gdbo->dbData; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>BIFROST SOFTWARE LLC</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta http-equiv="Cache control" content="no-cache"/> <meta name="COPYRIGHT" content="© 2014 Bifrost Softrware LLC"> <?php $dirs = array($path . '_lib/jquery', $path . '_lib/js/', $path . '_thirdparty/miniupload/assets/js', $path . '_thirdparty/amcharts'); $file_ext = array("css", "js"); $files = scanDir::scan($dirs, $file_ext); $linkedFiles = ""; foreach ($files as $fso) { $fso = str_replace($serverrootpath, "", $fso); $ext = trim(end(explode(".", $fso))); switch ($ext) { case "js": $linkedFiles .= '<script type="text/javascript" src="' . $fso . '"></script>'; break; case "css": $linkedFiles .= '<link type="text/css" rel="stylesheet" href="' . $fso . '"/>'; break; default: break; } }
} // This is how we scan directories private static function find_contents($dir) { $result = array(); $root = scandir($dir); foreach ($root as $value) { if ($value === '.' || $value === '..') { continue; } if (is_file($dir . DIRECTORY_SEPARATOR . $value)) { if (!self::$ext_filter || in_array(strtolower(pathinfo($dir . DIRECTORY_SEPARATOR . $value, PATHINFO_EXTENSION)), self::$ext_filter)) { self::$files[] = $result[] = $dir . DIRECTORY_SEPARATOR . $value; } continue; } if (self::$recursive) { foreach (self::find_contents($dir . DIRECTORY_SEPARATOR . $value) as $value) { self::$files[] = $result[] = $value; } } } // Return required for recursive search return $result; } } $files = scanDir::scan("files"); //echo var_dump($files); foreach ($files as $value) { echo "{$value},"; }