public function request($arg) { $site = litepublisher::$site; $s = '<?php turlmap::sendxml(); ?>'; switch ($arg) { case 'manifest': $s .= '<manifest xmlns="http://schemas.microsoft.com/wlw/manifest/weblog">' . '<options>' . '<clientType>WordPress</clientType>' . '<supportsKeywords>Yes</supportsKeywords>' . '<supportsGetTags>Yes</supportsGetTags>' . '<supportsNewCategories>Yes</supportsNewCategories>' . '</options>' . '<weblog>' . '<serviceName>Lite Publisher</serviceName>' . "<homepageLinkText>{$site->name}</homepageLinkText>" . "<adminLinkText>{$site->name}</adminLinkText>" . "<adminUrl>{$site->url}/admin/</adminUrl>" . '<postEditingUrl>' . "<![CDATA[{$site->url}/admin/posts/editor/{$site->q}id={post-id}]]>" . '</postEditingUrl>' . '</weblog>' . '<buttons>' . '<button>' . '<id>0</id>' . '<text>Manage Comments</text>' . '<imageUrl>/favicon.ico</imageUrl>' . '<clickUrl>' . "<![CDATA[{$site->url}/admin/comments/]]>" . '</clickUrl>' . '</button>' . '</buttons>' . '</manifest>'; break; case 'rsd': /* $s .= '<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">' . '<service>' . '<engineName>Lite Publisher</engineName>' . '<engineLink>http://litepublisher.com/</engineLink>' . "<homePageLink>$site->url/</homePageLink>" . '<apis>' . '<api name="WordPress" blogID="1" preferred="true" apiLink="' . $site->url . '/rpc.xml" />' . '<api name="Movable Type" blogID="1" preferred="false" apiLink="' . $site->url . '/rpc.xml" />' . '<api name="MetaWeblog" blogID="1" preferred="false" apiLink="' . $site->url . '/rpc.xml" />' . '<api name="Blogger" blogID="1" preferred="false" apiLink="' . $site->url . '/rpc.xml" />' . '</apis>' . '</service>' . '</rsd>'; */ $dom = new domDocument(); $dom->encoding = 'utf-8'; $rsd = $dom->createElement('rsd'); $dom->appendChild($rsd); tnode::attr($rsd, 'version', '1.0'); tnode::attr($rsd, 'xmlns', 'http://archipelago.phrasewise.com/rsd'); $service = tnode::add($rsd, 'service'); tnode::addvalue($service, 'engineName', 'LitePublisher'); tnode::addvalue($service, 'engineLink', 'http://litepublisher.com/'); tnode::addvalue($service, 'homePageLink', litepublisher::$site->url . '/'); $apis = tnode::add($service, 'apis'); $api = tnode::add($apis, 'api'); tnode::attr($api, 'name', 'WordPress'); tnode::attr($api, 'blogID', '1'); tnode::attr($api, 'preferred', 'true'); tnode::attr($api, 'apiLink', litepublisher::$site->url . '/rpc.xml'); $api = tnode::add($apis, 'api'); tnode::attr($api, 'name', 'Movable Type'); tnode::attr($api, 'blogID', '1'); tnode::attr($api, 'preferred', 'false'); tnode::attr($api, 'apiLink', litepublisher::$site->url . '/rpc.xml'); $api = tnode::add($apis, 'api'); tnode::attr($api, 'name', 'MetaWeblog'); tnode::attr($api, 'blogID', '1'); tnode::attr($api, 'preferred', 'false'); tnode::attr($api, 'apiLink', litepublisher::$site->url . '/rpc.xml'); $api = tnode::add($apis, 'api'); tnode::attr($api, 'name', 'Blogger'); tnode::attr($api, 'blogID', '1'); tnode::attr($api, 'preferred', 'false'); tnode::attr($api, 'apiLink', litepublisher::$site->url . '/rpc.xml'); $xml = $dom->saveXML(); $s .= substr($xml, strpos($xml, '?>') + 2); break; } return $s; }
public function CreateRootMultimedia($url, $title) { $this->encoding = 'utf-8'; $this->appendChild($this->createComment('generator="Lite Publisher/' . litepublisher::$options->version . ' version"')); $this->rss = $this->createElement('rss'); $this->appendChild($this->rss); tnode::attr($this->rss, 'version', '2.0'); tnode::attr($this->rss, 'xmlns:media', 'http://video.search.yahoo.com/mrss'); tnode::attr($this->rss, 'xmlns:atom', 'http://www.w3.org/2005/Atom'); $this->channel = tnode::add($this->rss, 'channel'); $link = tnode::add($this->channel, 'atom:link'); tnode::attr($link, 'href', $url); tnode::attr($link, 'rel', 'self'); tnode::attr($link, 'type', 'application/rss+xml'); tnode::addvalue($this->channel, 'title', $title); tnode::addvalue($this->channel, 'link', $url); tnode::addvalue($this->channel, 'description', litepublisher::$site->description); tnode::addvalue($this->channel, 'pubDate', date('r')); tnode::addvalue($this->channel, 'generator', 'http://litepublisher.com/generator.htm?version=' . litepublisher::$options->version); tnode::addvalue($this->channel, 'language', 'en'); }
public function addpost(tpost $post) { $item = $this->domrss->AddItem(); tnode::addvalue($item, 'title', $post->title); tnode::addvalue($item, 'link', $post->link); tnode::addvalue($item, 'comments', $post->link . '#comments'); tnode::addvalue($item, 'pubDate', $post->pubdate); $guid = tnode::addvalue($item, 'guid', $post->link); tnode::attr($guid, 'isPermaLink', 'true'); if (class_exists('tprofile')) { $profile = tprofile::i(); tnode::addvalue($item, 'dc:creator', $profile->nick); } else { tnode::addvalue($item, 'dc:creator', 'admin'); } $categories = tcategories::i(); $names = $categories->getnames($post->categories); foreach ($names as $name) { if (empty($name)) { continue; } tnode::addcdata($item, 'category', $name); } $tags = ttags::i(); $names = $tags->getnames($post->tags); foreach ($names as $name) { if (empty($name)) { continue; } tnode::addcdata($item, 'category', $name); } $content = ''; $this->callevent('beforepost', array($post->id, &$content)); if ($this->template == '') { $content .= $post->replacemore($post->rss, true); } else { $content .= ttheme::parsevar('post', $post, $this->template); } $this->callevent('afterpost', array($post->id, &$content)); tnode::addcdata($item, 'content:encoded', $content); tnode::addcdata($item, 'description', strip_tags($content)); tnode::addvalue($item, 'wfw:commentRss', $post->rsscomments); if (count($post->files) > 0) { $files = tfiles::i(); $files->loaditems($post->files); foreach ($post->files as $idfile) { $file = $files->getitem($idfile); $enclosure = tnode::add($item, 'enclosure'); tnode::attr($enclosure, 'url', litepublisher::$site->files . '/files/' . $file['filename']); tnode::attr($enclosure, 'length', $file['size']); tnode::attr($enclosure, 'type', $file['mime']); } } $post->onrssitem($item); $this->onpostitem($item, $post); return $item; }
public function addfile($id) { $files = tfiles::i(); $file = $files->getitem($id); $posts = $files->itemsposts->getposts($id); if (count($posts) == 0) { $postlink = litepublisher::$site->url . '/'; } else { $post = tpost::i($posts[0]); $postlink = $post->link; } $item = $this->domrss->AddItem(); tnode::addvalue($item, 'title', $file['title']); tnode::addvalue($item, 'link', $postlink); tnode::addvalue($item, 'pubDate', $file['posted']); $media = tnode::add($item, 'media:content'); tnode::attr($media, 'url', $files->geturl($id)); tnode::attr($media, 'fileSize', $file['size']); tnode::attr($media, 'type', $file['mime']); tnode::attr($media, 'medium', $file['media']); tnode::attr($media, 'expression', 'full'); if ($file['width'] > 0 && $file['height'] > 0) { tnode::attr($media, 'height', $file['height']); tnode::attr($media, 'width', $file['width']); } /* if (!empty($file['bitrate'])) tnode::attr($media, 'bitrate', $file['bitrate']); if (!empty($file['framerate'])) tnode::attr($media, 'framerate', $file['framerate']); if (!empty($file['samplingrate'])) tnode::attr($media, 'samplingrate', $file['samplingrate']); if (!empty($file['channels'])) tnode::attr($media, 'channels', $file['channels']); if (!empty($file['duration'])) tnode::attr($media, 'duration', $file['duration']); */ $hash = tnode::addvalue($item, 'media:hash', self::hashtomd5($file['hash'])); tnode::attr($hash, 'algo', "md5"); if (!empty($file['keywords'])) { tnode::addvalue($item, 'media:keywords', $file['keywords']); } if (!empty($file['description'])) { $description = tnode::addvalue($item, 'description', $file['description']); tnode::attr($description, 'type', 'html'); } if ($file['preview'] > 0) { $idpreview = $file['preview']; $preview = $files->getitem($idpreview); $thumbnail = tnode::add($item, 'media:thumbnail'); tnode::attr($thumbnail, 'url', $files->geturl($idpreview)); if ($preview['width'] > 0 && $preview['height'] > 0) { tnode::attr($thumbnail, 'height', $preview['height']); tnode::attr($thumbnail, 'width', $preview['width']); } } $this->onitem($item, $file); }