From: Antonio Ospite Date: Wed, 18 May 2016 10:10:15 +0000 (+0200) Subject: tweeper.php: move the loadStylesheet() method more down in the file X-Git-Tag: v0.6~28 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/51b8e3315ebbe93d4043e7300c29089744c9b7de?ds=sidebyside tweeper.php: move the loadStylesheet() method more down in the file This way all static methods are grouped together before non-static methods. --- diff --git a/tweeper.php b/tweeper.php index bb2db0d..d84094e 100644 --- a/tweeper.php +++ b/tweeper.php @@ -196,29 +196,6 @@ class Tweeper { } /** - * Load a stylesheet if the web site is supported. - */ - private function loadStylesheet($host) { - $stylesheet = "file://" . __DIR__ . "/rss_converter_" . $host . ".xsl"; - if (FALSE === file_exists($stylesheet)) { - trigger_error("Conversion to RSS not supported for $host ($stylesheet not found)", E_USER_ERROR); - return NULL; - } - - $stylesheet_contents = Tweeper::getUrlContents($stylesheet); - - $xslDoc = new DOMDocument(); - $xslDoc->loadXML($stylesheet_contents); - - $xsltProcessor = new XSLTProcessor(); - $xsltProcessor->registerPHPFunctions(); - $xsltProcessor->setParameter('', 'generate-enclosure', $this->generate_enclosure); - $xsltProcessor->importStylesheet($xslDoc); - - return $xsltProcessor; - } - - /** * Convert json to XML. */ private static function jsonToXml($json, $root_node_name) { @@ -302,6 +279,29 @@ class Tweeper { } /** + * Load a stylesheet if the web site is supported. + */ + private function loadStylesheet($host) { + $stylesheet = "file://" . __DIR__ . "/rss_converter_" . $host . ".xsl"; + if (FALSE === file_exists($stylesheet)) { + trigger_error("Conversion to RSS not supported for $host ($stylesheet not found)", E_USER_ERROR); + return NULL; + } + + $stylesheet_contents = Tweeper::getUrlContents($stylesheet); + + $xslDoc = new DOMDocument(); + $xslDoc->loadXML($stylesheet_contents); + + $xsltProcessor = new XSLTProcessor(); + $xsltProcessor->registerPHPFunctions(); + $xsltProcessor->setParameter('', 'generate-enclosure', $this->generate_enclosure); + $xsltProcessor->importStylesheet($xslDoc); + + return $xsltProcessor; + } + + /** * Convert the site content to RSS. */ public function tweep($src_url) {