blob: a839fd983f53f9b65141bab8b00c4dcc22d3e735 (
plain)
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
|
<?
class PackageChangelog {
private $recent_changes;
public $recent_date;
function __construct($str, $date = null) {
$this->changelog = $str;
if(!is_null($date))
$this->date = $date;
}
function getRecentChanges() {
$pattern_date = "/^\d{1,2}\s\w{3}\s\d{4}/";
// $pattern_dev = "/<\w+@gentoo\.org>/";
$arr = explode("\n", $this->changelog);
// print_r($arr);
// Cut off the header
$arr = array_slice($arr, 4);
// Get the date of the latest changes
$str = trim($arr[0]);
preg_match_all($pattern_date, $str, $matches);
$this->recent_date = $date = current(current($matches));
$start = false;
$recent_changes = "";
foreach($arr as $str) {
$first_char = substr($str, 0, 1);
$last_char = substr($str, -1, 1);
if(($first_char == "*" || empty($str)) && $start) {
break;
}
if($start) {
$recent_changes .= " ".trim($str);
}
if($last_char == ":") {
$start = true;
}
}
$recent_changes = trim($recent_changes);
return $recent_changes;
}
}
?>
|