Created
May 1, 2015 20:27
-
-
Save abrahamfast/67ce029e4f9c4b214c3e to your computer and use it in GitHub Desktop.
Change en to fa all numbersinto all pages when page compile with blade
This file contains 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
<?php | |
Blade::extend(function($view, $compiler) | |
{ | |
$pat = $compiler->createMatcher('traverse_farsi'); | |
return preg_replace($pat, '$1<?php echo traverse_farsi($2) ;?>', $view); | |
}); | |
function traverse_farsi ($str){ | |
$farsi_chars = ['٠','١','٢','٣','٤','٥','٦','٧','٨','٩']; | |
$latin_chars = ['0','1','2','3','4','5','6','7','8','9']; | |
return str_replace($latin_chars,$farsi_chars,$str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment