itemsPerPage();
// Get the list of public pages (sticky and static included)
$list = $pages->getList(
$pageNumber = 1,
$numberOfItems,
$published = true,
$static = true,
$sticky = true,
$draft = false,
$scheduled = false
);
$xml = '';
$xml .= '';
$xml .= '' . $site->title() . '';
$xml .= '' . $site->description() . '';
$xml .= '';
$xml .= '' . date(DATE_RSS) . '';
// Get keys of pages
foreach ($list as $pageKey) {
try {
// Create the page object from the page key
$page = new Page($pageKey);
$imagepath = parse_url($page->coverImage(true), PHP_URL_PATH);
$imagepath = $_SERVER['DOCUMENT_ROOT'] . $imagepath;
$xml .= '';
$xml .= '' . $page->title() . '';
$xml .= '';
$xml .= '';
$xml .= ''.strip_tags( $page->contentBreak() ).'';
$xml .= '' . date(DATE_RSS, strtotime($page->getValue('dateRaw'))) . '';
$xml .= 'urn:uuid:' . $page->uuid() . '';
$xml .= '';
$xml .= ''.$page->user('nickname').'';
$xml .= '';
$xml .= '';
} catch (Exception $e) {
// Continue
}
}
$xml .= '';
// New DOM document
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->loadXML($xml);
return $doc->save($this->workspace() . 'atom.xml');
}
public function install($position = 0)
{
parent::install($position);
return $this->createXML();
}
public function post()
{
parent::post();
return $this->createXML();
}
public function afterPageCreate()
{
$this->createXML();
}
public function afterPageModify()
{
$this->createXML();
}
public function afterPageDelete()
{
$this->createXML();
}
public function siteHead()
{
return '' . PHP_EOL;
}
public function beforeAll()
{
$webhook = 'atom.xml';
if ($this->webhook($webhook)) {
// Send XML header
header('Content-type: text/xml');
$doc = new DOMDocument();
// Load XML
libxml_disable_entity_loader(false);
$doc->load($this->workspace() . 'atom.xml');
libxml_disable_entity_loader(true);
// Print the XML
echo $doc->saveXML();
// Stop Koblog execution
exit(0);
}
}
}