/** * Create an Video object from XML * * @static * @param SimpleXMLElement $xml * @return phpOpenNOS\Model\Video */ public static function fromXML(\SimpleXMLElement $xml) { $video = new Video(); $video->setId((int) $xml->id); $video->setTitle((string) $xml->title); $video->setDescription((string) $xml->description); $video->setPublished((string) $xml->published); $video->setLastUpdate((string) $xml->last_update); $video->setThumbnailXS((string) $xml->thumbnail_xs); $video->setThumbnailS((string) $xml->thumbnail_s); $video->setThumbnailM((string) $xml->thumbnail_m); $video->setLink((string) $xml->link); $video->setEmbedCode((string) $xml->embedcode); $keywords = array(); foreach ($xml->keywords->keyword as $keyword) { $keywords[] = (string) $keyword; } $video->setKeywords($keywords); return $video; }
public function testEmbedCode() { $audio = new Video(); $audio->setEmbedCode('<object width="550" height="309"><param name="movie" value="http://s.nos.nl/swf/embed/nos_partner_video.swf?tcmid=tcm-5-870642&platform=open&partner=speeltuin"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowfullscreen" value="true"></param><embed src="http://s.nos.nl/swf/embed/nos_partner_video.swf?tcmid=tcm-5-870642&platform=open&partner=speeltuin" type="application/x-shockwave-flash" wmode="transparent" width="550" height="309" allowfullscreen="true" allowScriptAccess="always"></embed></object>'); $this->assertEquals($audio->getEmbedCode(), '<object width="550" height="309"><param name="movie" value="http://s.nos.nl/swf/embed/nos_partner_video.swf?tcmid=tcm-5-870642&platform=open&partner=speeltuin"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowfullscreen" value="true"></param><embed src="http://s.nos.nl/swf/embed/nos_partner_video.swf?tcmid=tcm-5-870642&platform=open&partner=speeltuin" type="application/x-shockwave-flash" wmode="transparent" width="550" height="309" allowfullscreen="true" allowScriptAccess="always"></embed></object>'); }