Skip to content

Instantly share code, notes, and snippets.

@ajnyga
Created January 21, 2019 21:03
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/a0d2fd12d20990793e687fbe33183c97 to your computer and use it in GitHub Desktop.
Save ajnyga/a0d2fd12d20990793e687fbe33183c97 to your computer and use it in GitHub Desktop.
<?php
$botRegexps = array_map("filter", file("lib/pkp/plugins/generic/usageStats/lib/counterBots/generated/COUNTER_Robots_list.txt"));
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;
}
}
return $regexp;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment