Stack2RSS 1.0
A simple web application that creates an RSS feed given an API route.

src/converters/badge_converter.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /// \file badge_converter.php Contains the conversion class for badge objects.
00004 
00005 // This class derives from Converter
00006 require_once 'converter.php';
00007 
00008 /// Provides conversion for badge objects
00009 class BadgeConverter extends Converter
00010 {
00011     protected function GetTitle($json_item)
00012     {
00013         return htmlentities($json_item['name']);
00014     }
00015     
00016     protected function GetDescription($json_item)
00017     {
00018         return htmlentities($json_item['description']) . "<br /><b>Awarded:</b> {$json_item['award_count']} time(s)";
00019     }
00020     
00021     protected function GetLink($json_item)
00022     {
00023         return "http://{$_GET['site']}/badges/{$json_item['badge_id']}";
00024     }
00025     
00026     protected function GetDate($json_item)
00027     {
00028         // Badges don't have a meaningful date, so just return the current date
00029         return date(DATE_RSS);
00030     }
00031 }
00032 
00033 ?>
 All Classes Files Functions Enumerations