Stack2RSS 1.0
A simple web application that creates an RSS feed given an API route.
|
00001 <?php 00002 00003 /// \file user_converter.php Contains the conversion class for user objects. 00004 00005 // This class derives from Converter 00006 require_once 'converter.php'; 00007 00008 /// Provides conversion for user objects 00009 class UserConverter extends Converter 00010 { 00011 protected function GetTitle($json_item) 00012 { 00013 $mod = ($json_item['user_type'] == 'moderator')?'♦':''; 00014 00015 return "{$json_item['display_name']}{$mod} - {$json_item['reputation']}"; 00016 } 00017 00018 protected function GetDescription($json_item) 00019 { 00020 return <<<EOD 00021 <b>Age:</b> {$json_item['age']}<br /> 00022 <b>Location:</b> {$json_item['location']}<br /> 00023 {$json_item['about_me']} 00024 EOD; 00025 } 00026 00027 protected function GetLink($json_item) 00028 { 00029 return "http://{$_GET['site']}/users/{$json_item['user_id']}"; 00030 } 00031 00032 protected function GetDate($json_item) 00033 { 00034 return date(DATE_RSS, $json_item['creation_date']); 00035 } 00036 } 00037 00038 ?>