mirror of
https://github.com/processwire/processwire.git
synced 2025-08-18 20:41:16 +02:00
Add option to exclude FileCompiler at include() time by specifying include(/*NoCompile*/'filename.php');
or include('filename.php'/*NoCompile*/);
. The include() can also be include_once(), require(), require_once(), wireRenderFile(), wireIncludeFile() or new TemplateFile(). Relevent to PR #13
This commit is contained in:
@@ -429,6 +429,11 @@ class FileCompiler extends Wire {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(stripos($data, "FileCompiler=?") !== false) {
|
||||||
|
// Allow for a token that gets replaced so a file can detect if it's compiled
|
||||||
|
$data = str_replace("FileCompiler=?", "FileCompiler=Yes", $data);
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,6 +544,11 @@ class FileCompiler extends Wire {
|
|||||||
|
|
||||||
foreach($matches[0] as $key => $fullMatch) {
|
foreach($matches[0] as $key => $fullMatch) {
|
||||||
|
|
||||||
|
// if the include statement looks like one of these below then skip compilation for included file
|
||||||
|
// include(/*NoCompile*/__DIR__ . '/file.php');
|
||||||
|
// include(__DIR__ . '/file.php'/*NoCompile*/);
|
||||||
|
if(strpos($fullMatch, 'NoCompile') !== false) continue;
|
||||||
|
|
||||||
$open = $matches[1][$key];
|
$open = $matches[1][$key];
|
||||||
$funcMatch = $matches[2][$key];
|
$funcMatch = $matches[2][$key];
|
||||||
$argOpen = trim($matches[3][$key]);
|
$argOpen = trim($matches[3][$key]);
|
||||||
|
Reference in New Issue
Block a user