X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FTightUrl%2FTightUrlPlugin.php;h=8fd645945b0f5577481697a61821acb03ea5b3bc;hb=6a2d38a0d7d914fc37df5d0204dd5adf0d72588d;hp=56414c8c8d121fe45ea23668e79a0bdf750c8df7;hpb=a42e128c1532c45fd930d98c985f9a8d98ff6868;p=quix0rs-gnu-social.git diff --git a/plugins/TightUrl/TightUrlPlugin.php b/plugins/TightUrl/TightUrlPlugin.php index 56414c8c8d..8fd645945b 100644 --- a/plugins/TightUrl/TightUrlPlugin.php +++ b/plugins/TightUrl/TightUrlPlugin.php @@ -22,7 +22,7 @@ * @category Plugin * @package StatusNet * @author Craig Andrews - * @copyright 2009 Craig Andrews http://candrews.integralblue.com + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -31,8 +31,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/plugins/UrlShortener/UrlShortenerPlugin.php'; - class TightUrlPlugin extends UrlShortenerPlugin { public $serviceUrl; @@ -48,10 +46,25 @@ 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']); + } + } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => sprintf('TightUrl (%s)', $this->shortenerName), + 'version' => STATUSNET_VERSION, + 'author' => 'Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:TightUrl', + 'rawdescription' => + sprintf(_m('Uses %1$s URL-shortener service.'), + $this->shortenerName)); + return true; } }