Created
May 9, 2015 20:35
-
-
Save nch7/e7eb90010fbc89ff621e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$anchors = $domain->ahrefs_data['anchors']; | |
$anchorsCombined = implode('|',$anchors); | |
$anchor_words = explode(' ',str_replace('|', ' ', $anchorsCombined)); | |
if(preg_match('/(*UTF8)[\p{Han}\p{Hiragana}\p{Katakana}\p{Thai}]+/',$anchorsCombined)!==0){ | |
$badDomainIds[] = $domain->id; | |
echo sprintf('Domain "%s" has bad character in anchors'.PHP_EOL,$domain->domain); | |
Log::info(sprintf('Domain "%s" has bad character in anchors'.PHP_EOL,$domain->domain)); | |
} else { | |
foreach ($blStrs as $key => $blStr) { | |
if((strpos($blStr,' ')===false AND in_array($blStr,$anchor_words)>0) OR // Blacklisted string is a one-word only and such string exists as a word in anchors | |
(strpos($blStr,' ')!==false AND strpos($anchorsCombined,$blStr)!==false) OR // Blacklisted string is a multi-word phrase and it exists in (substring of) any of the anchors | |
(strpos($blStr,'*')!==false AND fnmatch_in_array($blStr,$anchors)==true)){ // Blacklisted Wildcard pattern matches in any of the anchors | |
$badDomainIds[] = $domain->id; | |
echo sprintf('Domain "%s" has bad anchor "%s"'.PHP_EOL,$domain->domain,$blStr); | |
Log::info(sprintf('Domain "%s" has bad anchor "%s"'.PHP_EOL,$domain->domain,$blStr)); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment