X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/c133c5d67b7d4130b8ec5aec3b972a865d4705ff..8c743376a7e7eab3714e5aa4300e34fa3dd89415:/tweeper.php diff --git a/tweeper.php b/tweeper.php index 7630e0a..f1a4ba9 100644 --- a/tweeper.php +++ b/tweeper.php @@ -44,30 +44,30 @@ class Tweeper { /** * Convert numeric Epoch to the date format expected in a RSS document. */ - public static function epoch_to_gmdate($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 str_to_gmdate($date) { + public static function strToRssDate($date) { $timestamp = strtotime($date); if (FALSE === $timestamp) { $timestamp = 0; } - return Tweeper::epoch_to_gmdate($timestamp); + return Tweeper::epochToRssDate($timestamp); } /** * Get the contents from a URL. */ - private static function getContents($url) { + private static function getUrlContents($url) { $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_HEADER => FALSE, @@ -88,7 +88,7 @@ class Tweeper { /** * Get the headers from a URL. */ - private static function getInfo($url) { + private static function getUrlInfo($url) { $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_HEADER => TRUE, @@ -133,7 +133,7 @@ class Tweeper { // See http://sourceforge.net/p/feedvalidator/bugs/72/ $http_url = preg_replace("/^https/", "http", $url); - $url_info = Tweeper::getInfo($http_url); + $url_info = Tweeper::getUrlInfo($http_url); $supported = in_array($url_info['content_type'], $supported_content_types); if (!$supported) { @@ -196,7 +196,7 @@ class Tweeper { return NULL; } - $stylesheet_contents = $this->getContents($stylesheet); + $stylesheet_contents = $this->getUrlContents($stylesheet); $xslDoc = new DOMDocument(); $xslDoc->loadXML($stylesheet_contents); @@ -310,7 +310,7 @@ class Tweeper { return NULL; } - $html = $this->getContents($src_url); + $html = $this->getUrlContents($src_url); if (FALSE === $html) { return NULL; } @@ -413,15 +413,15 @@ function parse_options_query_string() { if (is_cli()) { $options = parse_options_cli($argv, $argc); - $ERROR_STREAM = fopen('php://stderr', 'w'); + $error_stream = fopen('php://stderr', 'w'); } else { $options = parse_options_query_string(); - $ERROR_STREAM = fopen('php://output', 'w'); + $error_stream = fopen('php://output', 'w'); } if (!isset($options['src_url'])) { - fwrite($ERROR_STREAM, usage(is_cli() ? $argv : NULL)); + fwrite($error_stream, usage(is_cli() ? $argv : NULL)); exit(1); }