@@ -11,6 +11,10 @@ |
||
11 | 11 | function arrayHtmlParser($_array) { |
12 | 12 | return travelStringArray($_array,"htmlParser"); |
13 | 13 | } |
14 | + |
|
15 | + /** |
|
16 | + * @param string $_function |
|
17 | + */ |
|
14 | 18 | function travelStringArray ( $_array, $_function ) { |
15 | 19 | if (is_array($_array)) { |
16 | 20 | foreach ($_array as $k => $v) { |
@@ -1,51 +1,51 @@ |
||
1 | 1 | <?php |
2 | 2 | function utf8ize($_array) { |
3 | - return travelStringArray($_array,"utf8_encode"); |
|
3 | + return travelStringArray($_array,"utf8_encode"); |
|
4 | 4 | } |
5 | 5 | function unutf8ize($_array) { |
6 | - return travelStringArray($_array,"utf8_decode"); |
|
6 | + return travelStringArray($_array,"utf8_decode"); |
|
7 | 7 | } |
8 | 8 | function arraySlash($_array) { |
9 | - return travelStringArray($_array,"addslashes"); |
|
9 | + return travelStringArray($_array,"addslashes"); |
|
10 | 10 | } |
11 | 11 | function arrayHtmlParser($_array) { |
12 | - return travelStringArray($_array,"htmlParser"); |
|
12 | + return travelStringArray($_array,"htmlParser"); |
|
13 | 13 | } |
14 | 14 | function travelStringArray ( $_array, $_function ) { |
15 | - if (is_array($_array)) { |
|
16 | - foreach ($_array as $k => $v) { |
|
17 | - $_array[$k] = travelStringArray($v, $_function); |
|
18 | - } |
|
19 | - } else if (is_string ($_array)) { |
|
20 | - return call_user_func($_function,$_array); |
|
21 | - } |
|
22 | - return $_array; |
|
15 | + if (is_array($_array)) { |
|
16 | + foreach ($_array as $k => $v) { |
|
17 | + $_array[$k] = travelStringArray($v, $_function); |
|
18 | + } |
|
19 | + } else if (is_string ($_array)) { |
|
20 | + return call_user_func($_function,$_array); |
|
21 | + } |
|
22 | + return $_array; |
|
23 | 23 | } |
24 | 24 | function arrayDepth( $_array ) { |
25 | - $maxDepth = 1; |
|
26 | - foreach ($_array as $value) { |
|
27 | - if (is_array($value)) { |
|
28 | - $depth = arrayDepth($value) + 1; |
|
29 | - if ($depth > $maxDepth) { |
|
30 | - $maxDepth = $depth; |
|
31 | - } |
|
32 | - } |
|
33 | - } |
|
34 | - return $maxDepth; |
|
25 | + $maxDepth = 1; |
|
26 | + foreach ($_array as $value) { |
|
27 | + if (is_array($value)) { |
|
28 | + $depth = arrayDepth($value) + 1; |
|
29 | + if ($depth > $maxDepth) { |
|
30 | + $maxDepth = $depth; |
|
31 | + } |
|
32 | + } |
|
33 | + } |
|
34 | + return $maxDepth; |
|
35 | 35 | } |
36 | 36 | function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
37 | - $position = preg_replace('/ /', '', $_tab, 1); |
|
38 | - echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
|
39 | - foreach ($_array as $k => $i) |
|
40 | - if(is_array($i)) |
|
41 | - arrayDump( $i, $k, " $_tab" ); |
|
42 | - else if(is_object($i)) |
|
43 | - echo "$_tab<b>object:</b> [Object]<br>"; |
|
44 | - else |
|
45 | - echo "$_tab<b>$k:</b> $i<br>"; |
|
37 | + $position = preg_replace('/ /', '', $_tab, 1); |
|
38 | + echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
|
39 | + foreach ($_array as $k => $i) |
|
40 | + if(is_array($i)) |
|
41 | + arrayDump( $i, $k, " $_tab" ); |
|
42 | + else if(is_object($i)) |
|
43 | + echo "$_tab<b>object:</b> [Object]<br>"; |
|
44 | + else |
|
45 | + echo "$_tab<b>$k:</b> $i<br>"; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | function htmlParser( $_str) { |
49 | - return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
|
49 | + return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
|
50 | 50 | } |
51 | 51 | ?> |
@@ -1,27 +1,27 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | function utf8ize($_array) { |
3 | - return travelStringArray($_array,"utf8_encode"); |
|
3 | + return travelStringArray($_array, "utf8_encode"); |
|
4 | 4 | } |
5 | 5 | function unutf8ize($_array) { |
6 | - return travelStringArray($_array,"utf8_decode"); |
|
6 | + return travelStringArray($_array, "utf8_decode"); |
|
7 | 7 | } |
8 | 8 | function arraySlash($_array) { |
9 | - return travelStringArray($_array,"addslashes"); |
|
9 | + return travelStringArray($_array, "addslashes"); |
|
10 | 10 | } |
11 | 11 | function arrayHtmlParser($_array) { |
12 | - return travelStringArray($_array,"htmlParser"); |
|
12 | + return travelStringArray($_array, "htmlParser"); |
|
13 | 13 | } |
14 | - function travelStringArray ( $_array, $_function ) { |
|
14 | + function travelStringArray($_array, $_function) { |
|
15 | 15 | if (is_array($_array)) { |
16 | 16 | foreach ($_array as $k => $v) { |
17 | 17 | $_array[$k] = travelStringArray($v, $_function); |
18 | 18 | } |
19 | - } else if (is_string ($_array)) { |
|
20 | - return call_user_func($_function,$_array); |
|
19 | + } else if (is_string($_array)) { |
|
20 | + return call_user_func($_function, $_array); |
|
21 | 21 | } |
22 | 22 | return $_array; |
23 | 23 | } |
24 | - function arrayDepth( $_array ) { |
|
24 | + function arrayDepth($_array) { |
|
25 | 25 | $maxDepth = 1; |
26 | 26 | foreach ($_array as $value) { |
27 | 27 | if (is_array($value)) { |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | } |
34 | 34 | return $maxDepth; |
35 | 35 | } |
36 | - function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
|
36 | + function arrayDump($_array, $_name = "Array", $_tab = " ") { |
|
37 | 37 | $position = preg_replace('/ /', '', $_tab, 1); |
38 | 38 | echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
39 | 39 | foreach ($_array as $k => $i) |
40 | - if(is_array($i)) |
|
41 | - arrayDump( $i, $k, " $_tab" ); |
|
42 | - else if(is_object($i)) |
|
40 | + if (is_array($i)) |
|
41 | + arrayDump($i, $k, " $_tab"); |
|
42 | + else if (is_object($i)) |
|
43 | 43 | echo "$_tab<b>object:</b> [Object]<br>"; |
44 | 44 | else |
45 | 45 | echo "$_tab<b>$k:</b> $i<br>"; |
46 | 46 | } |
47 | 47 | |
48 | - function htmlParser( $_str) { |
|
48 | + function htmlParser($_str) { |
|
49 | 49 | return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
50 | 50 | } |
51 | 51 | ?> |
@@ -36,13 +36,15 @@ |
||
36 | 36 | function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
37 | 37 | $position = preg_replace('/ /', '', $_tab, 1); |
38 | 38 | echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
39 | - foreach ($_array as $k => $i) |
|
40 | - if(is_array($i)) |
|
39 | + foreach ($_array as $k => $i) { |
|
40 | + if(is_array($i)) |
|
41 | 41 | arrayDump( $i, $k, " $_tab" ); |
42 | - else if(is_object($i)) |
|
43 | - echo "$_tab<b>object:</b> [Object]<br>"; |
|
44 | - else |
|
45 | - echo "$_tab<b>$k:</b> $i<br>"; |
|
42 | + } |
|
43 | + else if(is_object($i)) { |
|
44 | + echo "$_tab<b>object:</b> [Object]<br>"; |
|
45 | + } else { |
|
46 | + echo "$_tab<b>$k:</b> $i<br>"; |
|
47 | + } |
|
46 | 48 | } |
47 | 49 | |
48 | 50 | function htmlParser( $_str) { |
@@ -17,6 +17,10 @@ |
||
17 | 17 | }); |
18 | 18 | return $temp; |
19 | 19 | } |
20 | + |
|
21 | + /** |
|
22 | + * @param Closure $_function |
|
23 | + */ |
|
20 | 24 | function fetchInSubFolder( $_dir = "./", $_function) { |
21 | 25 | $temp = []; |
22 | 26 | if (is_dir($_dir)) { |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | 2 | function subFolder( $_dir = "./" ) { |
3 | - $temp = fetchInSubFolder($_dir, function() { |
|
4 | - return true; |
|
5 | - }); |
|
6 | - return $temp; |
|
3 | + $temp = fetchInSubFolder($_dir, function() { |
|
4 | + return true; |
|
5 | + }); |
|
6 | + return $temp; |
|
7 | 7 | } |
8 | 8 | function subFolderFile( $_dir = "./" ) { |
9 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
10 | - return !is_dir($_file); |
|
11 | - }); |
|
12 | - return $temp; |
|
9 | + $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
10 | + return !is_dir($_file); |
|
11 | + }); |
|
12 | + return $temp; |
|
13 | 13 | } |
14 | 14 | function subFolderDir( $_dir = "./" ) { |
15 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
16 | - return !is_file($_file); |
|
17 | - }); |
|
18 | - return $temp; |
|
15 | + $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
16 | + return !is_file($_file); |
|
17 | + }); |
|
18 | + return $temp; |
|
19 | 19 | } |
20 | 20 | function fetchInSubFolder( $_dir = "./", $_function) { |
21 | - $temp = []; |
|
22 | - if (is_dir($_dir)) { |
|
23 | - if ($dirOpened = opendir($_dir)) { |
|
24 | - while (($file = readdir($dirOpened)) !== false) |
|
25 | - if( ($file !='.')&&($file !='..') ) |
|
26 | - if($_function($file)) |
|
27 | - array_push($temp,$file); |
|
28 | - closedir($dirOpened); |
|
29 | - } |
|
30 | - } |
|
31 | - return $temp; |
|
21 | + $temp = []; |
|
22 | + if (is_dir($_dir)) { |
|
23 | + if ($dirOpened = opendir($_dir)) { |
|
24 | + while (($file = readdir($dirOpened)) !== false) |
|
25 | + if( ($file !='.')&&($file !='..') ) |
|
26 | + if($_function($file)) |
|
27 | + array_push($temp,$file); |
|
28 | + closedir($dirOpened); |
|
29 | + } |
|
30 | + } |
|
31 | + return $temp; |
|
32 | 32 | } |
33 | 33 | function requireSubfolder( $_dir = "./" ) { |
34 | - $temp = subFolderFile($_dir); |
|
35 | - foreach ($temp as $i) |
|
36 | - jRequire($_dir."/".$i); |
|
34 | + $temp = subFolderFile($_dir); |
|
35 | + foreach ($temp as $i) |
|
36 | + jRequire($_dir."/".$i); |
|
37 | 37 | } |
38 | 38 | function require_js( $_dir = "./" ) { |
39 | - $tempArray = []; |
|
40 | - $temp = subFolderFile($_dir); |
|
41 | - foreach ($temp as $i) |
|
42 | - array_push($tempArray, $_dir."/".$i); |
|
43 | - return $tempArray; |
|
39 | + $tempArray = []; |
|
40 | + $temp = subFolderFile($_dir); |
|
41 | + foreach ($temp as $i) |
|
42 | + array_push($tempArray, $_dir."/".$i); |
|
43 | + return $tempArray; |
|
44 | 44 | } |
45 | 45 | ?> |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php |
2 | - function subFolder( $_dir = "./" ) { |
|
2 | + function subFolder($_dir = "./") { |
|
3 | 3 | $temp = fetchInSubFolder($_dir, function() { |
4 | 4 | return true; |
5 | 5 | }); |
6 | 6 | return $temp; |
7 | 7 | } |
8 | - function subFolderFile( $_dir = "./" ) { |
|
9 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
8 | + function subFolderFile($_dir = "./") { |
|
9 | + $temp = fetchInSubFolder($_dir, function($_file) { |
|
10 | 10 | return !is_dir($_file); |
11 | 11 | }); |
12 | 12 | return $temp; |
13 | 13 | } |
14 | - function subFolderDir( $_dir = "./" ) { |
|
15 | - $temp = fetchInSubFolder($_dir, function( $_file ) { |
|
14 | + function subFolderDir($_dir = "./") { |
|
15 | + $temp = fetchInSubFolder($_dir, function($_file) { |
|
16 | 16 | return !is_file($_file); |
17 | 17 | }); |
18 | 18 | return $temp; |
19 | 19 | } |
20 | - function fetchInSubFolder( $_dir = "./", $_function) { |
|
20 | + function fetchInSubFolder($_dir = "./", $_function) { |
|
21 | 21 | $temp = []; |
22 | 22 | if (is_dir($_dir)) { |
23 | 23 | if ($dirOpened = opendir($_dir)) { |
24 | 24 | while (($file = readdir($dirOpened)) !== false) |
25 | - if( ($file !='.')&&($file !='..') ) |
|
26 | - if($_function($file)) |
|
27 | - array_push($temp,$file); |
|
25 | + if (($file != '.') && ($file != '..')) |
|
26 | + if ($_function($file)) |
|
27 | + array_push($temp, $file); |
|
28 | 28 | closedir($dirOpened); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | return $temp; |
32 | 32 | } |
33 | - function requireSubfolder( $_dir = "./" ) { |
|
33 | + function requireSubfolder($_dir = "./") { |
|
34 | 34 | $temp = subFolderFile($_dir); |
35 | 35 | foreach ($temp as $i) |
36 | 36 | jRequire($_dir."/".$i); |
37 | 37 | } |
38 | - function require_js( $_dir = "./" ) { |
|
38 | + function require_js($_dir = "./") { |
|
39 | 39 | $tempArray = []; |
40 | 40 | $temp = subFolderFile($_dir); |
41 | 41 | foreach ($temp as $i) |
@@ -21,10 +21,11 @@ discard block |
||
21 | 21 | $temp = []; |
22 | 22 | if (is_dir($_dir)) { |
23 | 23 | if ($dirOpened = opendir($_dir)) { |
24 | - while (($file = readdir($dirOpened)) !== false) |
|
25 | - if( ($file !='.')&&($file !='..') ) |
|
24 | + while (($file = readdir($dirOpened)) !== false) { |
|
25 | + if( ($file !='.')&&($file !='..') ) |
|
26 | 26 | if($_function($file)) |
27 | 27 | array_push($temp,$file); |
28 | + } |
|
28 | 29 | closedir($dirOpened); |
29 | 30 | } |
30 | 31 | } |
@@ -32,14 +33,16 @@ discard block |
||
32 | 33 | } |
33 | 34 | function requireSubfolder( $_dir = "./" ) { |
34 | 35 | $temp = subFolderFile($_dir); |
35 | - foreach ($temp as $i) |
|
36 | - jRequire($_dir."/".$i); |
|
36 | + foreach ($temp as $i) { |
|
37 | + jRequire($_dir."/".$i); |
|
38 | + } |
|
37 | 39 | } |
38 | 40 | function require_js( $_dir = "./" ) { |
39 | 41 | $tempArray = []; |
40 | 42 | $temp = subFolderFile($_dir); |
41 | - foreach ($temp as $i) |
|
42 | - array_push($tempArray, $_dir."/".$i); |
|
43 | + foreach ($temp as $i) { |
|
44 | + array_push($tempArray, $_dir."/".$i); |
|
45 | + } |
|
43 | 46 | return $tempArray; |
44 | 47 | } |
45 | 48 | ?> |
@@ -1,6 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | interface ConnectionAdapterInterface { |
3 | + |
|
4 | + /** |
|
5 | + * @return void |
|
6 | + */ |
|
3 | 7 | public function __construct( $_srv, $_db, $_usr, $_pass); |
8 | + |
|
9 | + /** |
|
10 | + * @return boolean |
|
11 | + */ |
|
4 | 12 | public function query( $_query ); |
5 | 13 | public function queryFetch( $_query ); |
6 | 14 | public function queryArray( $_query ); |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | interface ConnectionAdapterInterface { |
3 | - public function __construct( $_srv, $_db, $_usr, $_pass); |
|
4 | - public function query( $_query ); |
|
5 | - public function queryFetch( $_query ); |
|
6 | - public function queryArray( $_query ); |
|
7 | - public function queryInsert( $_query ); |
|
3 | + public function __construct( $_srv, $_db, $_usr, $_pass); |
|
4 | + public function query( $_query ); |
|
5 | + public function queryFetch( $_query ); |
|
6 | + public function queryArray( $_query ); |
|
7 | + public function queryInsert( $_query ); |
|
8 | 8 | } |
9 | 9 | ?> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | interface ConnectionAdapterInterface { |
3 | - public function __construct( $_srv, $_db, $_usr, $_pass); |
|
4 | - public function query( $_query ); |
|
5 | - public function queryFetch( $_query ); |
|
6 | - public function queryArray( $_query ); |
|
7 | - public function queryInsert( $_query ); |
|
3 | + public function __construct($_srv, $_db, $_usr, $_pass); |
|
4 | + public function query($_query); |
|
5 | + public function queryFetch($_query); |
|
6 | + public function queryArray($_query); |
|
7 | + public function queryInsert($_query); |
|
8 | 8 | } |
9 | 9 | ?> |
@@ -51,8 +51,9 @@ |
||
51 | 51 | function minifyOutput($_buffer) { |
52 | 52 | $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
53 | 53 | $replace = array ( '>', '<', '\\1' ); |
54 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
55 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
54 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) { |
|
55 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
56 | + } |
|
56 | 57 | return utf8_encode($_buffer); |
57 | 58 | } |
58 | 59 | ?> |
@@ -36,6 +36,9 @@ |
||
36 | 36 | return $temp; |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param string $_type |
|
41 | + */ |
|
39 | 42 | function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
40 | 43 | try { |
41 | 44 | $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
@@ -2,64 +2,64 @@ |
||
2 | 2 | jRequire("../modules/Parser/Parser.php"); |
3 | 3 | jRequire("../modules/JException/JException.php"); |
4 | 4 | function jBlock() { |
5 | - return ob_start(); |
|
5 | + return ob_start(); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | function jBlockClose( $_type = "html", $_parameters = [] ) { |
9 | - return jBlockEnd($_type, $_parameters); |
|
9 | + return jBlockEnd($_type, $_parameters); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function jBlockFile( $_path, $_parameters = [] ) { |
13 | - try { |
|
14 | - $temp = Parser::parseFile($_path, $_parameters); |
|
15 | - } catch (Exception $e) { |
|
16 | - throw new JException($e->getMessage(), 1); |
|
17 | - } |
|
18 | - return $temp; |
|
13 | + try { |
|
14 | + $temp = Parser::parseFile($_path, $_parameters); |
|
15 | + } catch (Exception $e) { |
|
16 | + throw new JException($e->getMessage(), 1); |
|
17 | + } |
|
18 | + return $temp; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | function view( $_path, $_parameters = [] ) { |
22 | - try { |
|
23 | - $temp = jBlockFile("bundles/views/$_path", $_parameters); |
|
24 | - } catch (Exception $e) { |
|
25 | - throw new JException($e->getMessage(), 1); |
|
26 | - } |
|
27 | - return $temp; |
|
22 | + try { |
|
23 | + $temp = jBlockFile("bundles/views/$_path", $_parameters); |
|
24 | + } catch (Exception $e) { |
|
25 | + throw new JException($e->getMessage(), 1); |
|
26 | + } |
|
27 | + return $temp; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | function sql( $_path, $_parameters = [] ) { |
31 | - try { |
|
32 | - $temp = jBlockFileMan("bundles/sql/$_path", "sql", $_parameters); |
|
33 | - } catch (Exception $e) { |
|
34 | - throw new JException($e->getMessage(), 1); |
|
35 | - } |
|
36 | - return $temp; |
|
31 | + try { |
|
32 | + $temp = jBlockFileMan("bundles/sql/$_path", "sql", $_parameters); |
|
33 | + } catch (Exception $e) { |
|
34 | + throw new JException($e->getMessage(), 1); |
|
35 | + } |
|
36 | + return $temp; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
40 | - try { |
|
41 | - $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
|
42 | - } catch (Exception $e) { |
|
43 | - throw new JException($e->getMessage(), 1); |
|
44 | - } |
|
45 | - return $temp; |
|
40 | + try { |
|
41 | + $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
|
42 | + } catch (Exception $e) { |
|
43 | + throw new JException($e->getMessage(), 1); |
|
44 | + } |
|
45 | + return $temp; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | function jBlockEnd( $_type = "html", $_parameters = [] ) { |
49 | - $text = ob_get_clean(); |
|
50 | - try { |
|
51 | - $temp = Parser::parseText($text, $_parameters, $_type); |
|
52 | - } catch (Exception $e) { |
|
53 | - throw new JException($e->getMessage(), 1); |
|
54 | - } |
|
55 | - return $temp; |
|
49 | + $text = ob_get_clean(); |
|
50 | + try { |
|
51 | + $temp = Parser::parseText($text, $_parameters, $_type); |
|
52 | + } catch (Exception $e) { |
|
53 | + throw new JException($e->getMessage(), 1); |
|
54 | + } |
|
55 | + return $temp; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function minifyOutput($_buffer) { |
59 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
60 | - $replace = array ( '>', '<', '\\1' ); |
|
61 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
62 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
63 | - return utf8_encode($_buffer); |
|
59 | + $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
60 | + $replace = array ( '>', '<', '\\1' ); |
|
61 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
62 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
63 | + return utf8_encode($_buffer); |
|
64 | 64 | } |
65 | 65 | ?> |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | return ob_start(); |
6 | 6 | } |
7 | 7 | |
8 | - function jBlockClose( $_type = "html", $_parameters = [] ) { |
|
8 | + function jBlockClose($_type = "html", $_parameters = []) { |
|
9 | 9 | return jBlockEnd($_type, $_parameters); |
10 | 10 | } |
11 | 11 | |
12 | - function jBlockFile( $_path, $_parameters = [] ) { |
|
12 | + function jBlockFile($_path, $_parameters = []) { |
|
13 | 13 | try { |
14 | 14 | $temp = Parser::parseFile($_path, $_parameters); |
15 | 15 | } catch (Exception $e) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | return $temp; |
19 | 19 | } |
20 | 20 | |
21 | - function view( $_path, $_parameters = [] ) { |
|
21 | + function view($_path, $_parameters = []) { |
|
22 | 22 | try { |
23 | 23 | $temp = jBlockFile("bundles/views/$_path", $_parameters); |
24 | 24 | } catch (Exception $e) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $temp; |
28 | 28 | } |
29 | 29 | |
30 | - function sql( $_path, $_parameters = [] ) { |
|
30 | + function sql($_path, $_parameters = []) { |
|
31 | 31 | try { |
32 | 32 | $temp = jBlockFileMan("bundles/sql/$_path", "sql", $_parameters); |
33 | 33 | } catch (Exception $e) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | return $temp; |
37 | 37 | } |
38 | 38 | |
39 | - function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
|
39 | + function jBlockFileMan($_path, $_type, $_parameters = []) { |
|
40 | 40 | try { |
41 | 41 | $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
42 | 42 | } catch (Exception $e) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $temp; |
46 | 46 | } |
47 | 47 | |
48 | - function jBlockEnd( $_type = "html", $_parameters = [] ) { |
|
48 | + function jBlockEnd($_type = "html", $_parameters = []) { |
|
49 | 49 | $text = ob_get_clean(); |
50 | 50 | try { |
51 | 51 | $temp = Parser::parseText($text, $_parameters, $_type); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | function minifyOutput($_buffer) { |
59 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
60 | - $replace = array ( '>', '<', '\\1' ); |
|
61 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
59 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
60 | + $replace = array('>', '<', '\\1'); |
|
61 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
62 | 62 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
63 | 63 | return utf8_encode($_buffer); |
64 | 64 | } |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | if(!isset($GLOBALS["JATEPath"])) |
3 | - $GLOBALS["JATEPath"] = []; |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | 4 | $commonLocations = [ |
5 | - "bower_components/JATE/dist/" |
|
6 | - , "vendor/xaberr/jate/dist/" |
|
7 | - , "../../dist/" |
|
8 | - , "../dist/" |
|
9 | - , dirname(__FILE__)."/" |
|
5 | + "bower_components/JATE/dist/" |
|
6 | + , "vendor/xaberr/jate/dist/" |
|
7 | + , "../../dist/" |
|
8 | + , "../dist/" |
|
9 | + , dirname(__FILE__)."/" |
|
10 | 10 | ]; |
11 | 11 | $jSuccess = false; |
12 | 12 | foreach ($commonLocations as $path) |
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | - array_push($GLOBALS["JATEPath"], $path); |
|
15 | - require_once("${path}jate/coreEngine.php"); |
|
16 | - $jSuccess = true; |
|
17 | - break; |
|
18 | - } |
|
13 | + if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | + array_push($GLOBALS["JATEPath"], $path); |
|
15 | + require_once("${path}jate/coreEngine.php"); |
|
16 | + $jSuccess = true; |
|
17 | + break; |
|
18 | + } |
|
19 | 19 | if( !$jSuccess ) |
20 | - throw new Exception("JATE can't find coreEngine.php."); |
|
20 | + throw new Exception("JATE can't find coreEngine.php."); |
|
21 | 21 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
2 | + if (!isset($GLOBALS["JATEPath"])) |
|
3 | 3 | $GLOBALS["JATEPath"] = []; |
4 | 4 | $commonLocations = [ |
5 | 5 | "bower_components/JATE/dist/" |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | ]; |
11 | 11 | $jSuccess = false; |
12 | 12 | foreach ($commonLocations as $path) |
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
13 | + if (file_exists("${path}jate/coreEngine.php")) { |
|
14 | 14 | array_push($GLOBALS["JATEPath"], $path); |
15 | 15 | require_once("${path}jate/coreEngine.php"); |
16 | 16 | $jSuccess = true; |
17 | 17 | break; |
18 | 18 | } |
19 | - if( !$jSuccess ) |
|
19 | + if (!$jSuccess) |
|
20 | 20 | throw new Exception("JATE can't find coreEngine.php."); |
21 | 21 | ?> |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
3 | - $GLOBALS["JATEPath"] = []; |
|
2 | + if(!isset($GLOBALS["JATEPath"])) { |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | + } |
|
4 | 5 | $commonLocations = [ |
5 | 6 | "bower_components/JATE/dist/" |
6 | 7 | , "vendor/xaberr/jate/dist/" |
@@ -9,13 +10,15 @@ discard block |
||
9 | 10 | , dirname(__FILE__)."/" |
10 | 11 | ]; |
11 | 12 | $jSuccess = false; |
12 | - foreach ($commonLocations as $path) |
|
13 | - if(file_exists("${path}jate/coreEngine.php")) { |
|
13 | + foreach ($commonLocations as $path) { |
|
14 | + if(file_exists("${path}jate/coreEngine.php")) { |
|
14 | 15 | array_push($GLOBALS["JATEPath"], $path); |
16 | + } |
|
15 | 17 | require_once("${path}jate/coreEngine.php"); |
16 | 18 | $jSuccess = true; |
17 | 19 | break; |
18 | 20 | } |
19 | - if( !$jSuccess ) |
|
20 | - throw new Exception("JATE can't find coreEngine.php."); |
|
21 | -?> |
|
21 | + if( !$jSuccess ) { |
|
22 | + throw new Exception("JATE can't find coreEngine.php."); |
|
23 | + } |
|
24 | + ?> |
@@ -1,4 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | + /** |
|
3 | + * @param string $_path |
|
4 | + */ |
|
2 | 5 | function requireComponent( $_path, $_local = true ) { |
3 | 6 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | 7 | if(file_exists($path) && isPhp($path)) |
@@ -26,6 +29,10 @@ discard block |
||
26 | 29 | $info = pathinfo($_file); |
27 | 30 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
28 | 31 | } |
32 | + |
|
33 | + /** |
|
34 | + * @param string $_path |
|
35 | + */ |
|
29 | 36 | function requireModules( $_path, $_local = true ) { |
30 | 37 | $path = getJFolder($_path, $_local, debug_backtrace()); |
31 | 38 | $subFolders = subFolderDir($path); |
@@ -36,6 +43,10 @@ discard block |
||
36 | 43 | $path = getJFolder($_path, $_local, debug_backtrace()); |
37 | 44 | require_once( $path ); |
38 | 45 | } |
46 | + |
|
47 | + /** |
|
48 | + * @param boolean $_local |
|
49 | + */ |
|
39 | 50 | function getJFolder( $_path, $_local, $_stack ) { |
40 | 51 | if($_local) { |
41 | 52 | $stackInfo = $_stack; |
@@ -1,64 +1,64 @@ |
||
1 | 1 | <?php |
2 | 2 | function requireComponent( $_path, $_local = true ) { |
3 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
4 | - if(file_exists($path) && isPhp($path)) |
|
5 | - jRequire($path, false, 0); |
|
6 | - else |
|
7 | - requireError($_path); |
|
3 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
4 | + if(file_exists($path) && isPhp($path)) |
|
5 | + jRequire($path, false, 0); |
|
6 | + else |
|
7 | + requireError($_path); |
|
8 | 8 | } |
9 | 9 | function requireComponents( $_path, $_local = true ) { |
10 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
11 | - if(file_exists($path)) { |
|
12 | - $files = subFolderFile($path); |
|
13 | - foreach ($files as $i) |
|
14 | - if(isPhp("$path/$i")) |
|
15 | - requireComponent($path."/".$i, false); |
|
16 | - } else |
|
17 | - requireError($_path); |
|
10 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
11 | + if(file_exists($path)) { |
|
12 | + $files = subFolderFile($path); |
|
13 | + foreach ($files as $i) |
|
14 | + if(isPhp("$path/$i")) |
|
15 | + requireComponent($path."/".$i, false); |
|
16 | + } else |
|
17 | + requireError($_path); |
|
18 | 18 | } |
19 | 19 | function requireError( $_path ) { |
20 | - global $DEBUG; |
|
21 | - if( $DEBUG == 1 ) |
|
22 | - echo "Error load ($_path)<br>"; |
|
20 | + global $DEBUG; |
|
21 | + if( $DEBUG == 1 ) |
|
22 | + echo "Error load ($_path)<br>"; |
|
23 | 23 | } |
24 | 24 | function isPhp ( $_file ) { |
25 | - if(!is_file($_file)) return false; |
|
26 | - $info = pathinfo($_file); |
|
27 | - return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
|
25 | + if(!is_file($_file)) return false; |
|
26 | + $info = pathinfo($_file); |
|
27 | + return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
|
28 | 28 | } |
29 | 29 | function requireModules( $_path, $_local = true ) { |
30 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
31 | - $subFolders = subFolderDir($path); |
|
32 | - foreach ($subFolders as $i) |
|
33 | - requireComponents("$path/$i", false); |
|
30 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
31 | + $subFolders = subFolderDir($path); |
|
32 | + foreach ($subFolders as $i) |
|
33 | + requireComponents("$path/$i", false); |
|
34 | 34 | } |
35 | 35 | function jRequire( $_path, $_local = true ) { |
36 | - $path = getJFolder($_path, $_local, debug_backtrace()); |
|
37 | - require_once( $path ); |
|
36 | + $path = getJFolder($_path, $_local, debug_backtrace()); |
|
37 | + require_once( $path ); |
|
38 | 38 | } |
39 | 39 | function getJFolder( $_path, $_local, $_stack ) { |
40 | - if($_local) { |
|
41 | - $stackInfo = $_stack; |
|
42 | - $folder = dirname($stackInfo[0]["file"]); |
|
43 | - $file = "$folder/$_path"; |
|
44 | - } else |
|
45 | - $file = $_path; |
|
46 | - return $file; |
|
40 | + if($_local) { |
|
41 | + $stackInfo = $_stack; |
|
42 | + $folder = dirname($stackInfo[0]["file"]); |
|
43 | + $file = "$folder/$_path"; |
|
44 | + } else |
|
45 | + $file = $_path; |
|
46 | + return $file; |
|
47 | 47 | } |
48 | 48 | function requireModulesList( $_path ) { |
49 | - if(!file_exists($_path)) |
|
50 | - return; |
|
51 | - $data = file_get_contents($_path); |
|
52 | - $data = json_decode($data); |
|
53 | - if($data === NULL) |
|
54 | - throw new Exception("Error in the file format [$_path]", 1); |
|
55 | - foreach ($data as $item) { |
|
56 | - if(substr($item, -1) == "*") |
|
57 | - requireModules(substr($item, 0, -2), false); |
|
58 | - else { |
|
59 | - $path = getJFolder($item, false, debug_backtrace()); |
|
60 | - requireComponents("$path", false); |
|
61 | - } |
|
62 | - } |
|
49 | + if(!file_exists($_path)) |
|
50 | + return; |
|
51 | + $data = file_get_contents($_path); |
|
52 | + $data = json_decode($data); |
|
53 | + if($data === NULL) |
|
54 | + throw new Exception("Error in the file format [$_path]", 1); |
|
55 | + foreach ($data as $item) { |
|
56 | + if(substr($item, -1) == "*") |
|
57 | + requireModules(substr($item, 0, -2), false); |
|
58 | + else { |
|
59 | + $path = getJFolder($item, false, debug_backtrace()); |
|
60 | + requireComponents("$path", false); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | ?> |
@@ -1,43 +1,43 @@ discard block |
||
1 | 1 | <?php |
2 | - function requireComponent( $_path, $_local = true ) { |
|
2 | + function requireComponent($_path, $_local = true) { |
|
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
4 | + if (file_exists($path) && isPhp($path)) |
|
5 | 5 | jRequire($path, false, 0); |
6 | 6 | else |
7 | 7 | requireError($_path); |
8 | 8 | } |
9 | - function requireComponents( $_path, $_local = true ) { |
|
9 | + function requireComponents($_path, $_local = true) { |
|
10 | 10 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | - if(file_exists($path)) { |
|
11 | + if (file_exists($path)) { |
|
12 | 12 | $files = subFolderFile($path); |
13 | 13 | foreach ($files as $i) |
14 | - if(isPhp("$path/$i")) |
|
14 | + if (isPhp("$path/$i")) |
|
15 | 15 | requireComponent($path."/".$i, false); |
16 | 16 | } else |
17 | 17 | requireError($_path); |
18 | 18 | } |
19 | - function requireError( $_path ) { |
|
19 | + function requireError($_path) { |
|
20 | 20 | global $DEBUG; |
21 | - if( $DEBUG == 1 ) |
|
21 | + if ($DEBUG == 1) |
|
22 | 22 | echo "Error load ($_path)<br>"; |
23 | 23 | } |
24 | - function isPhp ( $_file ) { |
|
25 | - if(!is_file($_file)) return false; |
|
24 | + function isPhp($_file) { |
|
25 | + if (!is_file($_file)) return false; |
|
26 | 26 | $info = pathinfo($_file); |
27 | 27 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
28 | 28 | } |
29 | - function requireModules( $_path, $_local = true ) { |
|
29 | + function requireModules($_path, $_local = true) { |
|
30 | 30 | $path = getJFolder($_path, $_local, debug_backtrace()); |
31 | 31 | $subFolders = subFolderDir($path); |
32 | 32 | foreach ($subFolders as $i) |
33 | 33 | requireComponents("$path/$i", false); |
34 | 34 | } |
35 | - function jRequire( $_path, $_local = true ) { |
|
35 | + function jRequire($_path, $_local = true) { |
|
36 | 36 | $path = getJFolder($_path, $_local, debug_backtrace()); |
37 | - require_once( $path ); |
|
37 | + require_once($path); |
|
38 | 38 | } |
39 | - function getJFolder( $_path, $_local, $_stack ) { |
|
40 | - if($_local) { |
|
39 | + function getJFolder($_path, $_local, $_stack) { |
|
40 | + if ($_local) { |
|
41 | 41 | $stackInfo = $_stack; |
42 | 42 | $folder = dirname($stackInfo[0]["file"]); |
43 | 43 | $file = "$folder/$_path"; |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | $file = $_path; |
46 | 46 | return $file; |
47 | 47 | } |
48 | - function requireModulesList( $_path ) { |
|
49 | - if(!file_exists($_path)) |
|
48 | + function requireModulesList($_path) { |
|
49 | + if (!file_exists($_path)) |
|
50 | 50 | return; |
51 | 51 | $data = file_get_contents($_path); |
52 | 52 | $data = json_decode($data); |
53 | - if($data === NULL) |
|
53 | + if ($data === NULL) |
|
54 | 54 | throw new Exception("Error in the file format [$_path]", 1); |
55 | 55 | foreach ($data as $item) { |
56 | - if(substr($item, -1) == "*") |
|
56 | + if (substr($item, -1) == "*") |
|
57 | 57 | requireModules(substr($item, 0, -2), false); |
58 | 58 | else { |
59 | 59 | $path = getJFolder($item, false, debug_backtrace()); |
@@ -1,36 +1,43 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | function requireComponent( $_path, $_local = true ) { |
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
5 | - jRequire($path, false, 0); |
|
6 | - else |
|
7 | - requireError($_path); |
|
4 | + if(file_exists($path) && isPhp($path)) { |
|
5 | + jRequire($path, false, 0); |
|
6 | + } else { |
|
7 | + requireError($_path); |
|
8 | + } |
|
8 | 9 | } |
9 | 10 | function requireComponents( $_path, $_local = true ) { |
10 | 11 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | 12 | if(file_exists($path)) { |
12 | 13 | $files = subFolderFile($path); |
13 | - foreach ($files as $i) |
|
14 | - if(isPhp("$path/$i")) |
|
14 | + foreach ($files as $i) { |
|
15 | + if(isPhp("$path/$i")) |
|
15 | 16 | requireComponent($path."/".$i, false); |
16 | - } else |
|
17 | - requireError($_path); |
|
17 | + } |
|
18 | + } else { |
|
19 | + requireError($_path); |
|
20 | + } |
|
18 | 21 | } |
19 | 22 | function requireError( $_path ) { |
20 | 23 | global $DEBUG; |
21 | - if( $DEBUG == 1 ) |
|
22 | - echo "Error load ($_path)<br>"; |
|
24 | + if( $DEBUG == 1 ) { |
|
25 | + echo "Error load ($_path)<br>"; |
|
26 | + } |
|
23 | 27 | } |
24 | 28 | function isPhp ( $_file ) { |
25 | - if(!is_file($_file)) return false; |
|
29 | + if(!is_file($_file)) { |
|
30 | + return false; |
|
31 | + } |
|
26 | 32 | $info = pathinfo($_file); |
27 | 33 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
28 | 34 | } |
29 | 35 | function requireModules( $_path, $_local = true ) { |
30 | 36 | $path = getJFolder($_path, $_local, debug_backtrace()); |
31 | 37 | $subFolders = subFolderDir($path); |
32 | - foreach ($subFolders as $i) |
|
33 | - requireComponents("$path/$i", false); |
|
38 | + foreach ($subFolders as $i) { |
|
39 | + requireComponents("$path/$i", false); |
|
40 | + } |
|
34 | 41 | } |
35 | 42 | function jRequire( $_path, $_local = true ) { |
36 | 43 | $path = getJFolder($_path, $_local, debug_backtrace()); |
@@ -41,21 +48,24 @@ discard block |
||
41 | 48 | $stackInfo = $_stack; |
42 | 49 | $folder = dirname($stackInfo[0]["file"]); |
43 | 50 | $file = "$folder/$_path"; |
44 | - } else |
|
45 | - $file = $_path; |
|
51 | + } else { |
|
52 | + $file = $_path; |
|
53 | + } |
|
46 | 54 | return $file; |
47 | 55 | } |
48 | 56 | function requireModulesList( $_path ) { |
49 | - if(!file_exists($_path)) |
|
50 | - return; |
|
57 | + if(!file_exists($_path)) { |
|
58 | + return; |
|
59 | + } |
|
51 | 60 | $data = file_get_contents($_path); |
52 | 61 | $data = json_decode($data); |
53 | - if($data === NULL) |
|
54 | - throw new Exception("Error in the file format [$_path]", 1); |
|
62 | + if($data === NULL) { |
|
63 | + throw new Exception("Error in the file format [$_path]", 1); |
|
64 | + } |
|
55 | 65 | foreach ($data as $item) { |
56 | - if(substr($item, -1) == "*") |
|
57 | - requireModules(substr($item, 0, -2), false); |
|
58 | - else { |
|
66 | + if(substr($item, -1) == "*") { |
|
67 | + requireModules(substr($item, 0, -2), false); |
|
68 | + } else { |
|
59 | 69 | $path = getJFolder($item, false, debug_backtrace()); |
60 | 70 | requireComponents("$path", false); |
61 | 71 | } |
@@ -1,4 +1,7 @@ |
||
1 | 1 | <?php |
2 | + /** |
|
3 | + * @param integer $number |
|
4 | + */ |
|
2 | 5 | function jateErrorHandler($number, $message, $file, $line) { |
3 | 6 | if (!(error_reporting() & $number)) { |
4 | 7 | return false; |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | function jateErrorHandler($number, $message, $file, $line) { |
3 | - if (!(error_reporting() & $number)) { |
|
4 | - return false; |
|
5 | - } |
|
6 | - ob_end_clean(); |
|
7 | - $message = JException::decode($message); |
|
8 | - echo " |
|
3 | + if (!(error_reporting() & $number)) { |
|
4 | + return false; |
|
5 | + } |
|
6 | + ob_end_clean(); |
|
7 | + $message = JException::decode($message); |
|
8 | + echo " |
|
9 | 9 | <div id='jate-body'> |
10 | 10 | <div id='jate-error'> |
11 | 11 | <header> |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | } |
55 | 55 | </style> |
56 | 56 | "; |
57 | - exit(1); |
|
58 | - return true; |
|
57 | + exit(1); |
|
58 | + return true; |
|
59 | 59 | } |
60 | 60 | function fatalErrorShutdownHandler() { |
61 | - $last_error = error_get_last(); |
|
62 | - if ($last_error['type'] === E_ERROR) { |
|
63 | - jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
64 | - } |
|
61 | + $last_error = error_get_last(); |
|
62 | + if ($last_error['type'] === E_ERROR) { |
|
63 | + jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | set_error_handler('jateErrorHandler'); |
67 | 67 | register_shutdown_function('fatalErrorShutdownHandler'); |
@@ -47,6 +47,10 @@ |
||
47 | 47 | if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
48 | 48 | throw new JException("File [$_file] not found."); |
49 | 49 | } |
50 | + |
|
51 | + /** |
|
52 | + * @param string $_url |
|
53 | + */ |
|
50 | 54 | protected function isCorrectUrl( $_url ) { |
51 | 55 | return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
52 | 56 | } |
@@ -1,54 +1,54 @@ |
||
1 | 1 | <?php |
2 | 2 | trait File { |
3 | - private $files; |
|
4 | - public function __construct() { |
|
5 | - $this->files = [ |
|
6 | - "required" => [], |
|
7 | - "attached" => [] |
|
8 | - ]; |
|
9 | - } |
|
10 | - public function addFile( $_file ) { |
|
11 | - try { |
|
12 | - $this->isCorrectPath($_file); |
|
13 | - } catch( Exception $e) { |
|
14 | - throw new JException($e->getMessage()); |
|
15 | - } |
|
16 | - $this->files["attached"][] = $_file; |
|
17 | - } |
|
18 | - public function addFileRequired( $_file ) { |
|
19 | - try { |
|
20 | - $this->isCorrectPath($_file); |
|
21 | - } catch( Exception $e) { |
|
22 | - throw new JException($e->getMessage()); |
|
23 | - } |
|
24 | - $this->files["required"][] = $_file; |
|
25 | - } |
|
26 | - public function addFiles( $_files ) { |
|
27 | - if(!is_array($_files)) |
|
28 | - throw new JException("Parameter must be an array."); |
|
29 | - foreach ($_files as $value) |
|
30 | - $this->addFile($value); |
|
31 | - } |
|
32 | - public function addFilesRequired( $_files ) { |
|
33 | - if(!is_array($_files)) |
|
34 | - throw new JException("Parameter must be an array."); |
|
35 | - foreach ($_files as $value) |
|
36 | - $this->addFileRequired($value); |
|
37 | - } |
|
38 | - public function getFiles() { |
|
39 | - return $this->files["attached"]; |
|
40 | - } |
|
41 | - public function getFilesRequired() { |
|
42 | - return $this->files["required"]; |
|
43 | - } |
|
44 | - protected function isCorrectPath( $_file ) { |
|
45 | - if(!is_string($_file)) |
|
46 | - throw new JException("Path must be a string."); |
|
47 | - if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
48 | - throw new JException("File [$_file] not found."); |
|
49 | - } |
|
50 | - protected function isCorrectUrl( $_url ) { |
|
51 | - return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
|
52 | - } |
|
3 | + private $files; |
|
4 | + public function __construct() { |
|
5 | + $this->files = [ |
|
6 | + "required" => [], |
|
7 | + "attached" => [] |
|
8 | + ]; |
|
9 | + } |
|
10 | + public function addFile( $_file ) { |
|
11 | + try { |
|
12 | + $this->isCorrectPath($_file); |
|
13 | + } catch( Exception $e) { |
|
14 | + throw new JException($e->getMessage()); |
|
15 | + } |
|
16 | + $this->files["attached"][] = $_file; |
|
17 | + } |
|
18 | + public function addFileRequired( $_file ) { |
|
19 | + try { |
|
20 | + $this->isCorrectPath($_file); |
|
21 | + } catch( Exception $e) { |
|
22 | + throw new JException($e->getMessage()); |
|
23 | + } |
|
24 | + $this->files["required"][] = $_file; |
|
25 | + } |
|
26 | + public function addFiles( $_files ) { |
|
27 | + if(!is_array($_files)) |
|
28 | + throw new JException("Parameter must be an array."); |
|
29 | + foreach ($_files as $value) |
|
30 | + $this->addFile($value); |
|
31 | + } |
|
32 | + public function addFilesRequired( $_files ) { |
|
33 | + if(!is_array($_files)) |
|
34 | + throw new JException("Parameter must be an array."); |
|
35 | + foreach ($_files as $value) |
|
36 | + $this->addFileRequired($value); |
|
37 | + } |
|
38 | + public function getFiles() { |
|
39 | + return $this->files["attached"]; |
|
40 | + } |
|
41 | + public function getFilesRequired() { |
|
42 | + return $this->files["required"]; |
|
43 | + } |
|
44 | + protected function isCorrectPath( $_file ) { |
|
45 | + if(!is_string($_file)) |
|
46 | + throw new JException("Path must be a string."); |
|
47 | + if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
48 | + throw new JException("File [$_file] not found."); |
|
49 | + } |
|
50 | + protected function isCorrectUrl( $_url ) { |
|
51 | + return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | ?> |
@@ -7,30 +7,30 @@ discard block |
||
7 | 7 | "attached" => [] |
8 | 8 | ]; |
9 | 9 | } |
10 | - public function addFile( $_file ) { |
|
10 | + public function addFile($_file) { |
|
11 | 11 | try { |
12 | 12 | $this->isCorrectPath($_file); |
13 | - } catch( Exception $e) { |
|
13 | + } catch (Exception $e) { |
|
14 | 14 | throw new JException($e->getMessage()); |
15 | 15 | } |
16 | 16 | $this->files["attached"][] = $_file; |
17 | 17 | } |
18 | - public function addFileRequired( $_file ) { |
|
18 | + public function addFileRequired($_file) { |
|
19 | 19 | try { |
20 | 20 | $this->isCorrectPath($_file); |
21 | - } catch( Exception $e) { |
|
21 | + } catch (Exception $e) { |
|
22 | 22 | throw new JException($e->getMessage()); |
23 | 23 | } |
24 | 24 | $this->files["required"][] = $_file; |
25 | 25 | } |
26 | - public function addFiles( $_files ) { |
|
27 | - if(!is_array($_files)) |
|
26 | + public function addFiles($_files) { |
|
27 | + if (!is_array($_files)) |
|
28 | 28 | throw new JException("Parameter must be an array."); |
29 | 29 | foreach ($_files as $value) |
30 | 30 | $this->addFile($value); |
31 | 31 | } |
32 | - public function addFilesRequired( $_files ) { |
|
33 | - if(!is_array($_files)) |
|
32 | + public function addFilesRequired($_files) { |
|
33 | + if (!is_array($_files)) |
|
34 | 34 | throw new JException("Parameter must be an array."); |
35 | 35 | foreach ($_files as $value) |
36 | 36 | $this->addFileRequired($value); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | public function getFilesRequired() { |
42 | 42 | return $this->files["required"]; |
43 | 43 | } |
44 | - protected function isCorrectPath( $_file ) { |
|
45 | - if(!is_string($_file)) |
|
44 | + protected function isCorrectPath($_file) { |
|
45 | + if (!is_string($_file)) |
|
46 | 46 | throw new JException("Path must be a string."); |
47 | - if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
47 | + if (!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
48 | 48 | throw new JException("File [$_file] not found."); |
49 | 49 | } |
50 | - protected function isCorrectUrl( $_url ) { |
|
51 | - return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
|
50 | + protected function isCorrectUrl($_url) { |
|
51 | + return strpos(@get_headers($_url)[0], '200') === false ? false : true; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | ?> |
@@ -24,16 +24,20 @@ discard block |
||
24 | 24 | $this->files["required"][] = $_file; |
25 | 25 | } |
26 | 26 | public function addFiles( $_files ) { |
27 | - if(!is_array($_files)) |
|
28 | - throw new JException("Parameter must be an array."); |
|
29 | - foreach ($_files as $value) |
|
30 | - $this->addFile($value); |
|
27 | + if(!is_array($_files)) { |
|
28 | + throw new JException("Parameter must be an array."); |
|
29 | + } |
|
30 | + foreach ($_files as $value) { |
|
31 | + $this->addFile($value); |
|
32 | + } |
|
31 | 33 | } |
32 | 34 | public function addFilesRequired( $_files ) { |
33 | - if(!is_array($_files)) |
|
34 | - throw new JException("Parameter must be an array."); |
|
35 | - foreach ($_files as $value) |
|
36 | - $this->addFileRequired($value); |
|
35 | + if(!is_array($_files)) { |
|
36 | + throw new JException("Parameter must be an array."); |
|
37 | + } |
|
38 | + foreach ($_files as $value) { |
|
39 | + $this->addFileRequired($value); |
|
40 | + } |
|
37 | 41 | } |
38 | 42 | public function getFiles() { |
39 | 43 | return $this->files["attached"]; |
@@ -42,10 +46,12 @@ discard block |
||
42 | 46 | return $this->files["required"]; |
43 | 47 | } |
44 | 48 | protected function isCorrectPath( $_file ) { |
45 | - if(!is_string($_file)) |
|
46 | - throw new JException("Path must be a string."); |
|
47 | - if(!(file_exists($_file) || $this->isCorrectUrl($_file))) |
|
48 | - throw new JException("File [$_file] not found."); |
|
49 | + if(!is_string($_file)) { |
|
50 | + throw new JException("Path must be a string."); |
|
51 | + } |
|
52 | + if(!(file_exists($_file) || $this->isCorrectUrl($_file))) { |
|
53 | + throw new JException("File [$_file] not found."); |
|
54 | + } |
|
49 | 55 | } |
50 | 56 | protected function isCorrectUrl( $_url ) { |
51 | 57 | return strpos(@get_headers($_url)[0],'200') === false ? false : true; |
@@ -83,6 +83,11 @@ |
||
83 | 83 | $this->tags["js"] = $this->getJs(); |
84 | 84 | $this->tags["jsVar"] = $this->getJsVars(); |
85 | 85 | } |
86 | + |
|
87 | + /** |
|
88 | + * @param string $_function |
|
89 | + * @param string $_extenction |
|
90 | + */ |
|
86 | 91 | protected function getRequire( $_function, $_extenction) { |
87 | 92 | $temp = []; |
88 | 93 | $filesRequired = $this->getFilesRequired(); |
@@ -3,99 +3,99 @@ |
||
3 | 3 | requireComponent("../Module/Module.php"); |
4 | 4 | requireComponent("../JException/JException.php"); |
5 | 5 | abstract class Html extends Module { |
6 | - public $template; |
|
7 | - public $app; |
|
8 | - public $page; |
|
9 | - public $tags; |
|
10 | - public $jsVars; |
|
11 | - public function __construct() { |
|
12 | - parent::__construct(); |
|
13 | - $this->template = ""; |
|
14 | - $this->app = []; |
|
15 | - $this->page = []; |
|
16 | - $this->jsVars = []; |
|
17 | - $this->tags = [ |
|
18 | - "css" => [], |
|
19 | - "js" => [], |
|
20 | - "jsVar" => [], |
|
21 | - "base" => "" |
|
22 | - ]; |
|
23 | - } |
|
24 | - public function setParameters( $_parameters = [ "app" => null, "page" => null] ) { |
|
25 | - $this->app = $_parameters["app"]; |
|
26 | - $this->page = $_parameters["page"]; |
|
27 | - } |
|
28 | - abstract public function init(); |
|
29 | - public function draw() { |
|
30 | - if($this->template == "") |
|
31 | - throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
|
32 | - $server = new ServerVars(); |
|
33 | - $this->addDipendences(); |
|
34 | - $this->tags["css"] = array_unique($this->tags["css"]); |
|
35 | - $this->tags["js"] = array_unique($this->tags["js"]); |
|
36 | - $this->tags["base"] = $server->server["RELATIVE"]."/"; |
|
37 | - $this->stringifyDipendences(); |
|
38 | - return jBlockFile($this->template, $this->tags); |
|
39 | - } |
|
40 | - public function getCss() { |
|
41 | - return $this->getRequire("getCss",".css"); |
|
42 | - } |
|
43 | - public function getJs() { |
|
44 | - return $this->getRequire("getJs",".js"); |
|
45 | - } |
|
46 | - public function getJsVars() { |
|
47 | - return $this->jsVars; |
|
48 | - } |
|
49 | - public function addJsVar( $_name, $_value ) { |
|
50 | - if(!is_string($_name)) |
|
51 | - throw new InvalidArgumentException("Parameter name must be a string."); |
|
52 | - if(!is_string($_value)) |
|
53 | - throw new InvalidArgumentException("Parameter value must be a string."); |
|
54 | - $this->jsVars[] = [$_name, $_value]; |
|
55 | - } |
|
56 | - public function addJsVars( $_array ) { |
|
57 | - if(!is_array($_array)) |
|
58 | - throw new InvalidArgumentException("Parameter must be an array."); |
|
59 | - foreach ($_array as $value) |
|
60 | - $this->addJsVar($value[0], $value[1]); |
|
61 | - } |
|
62 | - protected function stringifyDipendences() { |
|
63 | - $tempStr = ""; |
|
64 | - $timeParameter = "?t=".time(); |
|
65 | - $time = ($this->app->cache->css == true) ? "" : $timeParameter; |
|
66 | - foreach ($this->tags["css"] as $i) |
|
67 | - $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
68 | - $this->tags["css"] = $tempStr; |
|
69 | - $tempStr = ""; |
|
70 | - $time = ($this->app->cache->js == true) ? "" : $timeParameter; |
|
71 | - foreach ($this->tags["js"] as $i) |
|
72 | - $tempStr .= "<script src='$i$time'></script>"; |
|
73 | - $this->tags["js"] = $tempStr; |
|
74 | - $tempStr = ""; |
|
75 | - $tempStr .= "<script type='text/javascript'>"; |
|
76 | - foreach ($this->tags["jsVar"] as $i) |
|
77 | - $tempStr .= " $i[0] = $i[1];\n"; |
|
78 | - $tempStr .= "</script>"; |
|
79 | - $this->tags["jsVar"] = $tempStr; |
|
80 | - } |
|
81 | - protected function addDipendences() { |
|
82 | - $this->tags["css"] = $this->getCss(); |
|
83 | - $this->tags["js"] = $this->getJs(); |
|
84 | - $this->tags["jsVar"] = $this->getJsVars(); |
|
85 | - } |
|
86 | - protected function getRequire( $_function, $_extenction) { |
|
87 | - $temp = []; |
|
88 | - $filesRequired = $this->getFilesRequired(); |
|
89 | - $files = $this->getFiles(); |
|
90 | - foreach ($filesRequired as $i) |
|
91 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
92 | - $temp[] = $i; |
|
93 | - foreach ($this->modules as $i) |
|
94 | - $temp = array_merge( $temp, $i->$_function() ); |
|
95 | - foreach ($files as $i) |
|
96 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
97 | - $temp[] = $i; |
|
98 | - return $temp; |
|
99 | - } |
|
6 | + public $template; |
|
7 | + public $app; |
|
8 | + public $page; |
|
9 | + public $tags; |
|
10 | + public $jsVars; |
|
11 | + public function __construct() { |
|
12 | + parent::__construct(); |
|
13 | + $this->template = ""; |
|
14 | + $this->app = []; |
|
15 | + $this->page = []; |
|
16 | + $this->jsVars = []; |
|
17 | + $this->tags = [ |
|
18 | + "css" => [], |
|
19 | + "js" => [], |
|
20 | + "jsVar" => [], |
|
21 | + "base" => "" |
|
22 | + ]; |
|
23 | + } |
|
24 | + public function setParameters( $_parameters = [ "app" => null, "page" => null] ) { |
|
25 | + $this->app = $_parameters["app"]; |
|
26 | + $this->page = $_parameters["page"]; |
|
27 | + } |
|
28 | + abstract public function init(); |
|
29 | + public function draw() { |
|
30 | + if($this->template == "") |
|
31 | + throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
|
32 | + $server = new ServerVars(); |
|
33 | + $this->addDipendences(); |
|
34 | + $this->tags["css"] = array_unique($this->tags["css"]); |
|
35 | + $this->tags["js"] = array_unique($this->tags["js"]); |
|
36 | + $this->tags["base"] = $server->server["RELATIVE"]."/"; |
|
37 | + $this->stringifyDipendences(); |
|
38 | + return jBlockFile($this->template, $this->tags); |
|
39 | + } |
|
40 | + public function getCss() { |
|
41 | + return $this->getRequire("getCss",".css"); |
|
42 | + } |
|
43 | + public function getJs() { |
|
44 | + return $this->getRequire("getJs",".js"); |
|
45 | + } |
|
46 | + public function getJsVars() { |
|
47 | + return $this->jsVars; |
|
48 | + } |
|
49 | + public function addJsVar( $_name, $_value ) { |
|
50 | + if(!is_string($_name)) |
|
51 | + throw new InvalidArgumentException("Parameter name must be a string."); |
|
52 | + if(!is_string($_value)) |
|
53 | + throw new InvalidArgumentException("Parameter value must be a string."); |
|
54 | + $this->jsVars[] = [$_name, $_value]; |
|
55 | + } |
|
56 | + public function addJsVars( $_array ) { |
|
57 | + if(!is_array($_array)) |
|
58 | + throw new InvalidArgumentException("Parameter must be an array."); |
|
59 | + foreach ($_array as $value) |
|
60 | + $this->addJsVar($value[0], $value[1]); |
|
61 | + } |
|
62 | + protected function stringifyDipendences() { |
|
63 | + $tempStr = ""; |
|
64 | + $timeParameter = "?t=".time(); |
|
65 | + $time = ($this->app->cache->css == true) ? "" : $timeParameter; |
|
66 | + foreach ($this->tags["css"] as $i) |
|
67 | + $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
68 | + $this->tags["css"] = $tempStr; |
|
69 | + $tempStr = ""; |
|
70 | + $time = ($this->app->cache->js == true) ? "" : $timeParameter; |
|
71 | + foreach ($this->tags["js"] as $i) |
|
72 | + $tempStr .= "<script src='$i$time'></script>"; |
|
73 | + $this->tags["js"] = $tempStr; |
|
74 | + $tempStr = ""; |
|
75 | + $tempStr .= "<script type='text/javascript'>"; |
|
76 | + foreach ($this->tags["jsVar"] as $i) |
|
77 | + $tempStr .= " $i[0] = $i[1];\n"; |
|
78 | + $tempStr .= "</script>"; |
|
79 | + $this->tags["jsVar"] = $tempStr; |
|
80 | + } |
|
81 | + protected function addDipendences() { |
|
82 | + $this->tags["css"] = $this->getCss(); |
|
83 | + $this->tags["js"] = $this->getJs(); |
|
84 | + $this->tags["jsVar"] = $this->getJsVars(); |
|
85 | + } |
|
86 | + protected function getRequire( $_function, $_extenction) { |
|
87 | + $temp = []; |
|
88 | + $filesRequired = $this->getFilesRequired(); |
|
89 | + $files = $this->getFiles(); |
|
90 | + foreach ($filesRequired as $i) |
|
91 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
92 | + $temp[] = $i; |
|
93 | + foreach ($this->modules as $i) |
|
94 | + $temp = array_merge( $temp, $i->$_function() ); |
|
95 | + foreach ($files as $i) |
|
96 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
97 | + $temp[] = $i; |
|
98 | + return $temp; |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | ?> |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | "base" => "" |
22 | 22 | ]; |
23 | 23 | } |
24 | - public function setParameters( $_parameters = [ "app" => null, "page" => null] ) { |
|
24 | + public function setParameters($_parameters = ["app" => null, "page" => null]) { |
|
25 | 25 | $this->app = $_parameters["app"]; |
26 | 26 | $this->page = $_parameters["page"]; |
27 | 27 | } |
28 | 28 | abstract public function init(); |
29 | 29 | public function draw() { |
30 | - if($this->template == "") |
|
30 | + if ($this->template == "") |
|
31 | 31 | throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
32 | 32 | $server = new ServerVars(); |
33 | 33 | $this->addDipendences(); |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | return jBlockFile($this->template, $this->tags); |
39 | 39 | } |
40 | 40 | public function getCss() { |
41 | - return $this->getRequire("getCss",".css"); |
|
41 | + return $this->getRequire("getCss", ".css"); |
|
42 | 42 | } |
43 | 43 | public function getJs() { |
44 | - return $this->getRequire("getJs",".js"); |
|
44 | + return $this->getRequire("getJs", ".js"); |
|
45 | 45 | } |
46 | 46 | public function getJsVars() { |
47 | 47 | return $this->jsVars; |
48 | 48 | } |
49 | - public function addJsVar( $_name, $_value ) { |
|
50 | - if(!is_string($_name)) |
|
49 | + public function addJsVar($_name, $_value) { |
|
50 | + if (!is_string($_name)) |
|
51 | 51 | throw new InvalidArgumentException("Parameter name must be a string."); |
52 | - if(!is_string($_value)) |
|
52 | + if (!is_string($_value)) |
|
53 | 53 | throw new InvalidArgumentException("Parameter value must be a string."); |
54 | 54 | $this->jsVars[] = [$_name, $_value]; |
55 | 55 | } |
56 | - public function addJsVars( $_array ) { |
|
57 | - if(!is_array($_array)) |
|
56 | + public function addJsVars($_array) { |
|
57 | + if (!is_array($_array)) |
|
58 | 58 | throw new InvalidArgumentException("Parameter must be an array."); |
59 | 59 | foreach ($_array as $value) |
60 | 60 | $this->addJsVar($value[0], $value[1]); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->tags["js"] = $this->getJs(); |
84 | 84 | $this->tags["jsVar"] = $this->getJsVars(); |
85 | 85 | } |
86 | - protected function getRequire( $_function, $_extenction) { |
|
86 | + protected function getRequire($_function, $_extenction) { |
|
87 | 87 | $temp = []; |
88 | 88 | $filesRequired = $this->getFilesRequired(); |
89 | 89 | $files = $this->getFiles(); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
92 | 92 | $temp[] = $i; |
93 | 93 | foreach ($this->modules as $i) |
94 | - $temp = array_merge( $temp, $i->$_function() ); |
|
94 | + $temp = array_merge($temp, $i->$_function()); |
|
95 | 95 | foreach ($files as $i) |
96 | 96 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
97 | 97 | $temp[] = $i; |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | } |
28 | 28 | abstract public function init(); |
29 | 29 | public function draw() { |
30 | - if($this->template == "") |
|
31 | - throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
|
30 | + if($this->template == "") { |
|
31 | + throw new JException("The variable \$this->template must be set in class $this->name function init()."); |
|
32 | + } |
|
32 | 33 | $server = new ServerVars(); |
33 | 34 | $this->addDipendences(); |
34 | 35 | $this->tags["css"] = array_unique($this->tags["css"]); |
@@ -47,34 +48,41 @@ discard block |
||
47 | 48 | return $this->jsVars; |
48 | 49 | } |
49 | 50 | public function addJsVar( $_name, $_value ) { |
50 | - if(!is_string($_name)) |
|
51 | - throw new InvalidArgumentException("Parameter name must be a string."); |
|
52 | - if(!is_string($_value)) |
|
53 | - throw new InvalidArgumentException("Parameter value must be a string."); |
|
51 | + if(!is_string($_name)) { |
|
52 | + throw new InvalidArgumentException("Parameter name must be a string."); |
|
53 | + } |
|
54 | + if(!is_string($_value)) { |
|
55 | + throw new InvalidArgumentException("Parameter value must be a string."); |
|
56 | + } |
|
54 | 57 | $this->jsVars[] = [$_name, $_value]; |
55 | 58 | } |
56 | 59 | public function addJsVars( $_array ) { |
57 | - if(!is_array($_array)) |
|
58 | - throw new InvalidArgumentException("Parameter must be an array."); |
|
59 | - foreach ($_array as $value) |
|
60 | - $this->addJsVar($value[0], $value[1]); |
|
60 | + if(!is_array($_array)) { |
|
61 | + throw new InvalidArgumentException("Parameter must be an array."); |
|
62 | + } |
|
63 | + foreach ($_array as $value) { |
|
64 | + $this->addJsVar($value[0], $value[1]); |
|
65 | + } |
|
61 | 66 | } |
62 | 67 | protected function stringifyDipendences() { |
63 | 68 | $tempStr = ""; |
64 | 69 | $timeParameter = "?t=".time(); |
65 | 70 | $time = ($this->app->cache->css == true) ? "" : $timeParameter; |
66 | - foreach ($this->tags["css"] as $i) |
|
67 | - $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
71 | + foreach ($this->tags["css"] as $i) { |
|
72 | + $tempStr .= "<link rel='stylesheet' href='$i$time'>"; |
|
73 | + } |
|
68 | 74 | $this->tags["css"] = $tempStr; |
69 | 75 | $tempStr = ""; |
70 | 76 | $time = ($this->app->cache->js == true) ? "" : $timeParameter; |
71 | - foreach ($this->tags["js"] as $i) |
|
72 | - $tempStr .= "<script src='$i$time'></script>"; |
|
77 | + foreach ($this->tags["js"] as $i) { |
|
78 | + $tempStr .= "<script src='$i$time'></script>"; |
|
79 | + } |
|
73 | 80 | $this->tags["js"] = $tempStr; |
74 | 81 | $tempStr = ""; |
75 | 82 | $tempStr .= "<script type='text/javascript'>"; |
76 | - foreach ($this->tags["jsVar"] as $i) |
|
77 | - $tempStr .= " $i[0] = $i[1];\n"; |
|
83 | + foreach ($this->tags["jsVar"] as $i) { |
|
84 | + $tempStr .= " $i[0] = $i[1];\n"; |
|
85 | + } |
|
78 | 86 | $tempStr .= "</script>"; |
79 | 87 | $this->tags["jsVar"] = $tempStr; |
80 | 88 | } |
@@ -87,14 +95,17 @@ discard block |
||
87 | 95 | $temp = []; |
88 | 96 | $filesRequired = $this->getFilesRequired(); |
89 | 97 | $files = $this->getFiles(); |
90 | - foreach ($filesRequired as $i) |
|
91 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
98 | + foreach ($filesRequired as $i) { |
|
99 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
92 | 100 | $temp[] = $i; |
93 | - foreach ($this->modules as $i) |
|
94 | - $temp = array_merge( $temp, $i->$_function() ); |
|
95 | - foreach ($files as $i) |
|
96 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
101 | + } |
|
102 | + foreach ($this->modules as $i) { |
|
103 | + $temp = array_merge( $temp, $i->$_function() ); |
|
104 | + } |
|
105 | + foreach ($files as $i) { |
|
106 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
97 | 107 | $temp[] = $i; |
108 | + } |
|
98 | 109 | return $temp; |
99 | 110 | } |
100 | 111 | } |