Skip to content

Instantly share code, notes, and snippets.

@ajnyga
Created January 21, 2019 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajnyga/b56a37c2443129945178c31cc5080dc7 to your computer and use it in GitHub Desktop.
Save ajnyga/b56a37c2443129945178c31cc5080dc7 to your computer and use it in GitHub Desktop.
<?php
$botRegexps = array_filter(file("lib/pkp/plugins/generic/usageStats/lib/counterBots/generated/COUNTER_Robots_list.txt"), "filter");
print_r($botRegexps);
function filter(&$regexp)
{
$delimiter = '/';
$regexp = trim($regexp);
if (!empty($regexp) && $regexp[0] != '#') {
if(strpos($regexp, $delimiter) !== 0) {
// Make sure delimiters are in place.
$regexp = $delimiter . $regexp . $delimiter;
}
} else {
return false;
}
return true;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment