SHARE
TWEET

Detecting the {{nobots}} template

a guest Jan 3rd, 2014 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top