$extra_params = $matches[2];
} else if (preg_match("/watch\?v=(.*)/",$url,$matches)) {
$video_id = $matches[1];
+ } else if (preg_match("/v\/(.*)/",$url,$matches)) {
+ $video_id = $matches[1];
} else {
return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__,
"Unable to extract video id from url: $url"),null,null);
if(preg_match('/thumbnail url="(.+?)"/',$video_info, $matches)) {
$thumbnail = $matches[1];
} else {
- return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
- "Unable to extract thumbnail information from url: $url"),NULL,NULL);
+ /*
+ * Set the thumbnail to some generic jpg image,
+ * since we can't extract it from the site.
+ * If no parameter is set, set it to a default value.
+ */
+ if(preg_match("/\w+/", $flvThumbnail)) {
+ $thumbnail = $flvThumbnail;
+ } else {
+ $thumbnail = $gallery2_url.$gallery2_flv_thumbnail;
+ }
}
/* Format the description to hold a reference to the embedded video */
- if(preg_match('/(<embed src.+?\/embed>)/', $contents, $matches)) {
+ if(preg_match('/(<embed src.+?\/embed>)/', $contents, $matches) ||
+ preg_match('/(<embed src.+?\/object>)/', $contents, $matches)) {
$description=$matches[1];
$description=preg_replace("/"/","'",$description);
$description=preg_replace("/</","<",$description);
/*
**********************************
- * Embed a remote .flv file
+ * Embed a remote .flv or .mp4 file
**********************************
*/
- } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches)) {
-
+ } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches) ||
+ preg_match("/.*\/(.+?)\.mp4/i",$url,$matches)) {
+
/* Set the title and summary to the name of the file */
$title = $matches[1];
$summary = $matches[1];
$this->setId('embedvideo');
$this->setName($gallery->i18n('Embed Video'));
$this->setDescription($gallery->i18n('Add embedded videos from the web'));
- $this->setVersion('1.1.0');
+ $this->setVersion('1.1.1');
$this->setGroup('import', $gallery->i18n('Import'));
$this->setCallbacks('getSiteAdminViews');
$this->setRequiredCoreApi(array(7, 3));