function replaceAllMedias($content) {
$openPos = strpos($content, '<EMBED');
while ($openPos !== false) {
$closePos = strpos($content, '</EMBED>', $openPos + 1) + strlen('</EMBED>');
$innerValue = substr($content, $openPos, $closePos - $openPos);
$media = '';
if (preg_match('@(http|mms)://media\\.youtube\\.com/.*?\\.(wma|mp3|wmv|flv)@i', $innerValue, $m)) {
$media = $m[0];
$media = str_replace('mms://', 'http://', $media);
$extension = strtolower($m[2]);
if ($extension == 'wmv' || $extension == 'flv') {
# download - process [video]
$customizeValue = '[VIDEO]' . $media . '[/VIDEO]';
} else {
# download - process [audio]
$customizeValue = '[AUDIO]' . $media . '[/AUDIO]';
}
} else {
$customizeValue = '';
}
$content = substr($content, 0, $openPos) . $customizeValue . substr($content, $closePos);
$openPos = strpos($content, '<EMBED');
}
return $content;
}
Title:
Replace All Medias
Description:
function replaceAllMedias($content) { $openPos = strpos($content, '<EMBED'); while ($openPos !== false) { $closePos = strp...
...
Rating:
4