X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FPtitUrl%2FPtitUrlPlugin.php;h=ddba942e6d4ab7eb07a8b70306cf5e5f8849cae1;hb=663e4e02a1b3b1c104c2c3db19e524a486c3d981;hp=ef453e96d84e388903efa480b7eb923e030777f3;hpb=959d278c347fdf90e0227adc57c0215f5d82404a;p=quix0rs-gnu-social.git diff --git a/plugins/PtitUrl/PtitUrlPlugin.php b/plugins/PtitUrl/PtitUrlPlugin.php index ef453e96d8..ddba942e6d 100644 --- a/plugins/PtitUrl/PtitUrlPlugin.php +++ b/plugins/PtitUrl/PtitUrlPlugin.php @@ -47,11 +47,27 @@ class PtitUrlPlugin 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->center->table->tr->td->pre->a->attributes(); - if (isset($xml['href'])) return $xml['href']; + if (isset($xml['href'])) { + return strval($xml['href']); + } + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => sprintf('PtitUrl (%s)', $this->shortenerName), + 'version' => STATUSNET_VERSION, + 'author' => 'Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:PtitUrl', + 'rawdescription' => + sprintf(_m('Uses %1$s URL-shortener service.'), + $this->shortenerName)); + + return true; } }