Source for file Datetimehash.php

Documentation is available at Datetimehash.php

  1. <?php
  2. /**
  3.  * Teeple2 - PHP5 Web Application Framework inspired by Seasar2
  4.  *
  5.  * PHP versions 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @package     teeple
  14.  * @author      Mitsutaka Sato <miztaka@gmail.com>
  15.  * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
  16.  */
  17.  
  18. /**
  19.  * 連想配列に格納された日時が妥当かどうかをチェックします。
  20.  * 検証する配列は、Year,Month,Day,Hour,Minute,Secondのパラメータを持つ配列です。
  21.  *
  22.  * @package teeple.validator
  23.  */
  24. {
  25.  
  26.     protected function execute($obj$fieldName{
  27.         
  28.         $value $this->getTargetValue($obj$fieldName);
  29.         if (is_array($value)) {
  30.             throw new Teeple_Exception("対象となる値が配列ではありません。");
  31.         }
  32.         
  33.         $year   $value['Year'];
  34.         $month  $value['Month'];
  35.         $day    $value['Day'];
  36.         $hour   $value['Hour'];
  37.         $minute $value['Minute'];
  38.         $second = isset($value['Second']$second $value['Second''00';
  39.  
  40.         if (($year == ""|| ($month == ""|| ($day == ""|| ($hour == ""|| ($minute == "")) {
  41.             return FALSE;
  42.         else if (!is_numeric($year|| !is_numeric($month||
  43.                     !is_numeric($day|| !is_numeric($hour|| !is_numeric($minute)) {
  44.             return FALSE;
  45.         else if (checkdate($month$day$year)) {
  46.             if (intval($hour|| 23 intval($hour)) {
  47.                 return FALSE;
  48.             }
  49.             if (intval($minute|| 59 intval($minute)) {
  50.                 return FALSE;
  51.             }
  52.             if (intval($second|| 59 intval($second)) {
  53.                 return FALSE;
  54.             }
  55.             return TRUE;
  56.         else {
  57.             return FALSE;
  58.         }
  59.         return TRUE;
  60.     }
  61.     
  62. }
  63. ?>

Documentation generated on Mon, 26 Apr 2010 08:59:41 +0900 by phpDocumentor 1.4.3