1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Conversion table used by Date_Japanese_Era |
4
|
|
|
* |
5
|
|
|
* PHP version 5.2 |
6
|
|
|
* |
7
|
|
|
* Copyright (c) 2009-2010 Shinya Ohyanagi, All rights reserved. |
8
|
|
|
* |
9
|
|
|
* Redistribution and use in source and binary forms, with or without |
10
|
|
|
* modification, are permitted provided that the following conditions |
11
|
|
|
* are met: |
12
|
|
|
* |
13
|
|
|
* * Redistributions of source code must retain the above copyright |
14
|
|
|
* notice, this list of conditions and the following disclaimer. |
15
|
|
|
* |
16
|
|
|
* * Redistributions in binary form must reproduce the above copyright |
17
|
|
|
* notice, this list of conditions and the following disclaimer in |
18
|
|
|
* the documentation and/or other materials provided with the |
19
|
|
|
* distribution. |
20
|
|
|
* |
21
|
|
|
* * Neither the name of Shinya Ohyanagi nor the names of his |
22
|
|
|
* contributors may be used to endorse or promote products derived |
23
|
|
|
* from this software without specific prior written permission. |
24
|
|
|
* |
25
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
26
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
27
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
28
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
29
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
30
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
31
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
32
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
33
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
34
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
35
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
36
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
37
|
|
|
* |
38
|
|
|
* @category Date |
39
|
|
|
* @package Date_Japanese |
40
|
|
|
* @version $id$ |
41
|
|
|
* @copyright 2009-2010 Shinya Ohyanagi |
42
|
|
|
* @author Shinya Ohyanagi <[email protected]> |
43
|
|
|
* @license New BSD License |
44
|
|
|
* @link http://search.cpan.org/~miyagawa/Date-Japanese-Era-0.06/ |
45
|
|
|
*/ |
46
|
|
|
|
47
|
|
|
namespace Date_Japanese_Era; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Conversion Table for Date_Japanese_Era |
51
|
|
|
* |
52
|
|
|
* @category Date |
53
|
|
|
* @package Date_Japanese |
54
|
|
|
* @version $id$ |
55
|
|
|
* @copyright 2009-2010 Shinya Ohyanagi |
56
|
|
|
* @author Shinya Ohyanagi <[email protected]> |
57
|
|
|
* @license New BSD License |
58
|
|
|
* @link http://search.cpan.org/~miyagawa/Date-Japanese-Era-0.06/ |
59
|
|
|
*/ |
60
|
|
|
class Date_Japanese_Era_Table |
61
|
|
|
{ |
62
|
|
|
/** |
63
|
|
|
* ERA_TABLE |
64
|
|
|
* |
65
|
|
|
* @var array |
66
|
|
|
* @access public |
67
|
|
|
*/ |
68
|
|
|
public static $ERA_TABLE = array( |
69
|
|
|
'明治' => array('meiji', 1868, 9, 8, 1912, 7, 29), |
70
|
|
|
'大正' => array('taishou', 1912, 7, 30, 1926, 12, 24), |
71
|
|
|
'昭和' => array('shouwa', 1926, 12, 25, 1989, 1, 7), |
72
|
|
|
'平成' => array('heisei', 1989, 1, 8, 2038, 12, 31) |
73
|
|
|
); |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Convert era to ascii |
78
|
|
|
* |
79
|
|
|
* @param mixed $ascii |
80
|
|
|
* @access public |
81
|
|
|
* @return mixed |
82
|
|
|
*/ |
83
|
|
|
public static function eraJa2Ascii() |
84
|
|
|
{ |
85
|
|
|
$era = array_reverse(self::$ERA_TABLE); |
86
|
|
|
$data = array(); |
87
|
|
|
foreach ($era as $key => $val) { |
88
|
|
|
$data[$val[0]] = array( |
89
|
|
|
$key, $val[1], $val[2], $val[3], $val[4], $val[5], $val[6] |
90
|
|
|
); |
91
|
|
|
} |
92
|
|
|
return $data; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|