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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | emfield.patch | 478 bytes | noomz |
Comments
Comment #1
alex ua commentedIs this still a problem in the 5.x-dev version? If so, would you mind rolling a patch?
Comment #2
InterceptPoint commentedAbhay 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?
Comment #3
matkeane commentedIn 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.
Comment #4
noomz commentedJust modified that line of regex, removed the space and it works. I've attached a little patch.
Comment #5
abhay.gupta commentedNot 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;
}
Comment #6
alex ua commentedThis 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.
Comment #7
alex ua commentedThis 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...