Example #1
0
 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;
 }
Example #2
0
 public function AddItem()
 {
     $result = tnode::add($this->channel, 'item');
     $this->items[] = $result;
     return $result;
 }
Example #3
0
 public function AddRSSComment($comment, $title)
 {
     $link = litepublisher::$site->url . $comment->posturl . '#comment-' . $comment->id;
     $date = is_int($comment->posted) ? $comment->posted : strtotime($comment->posted);
     $item = $this->domrss->AddItem();
     tnode::addvalue($item, 'title', $title);
     tnode::addvalue($item, 'link', $link);
     tnode::addvalue($item, 'dc:creator', $comment->name);
     tnode::addvalue($item, 'pubDate', date('r', $date));
     tnode::addvalue($item, 'guid', $link);
     tnode::addcdata($item, 'description', strip_tags($comment->content));
     tnode::addcdata($item, 'content:encoded', $comment->content);
 }
 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);
 }