Sure. Here you go:
function smb_find_occurences($string, $find) {
if (strpos(strtolower($string), strtolower($find)) !== FALSE){
$pos = -1;
for ($i=0; $i<substr_count(strtolower($string), strtolower($find)); $i++){
$pos = strpos(strtolower($string), strtolower($find), $pos+1);
$positionarray[] = $pos;
}
return $positionarray;
}else{
return false;
}
}
$image_positions = smb_find_occurences($content, '<img');
if(count($image_positions)){
if(count($potential_random_ad_paragraphs)){
foreach($potential_random_ad_paragraphs as $key=>$potential_random_ad_paragraph){
foreach($image_positions as $image_position){
if(abs($image_position - $original_paragraph_positions[$potential_random_ad_paragraph-1]) < 600){
unset($potential_random_ad_paragraphs[$key]);
}
}
}
}
}
I inserted this section of cod into line 869 in ad-injection.php. Sorry if it is a little crude, I was going more for time rater then efficiency. There are probably some better ways to determine image position in the content, as the method I used does not take into account the length of the image tag.