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

src/converters/statistics_converter.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /// \file statistics_converter.php Contains the conversion class for statistics objects.
00004 
00005 // This class derives from Converter
00006 require_once 'converter.php';
00007 
00008 /// Provides conversion for statistics objects
00009 class StatisticsConverter extends Converter
00010 {
00011     protected function GetTitle($json_item)
00012     {
00013         return "Statistics for {$json_item['site']['name']}";
00014     }
00015     
00016     protected function GetDescription($json_item)
00017     {
00018 return <<<EOD
00019 <b>Total questions:</b> {$json_item['total_questions']}<br />
00020 <b>Total unanswered questions:</b> {$json_item['total_unanswered']}<br />
00021 <b>Total questions with accepted answers:</b> {$json_item['total_accepted']}<br />
00022 <b>Total answers:</b> {$json_item['total_answers']}<br />
00023 <b>Total comments:</b> {$json_item['total_comments']}<br />
00024 <b>Total votes cast:</b> {$json_item['total_votes']}<br />
00025 <b>Total badges earned:</b> {$json_item['total_badges']}<br />
00026 <b>Total users:</b> {$json_item['total_users']}<br />
00027 <b>Questions per minute:</b> {$json_item['questions_per_minute']}<br />
00028 <b>Answers per minute:</b> {$json_item['answers_per_minute']}<br />
00029 <b>Badges earned per minute:</b> {$json_item['badges_per_minute']}<br />
00030 <b>Views per day:</b> {$json_item['views_per_day']}<br />
00031 <b>API version:</b> {$json_item['api_version']['version']} (revision {$json_item['api_version']['revision']})
00032 EOD;
00033     }
00034     
00035     protected function GetLink($json_item)
00036     {
00037         return "http://{$_GET['site']}/";
00038     }
00039     
00040     protected function GetDate($json_item)
00041     {
00042         // Since date has no meaning, use the current date
00043         return date(DATE_RSS);
00044     }
00045 }
00046 
00047 ?>
 All Classes Files Functions Enumerations