Changeset 4536
- Timestamp:
- 02/02/12 10:46:07 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/branches/1.5/lib/model/doctrine/PluginaMediaItem.class.php
r4503 r4536 278 278 public function getEmbedCode($width, $height, $resizeType, $format = 'jpg', $absolute = false, $wmode = 'opaque', $autoplay = false, $options = array()) 279 279 { 280 $embeddable = $this->getEmbeddable(); 281 $service = null; 282 // A little bit of refactoring to avoid instantiating the service twice. 283 // We need an embed service to handle anything embeddable with a service URL, so 284 // check early 285 if ($embeddable && strlen($this->service_url)) 286 { 287 $service = aMediaTools::getEmbedService($this->service_url); 288 if (!$service) 289 { 290 // Most likely explanation: this service was configured, now it's not. 291 // Don't crash 292 return '<div>Video Service Not Available</div>'; 293 } 294 } 295 280 296 if ($height === false) 281 297 { … … 284 300 { 285 301 // Not known yet. This comes up when previewing a video with a service URL that we haven't saved yet 286 if ( $this->service_url)302 if (isset($service)) 287 303 { 288 $service = aMediaTools::getEmbedService($this->service_url);289 304 $thumbnail = $service->getThumbnail($service->getIdFromUrl($this->service_url)); 290 305 if ($thumbnail) … … 311 326 $title = aHtml::entities($this->getTitle()); 312 327 } 313 if ($this->getEmbeddable()) 314 { 315 if ($this->service_url) 316 { 317 $service = aMediaTools::getEmbedService($this->service_url); 318 if (!$service) 319 { 320 // Most likely explanation: this service was configured, now it's not. 321 // Don't crash 322 return '<div>Video Service Not Available</div>'; 323 } 328 if ($embeddable) 329 { 330 if ($service) 331 { 324 332 return $service->embed($service->getIdFromUrl($this->service_url), $width, $height, $title, $wmode, $autoplay); 325 333 }

