diff options
author | Brion Vibber <brion@pobox.com> | 2009-11-30 08:09:30 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2009-11-30 09:12:19 -0800 |
commit | 10f40661a2f517393331b554c2fec295c8c160e8 (patch) | |
tree | 78e77eb9025463410ce4f45747081316315515d4 /plugins/TightUrl | |
parent | a2e4ac2fe857dbc6cfc55b2fb86f5f848f144b26 (diff) |
Ticket 1870: drop unnecessary Tidy module installation requirement.
Tidy was only being used by a couple of non-default URL shortener plugins,
PtitUrl and TightUrl. Both were easily changed to load the tag-soup HTML
via DOMDocument (using the default DOM module which is already used by
other dependencies).
Added xml, dom, and simplexml modules to the requirements check
in install.php, as they were being used but not checked for.
Also cleaned up LilUrl, PtitUrl, and TightUrl to return URL as a string
instead of as a SimpleXML node object.
Diffstat (limited to 'plugins/TightUrl')
-rw-r--r-- | plugins/TightUrl/TightUrlPlugin.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/TightUrl/TightUrlPlugin.php b/plugins/TightUrl/TightUrlPlugin.php index 56414c8c8..6ced9afdc 100644 --- a/plugins/TightUrl/TightUrlPlugin.php +++ b/plugins/TightUrl/TightUrlPlugin.php @@ -48,10 +48,13 @@ class TightUrlPlugin extends UrlShortenerPlugin { $response = $this->http_get(sprintf($this->serviceUrl,urlencode($url))); if (!$response) return; - $response = $this->tidy($response); - $y = @simplexml_load_string($response); + $dom = new DOMDocument(); + @$dom->loadHTML($response); + $y = @simplexml_import_dom($dom); if (!isset($y->body)) return; $xml = $y->body->p[0]->code[0]->a->attributes(); - if (isset($xml['href'])) return $xml['href']; + if (isset($xml['href'])) { + return strval($xml['href']); + } } } |