| 1 |
<?php |
<?php |
| 2 |
// $Id: emfield.module,v 1.12.4.44 2009/10/05 19:05:10 aaron Exp $ |
// $Id: emfield.module,v 1.12.4.45 2009/10/20 17:11:48 aaron Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 146 |
function emfield_parse_embed($field, $embed = '', $module) { |
function emfield_parse_embed($field, $embed = '', $module) { |
| 147 |
$providers = emfield_allowed_providers($field, $module); |
$providers = emfield_allowed_providers($field, $module); |
| 148 |
foreach ($providers as $provider) { |
foreach ($providers as $provider) { |
| 149 |
$success = emfield_include_invoke($module, $provider->name, 'extract', $embed, $field); |
$success = emfield_include_invoke($module, $provider->name, 'extract', trim($embed), $field); |
| 150 |
|
|
| 151 |
// We've been given an array of regex strings, so try to find a match. |
// We've been given an array of regex strings, so try to find a match. |
| 152 |
if (is_array($success)) { |
if (is_array($success)) { |
| 153 |
foreach ($success as $regex) { |
foreach ($success as $regex) { |
| 154 |
$matches = NULL; |
$matches = NULL; |
| 155 |
if (preg_match($regex, $embed, $matches)) { |
if (preg_match($regex, trim($embed), $matches)) { |
| 156 |
return array('provider' => $provider->name, 'value' => $matches[1]); |
return array('provider' => $provider->name, 'value' => $matches[1]); |
| 157 |
} |
} |
| 158 |
} |
} |