Esempio n. 1
0
 public function onRun()
 {
     $this->posts = $this->page['posts'] = $this->loadPosts();
     $this->feedBurnerAddress = $this->page['feedBurnerAddress'] = $this->property('feedBurnerAddress');
     $this->defaultText = $this->page['defaultText'] = $this->property('defaultText');
     $this->iconClass = $this->page['iconClass'] = $this->property('iconClass');
     $this->defaultRssLink = $this->page['defaultRssLink'] = Settings::get('link') . "/rss.xml";
     $this->feedBurnerLink = $this->page['feedBurnerLink'] = "http://feeds.feedburner.com/" . $this->feedBurnerAddress;
 }
Esempio n. 2
0
 protected function createRss()
 {
     $fileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n" . "\t<channel>\n" . "\t\t<title>" . Settings::get('title') . "</title>\n" . "\t\t<link>" . Settings::get('link') . "</link>\n" . "\t\t<description>" . Settings::get('description') . "</description>\n" . "\t\t<atom:link href=\"" . Settings::get('link') . "/rss.xml\" rel=\"self\" type=\"application/rss+xml\" />\n\n";
     foreach ($this->loadPosts() as $post) {
         $published = DateTime::createFromFormat('Y-m-d H:i:s', $post->published_at);
         $description = Settings::get('showFullPostContent') ? $post->content : $post->excerpt;
         $description = Markdown::parse(trim($description));
         $fileContents .= "\t\t<item>\n" . "\t\t\t<title>" . $post->title . "</title>\n" . "\t\t\t<link>" . Settings::get('link') . Settings::get('postPage') . "/" . $post->slug . "</link>\n" . "\t\t\t<guid>" . Settings::get('link') . Settings::get('postPage') . "/" . $post->slug . "</guid>\n" . "\t\t\t<pubDate>" . $published->format(DateTime::RFC2822) . "</pubDate>\n" . "\t\t\t<description>" . htmlspecialchars($description, ENT_QUOTES, 'UTF-8') . "</description>\n" . "\t\t</item>\n";
     }
     $fileContents .= "\t</channel>\n";
     $fileContents .= "</rss>\n";
     $file = File::put('rss.xml', $fileContents);
     return $file;
 }