NAME='Xanga Parser';
$this->NOTICE='Built by Jasper "Zero" Yeh';
$this->NOLIMIT=0;
$this->url=$url;
$this->raw=implode('',file($url));
//author
if(preg_match('|
(.*)\'s Xanga Site|iU',$this->raw,$matches)) {
$this->author=$matches[1];
} else {
$this->author='';
}
//title
if(preg_match('|]*class="header"[^>]*>]*>(.*) | .*
---|
|iU',$this->raw,$matches)) {
$this->title=$matches[1];
} else {
$this->title=$this->author . '\'s Blog';
}
//image
if(preg_match('|
]*>|iU',$this->raw,$matches)) {
$this->image=$matches[1];
} else {
$this->image=null;
}
$this->lang='en-us';
$this->moveFirst();
}
function moveFirst() {
//parse log entries
preg_match_all('|]*class="blogbody"[^>]*> | (.*) |
| |
|isU',$this->raw,$this->items);
}
function moveNext() {
static $n=0;
$mydatetime = $this->items[4][$n] . ' ' . $this->items[1][$n];
$this->item_title = $mydatetime;
$this->item_link = $this->items[3][$n];
$this->item_desc = $this->replaceExtendedASCII($this->items[2][$n]);
$this->item_date = $this->getISO8601Date($mydatetime);
$this->item_author = $this->author;
$n++;
if ($n > count($this->items[0])) {
if (preg_match('|
|iU',$this->raw,$matches)) {
$n=0;
$this->raw=implode('',file('http://www.xanga.com/' . $matches[1]));
$this->moveFirst();
return $this->moveNext();
} else {
return false;
}
} else {
return true;
}
}
function getISO8601Date($mydate) {
$thisdate=date('Y-m-d\TH:i:sO', strtotime($mydate));
return substr($thisdate,0,strlen($thisdate)-2) . ':' . substr($thisdate,strlen($thisdate)-2);
}
function replaceExtendedASCII($str) {
return str_replace('&','&',str_replace('"','"',str_replace('>','>',str_replace('<','<',htmlentities($str)))));
}
}
?>