oembed: Better handling of unparsable oembed results (like youtube links

not allowed to embed).
This commit is contained in:
Grischa Brockhaus 2012-01-22 23:52:23 +01:00
parent 7b05e0d26d
commit d637d40d4e
3 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Version 1.05 (brockhaus)
-----------------------
* Better handling of unparsable oembed results (like youtube links not allowed to embed).
Version 1.04 (brockhaus)
-----------------------
* added css for iframe videos contributed by Matthias Mees

View file

@ -76,13 +76,21 @@ class OEmbedProvider extends EmbedProvider{
}
}
private function provideObject($url){
$xml = null;
if (!$this->onlyJson) {
$xml=simplexml_load_string($this->provideXML($url));
try {
$xml=simplexml_load_string($this->provideXML($url));
} catch (Exception $e) {
// something went wrong.
$xml = null;
}
}
else {
if (empty($xml)) {
$data=$this->provide($url);
if (!empty($data)) $xml = json_decode($data);
}
if (empty($xml)) return null;
//TODO $xml->type alapjan assigner
$obj = $this->getTypeObj((string)$xml->type);
$obj->cloneObj($xml);

View file

@ -30,7 +30,7 @@ class serendipity_event_oembed extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_OEMBED_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Grischa Brockhaus');
$propbag->add('version', '1.04');
$propbag->add('version', '1.05');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',