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; } } ?>