diff options
Diffstat (limited to 'common/app/classes/PlanetItem.php')
-rw-r--r-- | common/app/classes/PlanetItem.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/common/app/classes/PlanetItem.php b/common/app/classes/PlanetItem.php new file mode 100644 index 0000000..039d0ca --- /dev/null +++ b/common/app/classes/PlanetItem.php @@ -0,0 +1,27 @@ +<?php + +/** + * Planet item + */ + +class PlanetItem +{ + public function __construct($feed, $data) + { + parent::SimplePie_Item($feed, $data); + } + + public function compare($item1, $item2) + { + $item1_date = $item1->get_date('U'); + $item2_date = $item2->get_date('U'); + + if ($item1_date == $item2_date) { + return 0; + } elseif ($item1_date < $item2_date) { + return 1; + } + + return -1; + } +} |