mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-03 19:57:57 +02:00
Snippets Plugin: code optimization.
This commit is contained in:
@@ -59,11 +59,16 @@
|
|||||||
$snippet_path = STORAGE . DS . 'snippets' . DS . $name . '.snippet.php';
|
$snippet_path = STORAGE . DS . 'snippets' . DS . $name . '.snippet.php';
|
||||||
|
|
||||||
if (File::exists($snippet_path)) {
|
if (File::exists($snippet_path)) {
|
||||||
|
|
||||||
|
// Turn on output buffering
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
// Include view file
|
||||||
include $snippet_path;
|
include $snippet_path;
|
||||||
$snippet_contents = ob_get_contents();
|
|
||||||
ob_end_clean();
|
// Output...
|
||||||
return $snippet_contents;
|
return ob_get_clean();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (Session::exists('admin') && Session::get('admin') == true) {
|
if (Session::exists('admin') && Session::get('admin') == true) {
|
||||||
return __('<b>Snippet <u>:name</u> is not found!</b>', 'snippets', array(':name' => $name));
|
return __('<b>Snippet <u>:name</u> is not found!</b>', 'snippets', array(':name' => $name));
|
||||||
|
Reference in New Issue
Block a user