phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [18545] code cleanup, switch to preg_match and fix so


From: Dave Hall
Subject: [Phpgroupware-cvs] [18545] code cleanup, switch to preg_match and fix some formatting
Date: Mon, 26 May 2008 14:34:12 +0000

Revision: 18545
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18545
Author:   skwashd
Date:     2008-05-26 14:34:11 +0000 (Mon, 26 May 2008)

Log Message:
-----------
code cleanup, switch to preg_match and fix some formatting

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.jscalendar.inc.php

Modified: trunk/phpgwapi/inc/class.jscalendar.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jscalendar.inc.php 2008-05-26 14:32:35 UTC (rev 
18544)
+++ trunk/phpgwapi/inc/class.jscalendar.inc.php 2008-05-26 14:34:11 UTC (rev 
18545)
@@ -100,13 +100,14 @@
        {
                if ($datestr === '')
                {
-                       return False;
+                       return time();
                }
-               $fields = split('[./-]',$datestr);
-               foreach(split('[./-]',$this->dateformat) as $n => $field)
+               $pat = '/[\.\/\-]/';
+               $fields = preg_split($pat, $datestr);
+               foreach ( preg_split($pat, $this->dateformat) as $n => $field)
                {
-                       $date[$field] = intval($fields[$n]);
-                       if($field == 'M')
+                       $date[$field] = (int) $fields[$n];
+                       if ( $field == 'M')
                        {
                                for($i=1; $i <=12; $i++)
                                {
@@ -117,7 +118,8 @@
                                }
                        }
                }
-               $ret = array(
+               $ret = array
+               (
                        $year  => $date['Y'],
                        $month => $date['m'],
                        $day   => $date['d']
@@ -184,4 +186,3 @@
                $GLOBALS['phpgw']->js->add_event('load', 
"Calendar.setup({inputField : '$id', button : '{$id}-trigger'});");
        }
 }
-?>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]