當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Globals::tfa方法代碼示例

本文整理匯總了PHP中Globals::tfa方法的典型用法代碼示例。如果您正苦於以下問題:PHP Globals::tfa方法的具體用法?PHP Globals::tfa怎麽用?PHP Globals::tfa使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Globals的用法示例。


在下文中一共展示了Globals::tfa方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processEdit

 public static function processEdit($change)
 {
     if (time() - Globals::$tfas >= 1800 and preg_match('/\\(\'\'\'\\[\\[([^|]*)\\|more...\\]\\]\'\'\'\\)/iU', Api::$q->getpage('Wikipedia:Today\'s featured article/' . date('F j, Y')), $tfam)) {
         Globals::$tfas = time();
         Globals::$tfa = $tfam[1];
     }
     if (Config::$fork) {
         $pid = pcntl_fork();
         if ($pid != 0) {
             echo 'Forked - ' . $pid . "\n";
             return;
         }
     }
     $change = parseFeedData($change);
     $change['justtitle'] = $change['title'];
     if (in_array('namespace', $change) && $change['namespace'] != 'Main:') {
         $change['title'] = $change['namespace'] . $change['title'];
     }
     self::processEditThread($change);
     if (Config::$fork) {
         die;
     }
 }
開發者ID:pandalion98,項目名稱:cluebotng,代碼行數:23,代碼來源:process_functions.php

示例2: shouldRevert

 public static function shouldRevert($change)
 {
     $reason = 'Default revert';
     if (preg_match('/(assisted|manual)/iS', Config::$status)) {
         echo 'Revert [y/N]? ';
         if (strtolower(substr(fgets(Globals::$stdin, 3), 0, 1)) != 'y') {
             return array(false, 'Manual mode says no');
         }
     }
     if (!preg_match('/(yes|enable|true)/iS', Globals::$run)) {
         return array(false, 'Run disabled');
     }
     if ($change['user'] == Config::$user) {
         return array(false, 'User is myself');
     }
     if (Config::$angry) {
         return array(true, 'Angry-reverting in angry mode');
     }
     if (time() - Globals::$tfas >= 1800) {
         if (preg_match('/\\(\'\'\'\\[\\[([^|]*)\\|more...\\]\\]\'\'\'\\)/iU', Api::$q->getpage('Wikipedia:Today\'s featured article/' . date('F j, Y')), $tfam)) {
             Globals::$tfas = time();
             Globals::$tfa = $tfam[1];
         }
     }
     if (!self::findAndParseBots($change)) {
         return array(false, 'Exclusion compliance');
     }
     if ($change['all']['user'] == $change['all']['common']['creator']) {
         return array(false, 'User is creator');
     }
     if ($change['all']['user_edit_count'] > 50) {
         if ($change['all']['user_warns'] / $change['all']['user_edit_count'] < 0.1) {
             return array(false, 'User has edit count');
         } else {
             $reason = 'User has edit count, but warns > 10%';
         }
     }
     if (Globals::$tfa == $change['title']) {
         return array(true, 'Angry-reverting on TFA');
     }
     if (preg_match('/\\* \\[\\[(' . preg_quote($change['title'], '/') . ')\\]\\] \\- .*/i', Globals::$aoptin)) {
         IRC::say('debugchannel', 'Angry-reverting [[' . $change['title'] . ']].');
         return array(true, 'Angry-reverting on angry-optin');
     }
     $titles = unserialize(file_get_contents('titles.txt'));
     if (!isset($titles[$change['title'] . $change['user']]) or time() - $titles[$change['title'] . $change['user']] > 24 * 60 * 60) {
         $titles[$change['title'] . $change['user']] = time();
         file_put_contents('titles.txt', serialize($titles));
         return array(true, $reason);
     }
     return array(false, 'Reverted before');
 }
開發者ID:pandalion98,項目名稱:cluebotng,代碼行數:52,代碼來源:action_functions.php


注:本文中的Globals::tfa方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。