When trying to save custom URL, it return the message "You have specified an invalid media URL or embed code". This should not happen because the URL is right and it points to a video on the domain that is not already supported in the "Embedded Video Field".

After much struggling with the code, I realized that the function `video_cck_zzz_custom_url_extract()` in folder "emfield/contrib/video_cck/providers/zzz_custom_url.inc" is incorrect. There were the following 2 issues:

1. The condition in preg_match is incorrect. There should be no spacing between "@\" and ".(". It should read: '@\.('. $types .')@i'

2. The $embed parameter passed to this function is an array type rather than string.

I managed to fix the above 2 errors for my installation and now the code works perfectly for custom URLs.

Regards,
Abhay

CommentFileSizeAuthor
#4 emfield.patch478 bytesnoomz

Comments

alex ua’s picture

Is this still a problem in the 5.x-dev version? If so, would you mind rolling a patch?

InterceptPoint’s picture

Abhay wrote: "The $embed parameter passed to this function is an array type rather than string."

I would settle for the code changes necessary to account for the string vs. array type problem. What was the exact code change?

matkeane’s picture

In addition to the preg_match change on line 51, I changed line 49 from:
function video_cck_zzz_custom_url_extract($embed = '') {
to
function video_cck_zzz_custom_url_extract($embed = array()) {

... and it seems to be working OK.

noomz’s picture

Status: Active » Needs review
StatusFileSize
new478 bytes

Just modified that line of regex, removed the space and it works. I've attached a little patch.

abhay.gupta’s picture

Not very sure if the above change will work correctly because it will be needed to run PHP array_shift() on $embed before it is used in the preg_match() statement below.

This is how I had changed the function:

function video_cck_zzz_custom_url_extract($embed = '') {
$types = _video_cck_zzz_custom_url_implode_types();
if (is_array($embed)) {
$embed = array_shift($embed);
}
if (preg_match('@\.('. $types .')@i', $embed, $matches)) {
return $embed;
}
return false;
}

alex ua’s picture

Version: 5.x-1.3 » 5.x-1.x-dev
Status: Needs review » Patch (to be ported)

This doesn't seem to be an issue in 6.x, so I'll have to look into this when I go through the 5.x patches.

alex ua’s picture

Status: Patch (to be ported) » Closed (fixed)

This issue has been quiet for the past 1.5 years, so I'm going to close this. Please only open this issue back up if you are offering to patch the 5.x version...