Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function convert_numbers_to_khmer( $string ) {
- $khmer_numbers = array('០', '១', '២', '៣', '៤', '៥', '៦', '៧', '៨', '៩', '.');
- $english_numbers = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.');
- return str_replace($english_numbers, $khmer_numbers, $string);
- }
- function make_khmer_time( $the_time ) {
- if ( get_bloginfo( 'language' ) == 'km' ) {
- $the_time = convert_numbers_to_khmer( $the_time );
- }
- return $the_time;
- }
- add_filter( 'get_the_time', 'make_khmer_time' );
- add_filter( 'get_the_date', 'make_khmer_time' );
- add_filter('comments_number', 'make_khmer_time');
- function _make_khmer_link_replace_callback( array $matches ) {
- return '<a' . $matches[1] . '>' . convert_numbers_to_khmer( $matches[2] ) . '</a>';
- }
- function make_khmer_link( $link ) {
- if ( get_bloginfo( 'language' ) == 'km' ) {
- $link = preg_replace_callback(
- '#<a(.*?)>(.+?)</a>#',
- '_make_khmer_link_replace_callback',
- $link
- );
- }
- return $link;
- }
- add_filter('get_archives_link', 'make_khmer_link');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement