diff --git a/class-RegisterJS.php b/class-RegisterJS.php index a6a2510..9cc0ace 100644 --- a/class-RegisterJS.php +++ b/class-RegisterJS.php @@ -1,239 +1,239 @@ . /** * Register and enqueue JS libraries */ class RegisterJS { /** * Default position */ public static $DEFAULT = 'header'; /** * Script names */ private $js = []; /** * Get the singleton instance * * @return self */ public static function instance() { static $me = false; if( !$me ) { $me = new self(); } return $me; } /** * Register a new script name * * This will not automatically enqueue it (normally). * * @param string $name Script name, like: "jquery" (or just true for whatever, to enqueue it) * @param mixed $url Script url, like "http://example.org/lib/jquery.js" * @param string $position header|footer * @param array $dependencies Dependent script names */ public function register( $uid, $url, $position = null, $dependencies = [] ) { // assume the default position if( !$position ) { $position = self::$DEFAULT; } // create the object $js = new JS( $uid, $url, $position, $dependencies ); // append $this->js[ $uid ] = $js; } /** * Register an inline script * * @param string $uid Script name, like: "jquery" * @param array $data Inline JavaScript content (without "; if( DEBUG ) { echo ""; } } } /** * Print the normal JS inclusion * * @param $glue string */ public function printNormal( $glue ) { if( $this->url ) { $url = $this->getURLCached(); echo "$glue"; if( DEBUG ) { echo ""; } } } }