Example #1
0
 public function rss()
 {
     // set headers
     Response::header('Content-Type', 'application/xml');
     // set content
     $xml = Rss::generate();
     // dump xml tree
     Response::content($xml);
 }
Example #2
0
 public static function generate()
 {
     // create a dom xml object
     static::$document = new DOMDocument('1.0', 'UTF-8');
     // create our rss feed
     $rss = static::element('rss', null, array('version' => '2.0'));
     static::$document->appendChild($rss);
     // create channel
     $channel = static::element('channel');
     $rss->appendChild($channel);
     // title
     $title = static::element('title', Config::get('metadata.sitename'));
     $channel->appendChild($title);
     // link
     $link = static::element('link', 'http://' . $_SERVER['HTTP_HOST']);
     $channel->appendChild($link);
     // description
     $description = static::element('description', Config::get('metadata.description'));
     $channel->appendChild($description);
     // articles
     $params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc');
     foreach (Posts::list_all($params) as $post) {
         $item = static::element('item');
         $channel->appendChild($item);
         // title
         $title = static::element('title', $post->title);
         $item->appendChild($title);
         // link
         $url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . IoC::resolve('posts_page')->slug . '/' . $post->slug;
         $link = static::element('link', $url);
         $item->appendChild($link);
         // description
         $description = static::element('description', $post->description);
         $item->appendChild($description);
         // date
         $date = static::element('pubDate', date(DATE_RSS, $post->created));
         $item->appendChild($date);
     }
     // dump xml tree
     Response::content(static::$document->saveXML());
 }
Example #3
0
 public static function remove()
 {
     $id = Input::post('id');
     $sql = "delete from comments where id = ?";
     $args = array($id);
     Db::query($sql, $args);
     $output = json_encode(array('result' => true));
     Response::content($output);
 }
Example #4
0
 public function build($file)
 {
     Response::header('Content-Type', 'application/json; charset=utf-8');
     Response::content(json_encode(Lang::get($file)));
 }
Example #5
0
 public static function remove()
 {
     $id = Input::post('id');
     Db::delete('comments', array('id' => $id));
     $output = json_encode(array('result' => true));
     Response::content($output);
 }
Example #6
0
<?php

Routes::get("/tiga-framework", function () {
    return Response::content("Welcome to Tiga!");
})->end();