-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.php
105 lines (92 loc) · 1.98 KB
/
log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
require '../Smarty-3.1.15/libs/Smarty.class.php';
/**
* Class Logs
* @author lennylan
*/
class Log
{
/**
* title of one log
* @var string
*/
public $title;
/**
* public date of log
* @var Date
*/
public $publicDate;
/**
* platform of product
* @var string
*/
public $platform;
/**
* version of product
* @var string
*/
public $version;
/**
* lang of log
* @var string
*/
public $lang;
/**
* the tile of log displayed in index page
* @var string
*/
public $indexDescrption;
/**
* log page Link
* @var string
*/
public $link;
/**
* dir name of log image
* @var string
*/
public $dir;
/**
* feature list of log
* @var array
*/
public $features = array();
/**
* count of images of each feature
* @var array
*/
public $featuresNum = array();
/**
* download version for download url in SingleLog page.
* @var string
*/
public $downloadVersion;
/**
* determine if add new tag to the log.
* @var int
*/
public $isNew;
public function __construct($xmlItem)
{
$this->publicDate = $xmlItem->date;
$this->version = $xmlItem->version;
$this->platform = $xmlItem->platform;
$this->lang = $xmlItem->lang;
$this->title = $xmlItem->title;
$this->description = $xmlItem->description;
$this->indexDescription = $xmlItem->indexDescription;
if (isset($xmlItem->features)) {
$this->features = $xmlItem->features;
}
if (isset($xmlItem->featuresNum)) {
$this->featuresNum = $xmlItem->featuresNum;
}
$this->link = preg_replace("/\./","_",$xmlItem->platform."_".$xmlItem->version).".html";
$this->dir = preg_replace("/\./","_",$xmlItem->platform."_".$xmlItem->version);
$this->downloadVersion = preg_replace("/\./","",$xmlItem->version);
$date = date_create_from_format('Y-m-d',$xmlItem->date);
$now = new DateTime();
$this->isNew = $date->diff($now)->format("%a") < 30 ? 1 : 0;
}
}
?>