| 1: | <?php |
| 2: | |
| 3: | define('JS_LIBS', [ |
| 4: | 'bootstrap' => 'vendor/twbs/bootstrap/dist/js/bootstrap.bundle.min.js', |
| 5: | 'cash' => 'third_party/cash.min.js', |
| 6: | 'resumable' => 'third_party/resumable.min.js', |
| 7: | 'ays-beforeunload-shim' => 'third_party/ays-beforeunload-shim.js', |
| 8: | 'jquery-are-you-sure' => 'third_party/jquery.are-you-sure.js', |
| 9: | 'sortable' => 'third_party/sortable.min.js', |
| 10: | 'kindeditor' => 'third_party/kindeditor/kindeditor-all-min.js', |
| 11: | 'nprogress' => 'third_party/nprogress.js', |
| 12: | ]); |
| 13: | |
| 14: | function get_js_libs($exclude_deps = []) { |
| 15: | $js_lib = ''; |
| 16: | |
| 17: | foreach (JS_LIBS as $dep) { |
| 18: | if (!in_array($dep, $exclude_deps)) { |
| 19: | $js_lib .= '<script type="text/javascript" src="'.WEB_ROOT.$dep.'"></script>'; |
| 20: | } |
| 21: | } |
| 22: | return $js_lib; |
| 23: | } |
| 24: | |
| 25: | function get_js_libs_content($exclude_deps = []) { |
| 26: | $js_lib = ''; |
| 27: | |
| 28: | foreach (JS_LIBS as $key => $dep) { |
| 29: | if (!in_array($key, $exclude_deps)) { |
| 30: | $js_lib .= file_get_contents(APP_PATH.$dep); |
| 31: | } |
| 32: | } |
| 33: | return $js_lib; |
| 34: | } |
| 35: | |