2008-09-12 04:09:13 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class TrackBackDecorator extends DataObjectDecorator {
|
2009-05-20 07:37:30 +02:00
|
|
|
function extraStatics() {
|
2008-09-12 04:09:13 +02:00
|
|
|
return array(
|
|
|
|
'has_many' => array(
|
|
|
|
'TrackBacks' => 'TrackBackPing'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateMetaTags(&$tags) {
|
|
|
|
$tags .= $this->owner->renderWith('TrackBackRdf');
|
|
|
|
}
|
|
|
|
|
|
|
|
function TrackBackPingLink() {
|
|
|
|
return $this->owner->AbsoluteLink() . 'trackbackping';
|
|
|
|
}
|
|
|
|
|
2009-07-28 07:33:22 +02:00
|
|
|
function decoratedTrackbackping() {
|
2008-09-12 04:09:13 +02:00
|
|
|
$error = 0;
|
|
|
|
$message = '';
|
|
|
|
|
|
|
|
if(!(isset($_POST['url']) && $_POST['url'])) {
|
|
|
|
$error = 1;
|
|
|
|
$message = 'Missing required POST parameter \'url\'.';
|
|
|
|
} else {
|
|
|
|
$trackbackping = new TrackBackPing();
|
|
|
|
$trackbackping->Url = $_POST['url'];
|
|
|
|
if(isset($_POST['title']) && $_POST['title']) {
|
|
|
|
$trackbackping->Title = $_POST['title'];
|
|
|
|
}
|
|
|
|
if(isset($_POST['excerpt']) && $_POST['excerpt']) {
|
|
|
|
$trackbackping->Excerpt = $_POST['excerpt'];
|
|
|
|
}
|
|
|
|
if(isset($_POST['blog_name']) && $_POST['blog_name']) {
|
|
|
|
$trackbackping->BlogName = $_POST['blog_name'];
|
|
|
|
}
|
|
|
|
$trackbackping->PageID = $this->owner->ID;
|
|
|
|
$trackbackping->write();
|
|
|
|
}
|
|
|
|
|
|
|
|
$returnData = new ArrayData(array(
|
|
|
|
'Error' => $error,
|
|
|
|
'Message' => $message
|
|
|
|
));
|
|
|
|
|
|
|
|
return $returnData->renderWith('TrackBackPingReturn');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|