1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

Snippets Plugin: code optimization.

This commit is contained in:
Awilum
2012-11-04 17:17:12 +02:00
parent 27d1ab93ba
commit ead5e92524

View File

@@ -59,11 +59,16 @@
$snippet_path = STORAGE . DS . 'snippets' . DS . $name . '.snippet.php';
if (File::exists($snippet_path)) {
// Turn on output buffering
ob_start();
// Include view file
include $snippet_path;
$snippet_contents = ob_get_contents();
ob_end_clean();
return $snippet_contents;
// Output...
return ob_get_clean();
} else {
if (Session::exists('admin') && Session::get('admin') == true) {
return __('<b>Snippet <u>:name</u> is not found!</b>', 'snippets', array(':name' => $name));