Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

token_get_all check for systems where is not available

givanzca56b55f209a
diff --git a/system/extensions/extensions.php b/system/extensions/extensions.php
index 4e8d91f..2b9aac5 100755
--- a/system/extensions/extensions.php
+++ b/system/extensions/extensions.php
@@ -57,15 +57,23 @@ abstract class Extensions {
static function getComments($content) {
//$content = file_get_contents($file);
- $docComments = [];
+ if (function_exists('token_get_all')) {
+ $docComments = [];
- foreach (token_get_all($content) as $entry) {
- if ($entry[0] == T_DOC_COMMENT || $entry[0] == T_COMMENT) {
- $docComments[] = $entry[1];
+ foreach (token_get_all($content) as $entry) {
+ if ($entry[0] == T_DOC_COMMENT || $entry[0] == T_COMMENT) {
+ $docComments[] = $entry[1];
+ }
+ }
+
+ return implode("\n", $docComments);
+ } else {
+ if (preg_match_all('@(?s)/\*.*?\*/@', $content, $matches, PREG_PATTERN_ORDER)) {
+ return implode("\n", $matches[0] ?? []);
}
}
- return implode("\n", $docComments);
+ return '';
}
static function getInfo($content, $name = false) {
diff --git a/system/vtpl/vtpl.php b/system/vtpl/vtpl.php
index ade0a84..6dc0330 100755
--- a/system/vtpl/vtpl.php
+++ b/system/vtpl/vtpl.php
@@ -2098,7 +2098,7 @@ class Vtpl {
return false;
}
- if ($this->checkSyntax) {
+ if ($this->checkSyntax && function_exists('token_get_all')) {
file_put_contents($compiledFile, $html);
try {