public function loadScript($src, $defer = FALSE, $async = FALSE, $attribs=[]) {
		
		// force casting to array
		$attribs = (array)$attribs;
		
		// the script object
		$script = new \stdClass();
		
		$script->src = $src;
		
		if ($defer)	$script->defer = TRUE;
		if ($async) $script->async = TRUE;

		// list of valid type attributes
		$validTypes = ['text/javascript','text/ecmascript','application/javascript','application/ecmascript'];
		
		if (isset($attribs['type']) and in_array($attribs['type'], $validTypes)) {
			$script->type = $attribs['type'];
		}

		if (isset($attribs['integrity']) and strlen(trim($attribs['integrity']))) {
			$script->integrity = $attribs['integrity'];
		}
		
		if (isset($attribs['crossorigin']) and strlen(trim($attribs['crossorigin']))) {
			$script->crossorigin = $attribs['crossorigin'];
		}
		
		if (isset($attribs['charset']) and strlen(trim($attribs['charset']))) {
			$script->charset = $attribs['charset'];
		}
		
		$this->scriptFiles[] = $script;
		
	}
public function loadScript($src, $defer = FALSE, $async = FALSE, $attribs=[]) {
		
		// force casting to array
		$attribs = (array)$attribs;
		
		// the script object
		$script = new \stdClass();
		
		$script->src = $src;
		
		if ($defer)	$script->defer = TRUE;
		if ($async) $script->async = TRUE;

		// list of valid type attributes
		$validTypes = ['text/javascript','text/ecmascript','application/javascript','application/ecmascript'];
		
		if (isset($attribs['type']) and in_array($attribs['type'], $validTypes)) {
			$script->type = $attribs['type'];
		}

		if (isset($attribs['integrity']) and strlen(trim($attribs['integrity']))) {
			$script->integrity = $attribs['integrity'];
		}
		
		if (isset($attribs['crossorigin']) and strlen(trim($attribs['crossorigin']))) {
			$script->crossorigin = $attribs['crossorigin'];
		}
		
		if (isset($attribs['charset']) and strlen(trim($attribs['charset']))) {
			$script->charset = $attribs['charset'];
		}
		
		$this->scriptFiles[] = $script;
		
	}
public function loadScript ( $ src , $ defer = FALSE , $ async = FALSE , $ attribs = [ ] ) { // force casting to array $ attribs = ( array ) $ attribs ; // the script object $ script = new \ stdClass ( ) ; $ script -> src = $ src ; if ( $ defer ) $ script -> defer = TRUE ; if ( $ async ) $ script -> async = TRUE ; // list of valid type attributes $ validTypes = [ 'text/javascript' , 'text/ecmascript' , 'application/javascript' , 'application/ecmascript' ] ; if ( isset ( $ attribs [ 'type' ] ) and in_array ( $ attribs [ 'type' ] , $ validTypes ) ) { $ script -> type = $ attribs [ 'type' ] ; } if ( isset ( $ attribs [ 'integrity' ] ) and strlen ( trim ( $ attribs [ 'integrity' ] ) ) ) { $ script -> integrity = $ attribs [ 'integrity' ] ; } if ( isset ( $ attribs [ 'crossorigin' ] ) and strlen ( trim ( $ attribs [ 'crossorigin' ] ) ) ) { $ script -> crossorigin = $ attribs [ 'crossorigin' ] ; } if ( isset ( $ attribs [ 'charset' ] ) and strlen ( trim ( $ attribs [ 'charset' ] ) ) ) { $ script -> charset = $ attribs [ 'charset' ] ; } $ this -> scriptFiles [ ] = $ script ; }
Set esternal script file load with optional attributes.

@param	string	Path to script, absolute or relative with no trailing slash.
@param	bool	Defer attribute (default FALSE).
@param	bool	Async attribute (default FALSE).
@param	array	Optional attribute list (type, integrity, crossorigin, charset).
Set esternal script file load with optional attributes .