Permalink
Browse files

Added script registration.

Added script registration. Register scripts using
register_script(script_full_path).
registered scripts are assumed local.
print_scripts() prints the script tags that are registered.

Todo: combine register/print_scripts/print_stylesheets
  • Loading branch information...
antijingoist committed Apr 25, 2016
1 parent d8af681 commit 9eae2c874d5764bb49288c7a66b08bc2ba5ca8df
Showing with 23 additions and 0 deletions.
  1. +23 −0 system/engine.php
@@ -12,6 +12,7 @@
$enabled_plugins = array();
$enabled_stylesheets = array();
$enabled_scripts = array();
$current_page = _INPUT('p', 'index');
$registered_pages = array('Home' => sculpt_page_url('index'));
$registered_processors = array('system' => '');
@@ -157,6 +158,15 @@ function register_stylesheet($stylesheet_full_path) {
return true;
}
function register_script($script_full_path) {
global $enabled_scripts;
$enabled_scripts[] = $script_full_path;
return true;
}
function print_stylesheets() {
global $enabled_stylesheets;
@@ -170,6 +180,19 @@ function print_stylesheets() {
echo $stylesheet_data;
}
function print_scripts() {
global $enabled_scripts;
$script_data = "";
foreach($enabled_scripts as $script) {
if (file_exists($script)) {
$script_data .= '<script src="' . $script . '"></script>';
}
}
echo $script_data;
}
function sculpt_parse_markdown_file($md_file, $no_title = false) {
global $fastCache;
global $cache_time;

0 comments on commit 9eae2c8

Please sign in to comment.