Created
September 13, 2016 20:54
-
-
Save ferdiunal/90905d77dba3ac0ee6217c17debb2877 to your computer and use it in GitHub Desktop.
Tinymce vs editörlerden blade taglarını render etmemize yarıyor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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