Guest User

Untitled

a guest
Jul 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. /**
  2. * These snippets below used for hack to Thai (Buddhist Era) date to node / comment display. (template.php)
  3. * You need translations for some strings which come from Date API too.
  4. */
  5. function genesis_SUBTHEME_node_submitted($node) {
  6. return t('โดย !username | วันที่ !date', array(
  7. '!username' => theme('username', $node),
  8. '!date' => _genesis_SUBTHEME_format_thai_node_submitted_date($node->created),
  9. ));
  10. }
  11.  
  12. function genesis_SUBTHEME_preprocess_comment(&$vars, $hook) {
  13. $comment = $vars['comment'];
  14. $vars['submitted'] = t('โดย !username | วันที่ !date !time', array(
  15. '!username' => theme('username', $comment),
  16. '!date' => _genesis_SUBTHEME_format_thai_node_submitted_date($comment->timestamp),
  17. '!time' => date('H:i:s', $comment->timestamp),
  18. ));
  19. }
  20. function _genesis_SUBTHEME_format_thai_node_submitted_date($created) {
  21. $month_name = array(
  22. 1 => "มกราคม",
  23. 2 => "กุมภาพันธ์",
  24. 3 => "มีนาคม",
  25. 4 => "เมษายน",
  26. 5 => "พฤษภาคม",
  27. 6 => "มิถุนายน",
  28. 7 => "กรกฎาคม",
  29. 8 => "สิงหาคม",
  30. 9 => "กันยายน",
  31. 10 => "ตุลาคม",
  32. 11 => "พฤศจิกายน",
  33. 12 => "ธันวาคม",
  34. );
  35.  
  36. $created = getdate($created);
  37. return $created['mday'] ." ". $month_name[$created['mon']] ." ". ($created['year'] + 543);
  38. }
Add Comment
Please, Sign In to add comment