Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
5d5af1ac09 | |
|
f5874a9db4 |
20
jsm.inc.php
20
jsm.inc.php
|
@ -31,12 +31,12 @@ class JSM
|
||||||
$this->args_parser = new JSM_ArgsParser();
|
$this->args_parser = new JSM_ArgsParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRootFile()
|
function getRootFile() : string
|
||||||
{
|
{
|
||||||
return $this->file;
|
return $this->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getModule($file)
|
static function getModule($file) : JSM_Module
|
||||||
{
|
{
|
||||||
if(isset(self::$modules[$file]))
|
if(isset(self::$modules[$file]))
|
||||||
return self::$modules[$file];
|
return self::$modules[$file];
|
||||||
|
@ -523,7 +523,12 @@ class JSM
|
||||||
|
|
||||||
private function _extractScriptDefs(string $file, string $txt) : string
|
private function _extractScriptDefs(string $file, string $txt) : string
|
||||||
{
|
{
|
||||||
if(strpos($txt, 'def') === false)
|
$strpos = strpos($txt, 'def');
|
||||||
|
if($strpos === false)
|
||||||
|
return $txt;
|
||||||
|
|
||||||
|
//let's extra check if newline symbols preceed 'def'
|
||||||
|
if($strpos > 0 && !($txt[$strpos-1] === "\n" || $txt[$strpos-1] === "\r"))
|
||||||
return $txt;
|
return $txt;
|
||||||
|
|
||||||
//NOTE: make it more robust
|
//NOTE: make it more robust
|
||||||
|
@ -678,22 +683,23 @@ class JSM
|
||||||
|
|
||||||
class JSM_Module
|
class JSM_Module
|
||||||
{
|
{
|
||||||
var $file = '';
|
var string $file = '';
|
||||||
var $defs = array();
|
var $defs = array();
|
||||||
|
//NOTE: all includes (even those included from other modules)
|
||||||
var $includes = array();
|
var $includes = array();
|
||||||
var $node = null;
|
var $node = null;
|
||||||
|
|
||||||
function __construct($file)
|
function __construct(string $file)
|
||||||
{
|
{
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIncludes()
|
function getIncludes() : array
|
||||||
{
|
{
|
||||||
return $this->includes;
|
return $this->includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFile()
|
function getFile() : string
|
||||||
{
|
{
|
||||||
return $this->file;
|
return $this->file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue