Skip to content

Instantly share code, notes, and snippets.

@ferdiunal
Created September 13, 2016 20:54
Show Gist options
  • Save ferdiunal/90905d77dba3ac0ee6217c17debb2877 to your computer and use it in GitHub Desktop.
Save ferdiunal/90905d77dba3ac0ee6217c17debb2877 to your computer and use it in GitHub Desktop.
Tinymce vs editörlerden blade taglarını render etmemize yarıyor.
/**
* Tinymce vs editörlerden blade taglarını render etmemize yarıyor.
* @param $value
* @return mixed
*/
function compile_echos($value)
{
$pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', "{{", "}}");
$callback = function ($matches) {
$whitespace = empty($matches[3]) ? '' : $matches[3] . $matches[3];
return $matches[1] ? substr($matches[0], 1) : eval("return {$matches[2]};") . $whitespace;
};
$value = preg_replace_callback($pattern, $callback, $value);
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment