249 |
249 |
250 function enano_date($string, $timestamp = false) |
250 function enano_date($string, $timestamp = false) |
251 { |
251 { |
252 if ( !is_int($timestamp) && !is_double($timestamp) && strval(intval($timestamp)) !== $timestamp ) |
252 if ( !is_int($timestamp) && !is_double($timestamp) && strval(intval($timestamp)) !== $timestamp ) |
253 $timestamp = time(); |
253 $timestamp = time(); |
254 // FIXME: Offset $timestamp by user's timezone |
254 |
255 return gmdate($string, $timestamp); |
255 /* |
|
256 // List of valid characters for date() |
|
257 $date_chars = 'dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZFcrU'; |
|
258 // Split them into an array |
|
259 $date_chars = enano_str_split($date_chars); |
|
260 // Emulate date() formatting by replacing date characters with their |
|
261 // percentage-signed counterparts, but not escaped characters which |
|
262 // shouldn't be parsed. |
|
263 foreach ( $date_chars as $char ) |
|
264 { |
|
265 $string = str_replace($char, "%$char", $string); |
|
266 $string = str_replace("\\%$char", $char, $string); |
|
267 } |
|
268 */ |
|
269 |
|
270 // perform timestamp offset |
|
271 global $timezone; |
|
272 // it's gonna be in minutes, so multiply by 60 to offset the unix timestamp |
|
273 $timestamp = $timestamp + ( $timezone * 60 ); |
|
274 |
|
275 // Let PHP do the work for us =) |
|
276 return date($string, $timestamp); |
256 } |
277 } |
257 |
278 |
258 /** |
279 /** |
259 * Tells you the title for the given page ID string |
280 * Tells you the title for the given page ID string |
260 * @param string Page ID string (ex: Special:Administration) |
281 * @param string Page ID string (ex: Special:Administration) |