Advertisement
Guest User

Detecting the {{nobots}} template

a guest
Jan 3rd, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. $talk = get_page_contents('User_talk:' . $user);
  2. if (preg_match('%' . preg_quote('{{nobot}}') . '%iS',$talk)) {
  3.     preg_match_all('%<nowiki>(.*?)' . preg_quote('{{nobots}}') . '(.*?)</nowiki>%msi', $talk, $nowikimatches);
  4.     preg_match_all('%' . preg_quote('{{nobots}}') . '%msi', $talk, $nobotsmatches);
  5.     if (sizeof($nowikimatches[0]) < sizeof($nobotsmatches[0])) {
  6.         echo $user . '\'s talk page does not allow bots. Skipping...' . "\n";
  7.         return;
  8.     }  
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement