lang
[phpmyadmin/crack.git] / libraries / transformations / text_plain__dateformat.inc.php3
blobd9c9d152b4404f36d23f0b3674065f469086ce85
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Plugin function TEMPLATE (Garvin Hicking).
7 * -----------------------------------------
9 * For instructions, read the libraries/transformations/README file.
11 * The string ENTER_FILENAME_HERE shall be substituted with the filename without the '.inc.php3'
12 * extension. For further information regarding naming conventions see the README file.
15 if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__DATEFORMAT')){
16 define('PMA_TRANSFORMATION_TEXT_PLAIN__DATEFORMAT', 1);
18 function PMA_transformation_text_plain__dateformat($buffer, $options = array()) {
19 // possibly use a global transform and feed it with special options:
20 // include('./libraries/transformations/global.inc.php3');
22 // further operations on $buffer using the $options[] array.
23 if (!isset($options[0]) || $options[0] == '') {
24 $options[0] = 0;
27 if (!isset($options[1]) || $options[1] == '') {
28 $options[1] = $GLOBALS['datefmt'];
31 $timestamp = -1;
32 if (strstr($buffer, ':')) {
33 $timestamp = strtotime($buffer);
34 } elseif (strlen($buffer) == 14 && eregi('^[0-9]*$', $buffer)) {
35 $d = array();
36 $d['year'] = substr($buffer, 0, 4);
37 $d['month'] = substr($buffer, 4, 2);
38 $d['day'] = substr($buffer, 6, 2);
39 $d['hour'] = substr($buffer, 8, 2);
40 $d['minute'] = substr($buffer, 10, 2);
41 $d['second'] = substr($buffer, 12, 2);
42 $timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']);
45 if ($timestamp != -1) {
46 $timestamp -= $options[0] * 60 * 60;
47 $buffer = PMA_localisedDate($timestamp, $options[1]);
50 return $buffer;