changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / markup / timestamp.php
1 <?php
2
3 /*
4     Description:
5     This function replaces &now in text with a timestamp
6     as long as it is surrounded by any form of whitespace
7     Written by Alfred Sterphone, III
8     Started - 5/24
9     Last Updated - 5/27
10 */
11
12 $ewiki_plugins["edit_save"][] = "ewiki_edit_save_timestamp";
13
14 function ewiki_edit_save_timestamp(&$save)
15 {
16     $save['content'] = replaceAmpNow($save['content'], time());
17 }
18
19 function replaceAmpNow($a_input, $a_timestamp)
20 {
21     $pattern = "/(^|[\s])(&now)($|[\s])/i";
22     $dateFormat = "l, F dS, Y h:i A";
23
24     $retval = preg_replace($pattern,
25             "\$1''".date($dateFormat, $a_timestamp)."''\$3",
26             $a_input);
27             
28     return $retval;
29 }
30
31 ?>