public static function loadScript($name, $path = null, $returnContents = true)
    {
        //  Already read, return script
        if (null !== ($script = array_get(static::$libraries, $name))) {
            return $returnContents ? file_get_contents($script) : $script;
        }

        $script = ltrim($script, ' /');

        //  Spin through paths and look for the script
        foreach (static::$libraryPaths as $libPath) {
            $check = $libPath . '/' . $script;

            if (is_file($check) && is_readable($check)) {
                array_set(static::$libraries, $name, $check);

                return $returnContents ? file_get_contents($check) : $check;
            }
        }

        if ($path) {
            if (is_file($path) && is_readable($path)) {
                array_set(static::$libraries, $name, $path);

                return $returnContents ? file_get_contents($path) : $path;
            }
        }

        return false;
    }
public static function loadScript($name, $path = null, $returnContents = true)
    {
        //  Already read, return script
        if (null !== ($script = array_get(static::$libraries, $name))) {
            return $returnContents ? file_get_contents($script) : $script;
        }

        $script = ltrim($script, ' /');

        //  Spin through paths and look for the script
        foreach (static::$libraryPaths as $libPath) {
            $check = $libPath . '/' . $script;

            if (is_file($check) && is_readable($check)) {
                array_set(static::$libraries, $name, $check);

                return $returnContents ? file_get_contents($check) : $check;
            }
        }

        if ($path) {
            if (is_file($path) && is_readable($path)) {
                array_set(static::$libraries, $name, $path);

                return $returnContents ? file_get_contents($path) : $path;
            }
        }

        return false;
    }
public static function loadScript ( $ name , $ path = null , $ returnContents = true ) { //  Already read, return script if ( null !== ( $ script = array_get ( static :: $ libraries , $ name ) ) ) { return $ returnContents ? file_get_contents ( $ script ) : $ script ; } $ script = ltrim ( $ script , ' /' ) ; //  Spin through paths and look for the script foreach ( static :: $ libraryPaths as $ libPath ) { $ check = $ libPath . '/' . $ script ; if ( is_file ( $ check ) && is_readable ( $ check ) ) { array_set ( static :: $ libraries , $ name , $ check ) ; return $ returnContents ? file_get_contents ( $ check ) : $ check ; } } if ( $ path ) { if ( is_file ( $ path ) && is_readable ( $ path ) ) { array_set ( static :: $ libraries , $ name , $ path ) ; return $ returnContents ? file_get_contents ( $ path ) : $ path ; } } return false ; }
Look through the known paths for a particular script. Returns full path to script file.

@param string $name           The name/id of the script
@param string $path           The name of the script
@param bool   $returnContents If true, the contents of the file, if found, are returned. Otherwise, the only the
path is returned

@return string
Look through the known paths for a particular script . Returns full path to script file .