Schwag
* 1st january, 1770
* Guybrush Threepwood
*
path/to/treasure.jpg
*
All I got was this lousy t-shirt!
*
*
* FIXME: It currently fails at grabbing the image (see 20020214.xml)
*/
public function __construct($data, $filename) {
$vars = array();
preg_match("/(.*)<\/NAME>.* # Grab the title
(.*)<\/DATE>.* # Grab the date
(.*)<\/AUTHOR>.* # Grab the author
(?:
(.*)<\/IMG>.*)? # image if set (only once)
(.*)<\/BODY> # Grab the body
/sUx", $data, $vars);
if (count($vars) == 6) {
$this->_title = $vars[1];
/* Store the date as an unix timestamp*/
$this->_date = intval(strtotime($vars[2]));
$this->_author = $vars[3];
$this->_image = $vars[4];
$this->_content = $vars[5];
}
$this->_filename = basename($filename);
}
/* Get the title. */
public function getTitle() {
return $this->_title;
}
/* Get the date. */
public function getDate() {
return $this->_date;
}
/* Get the author. */
public function getAuthor() {
return $this->_author;
}
/* Get the optional image. */
public function getImage() {
return $this->_image;
}
/* Get the content. */
public function getContent() {
return $this->_content;
}
/* Get the filename. */
public function getFilename() {
return $this->_filename;
}
}
?>