© Сделано на LiveStreet
Дизайн - ©2009 MODx RED Group
function preg_noindex($matches) {
if(strpos($matches[2],'http')===false && strpos($matches[2],'ftp')===false ){
return $matches[0];
}else{
$arg=str_replace('rel="nofollow"','',$matches[1]);
return '<noindex><img rel="nofollow" '.$arg.'href='.$matches[2].'>
'.$matches[3].'></noindex>' ;
}
}
$modx->documentObject['content'] = preg_replace_callback(
'@<img([^<]+)href=([^<]+)>(.*)>@Ui', "preg_noindex",
$modx->documentObject['content']);
<img>. Подскажите пожалуйста, в чем может быть ошибка?