From: Antonio Ospite Date: Tue, 17 May 2016 21:28:45 +0000 (+0200) Subject: Use more accurate names for the date conversion functions X-Git-Tag: v0.6~35 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/76afa982386da83e9542278ad3ea736d2fd486ff?ds=sidebyside Use more accurate names for the date conversion functions The new names are epochToRssDate and strToRssDate. Don't refer to gmdate() in the function names, this is just an implementation detail which should not have leaked into the external interface, instead mention RssDate in the function names to communicate something about the output they produce. Also, while at it, user the DATE_RSS format when calling gmdate(). --- diff --git a/rss_converter_dilbert.com.xsl b/rss_converter_dilbert.com.xsl index b7f9fbf..ce7075f 100644 --- a/rss_converter_dilbert.com.xsl +++ b/rss_converter_dilbert.com.xsl @@ -67,7 +67,7 @@ - + <![CDATA[ diff --git a/rss_converter_facebook.com.xsl b/rss_converter_facebook.com.xsl index ecbd18c..89cc67d 100644 --- a/rss_converter_facebook.com.xsl +++ b/rss_converter_facebook.com.xsl @@ -85,7 +85,7 @@ - + diff --git a/rss_converter_howtoons.com.xsl b/rss_converter_howtoons.com.xsl index 7c34729..403b9ac 100644 --- a/rss_converter_howtoons.com.xsl +++ b/rss_converter_howtoons.com.xsl @@ -57,7 +57,7 @@ - + <![CDATA[ diff --git a/rss_converter_instagram.com.xsl b/rss_converter_instagram.com.xsl index 9122315..5a64a57 100644 --- a/rss_converter_instagram.com.xsl +++ b/rss_converter_instagram.com.xsl @@ -79,7 +79,7 @@ - + <![CDATA[ diff --git a/rss_converter_pump.io.xsl b/rss_converter_pump.io.xsl index 95abf3e..c505a50 100644 --- a/rss_converter_pump.io.xsl +++ b/rss_converter_pump.io.xsl @@ -46,7 +46,7 @@ - + diff --git a/rss_converter_twitter.com.xsl b/rss_converter_twitter.com.xsl index 59c29bb..0701d5c 100644 --- a/rss_converter_twitter.com.xsl +++ b/rss_converter_twitter.com.xsl @@ -54,7 +54,7 @@ - + diff --git a/tweeper.php b/tweeper.php index fdf6e5c..3e250b7 100644 --- a/tweeper.php +++ b/tweeper.php @@ -44,24 +44,24 @@ class Tweeper { /** * Convert numeric Epoch to the date format expected in a RSS document. */ - public static function epochToGmdate($timestamp) { + public static function epochToRssDate($timestamp) { if (!is_numeric($timestamp) || is_nan($timestamp)) { $timestamp = 0; } - return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT'; + return gmdate(DATE_RSS, $timestamp); } /** * Convert generic date string to the date format expected in a RSS document. */ - public static function strToGmdate($date) { + public static function strToRssDate($date) { $timestamp = strtotime($date); if (FALSE === $timestamp) { $timestamp = 0; } - return Tweeper::epochToGmdate($timestamp); + return Tweeper::epochToRssDate($timestamp); } /**