当前位置: 首页>>代码示例>>PHP>>正文


PHP Globals::run方法代码示例

本文整理汇总了PHP中Globals::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::run方法的具体用法?PHP Globals::run怎么用?PHP Globals::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doInit

function doInit()
{
    if (Config::$pass == null) {
        Config::$pass = trim(file_get_contents(getenv("HOME") . '/.cluebotng.password.only'));
    }
    API::init();
    API::$a->login(Config::$user, Config::$pass);
    Globals::$mysql = false;
    checkMySQL();
    Globals::$tfas = 0;
    Globals::$stdin = fopen('php://stdin', 'r');
    Globals::$run = API::$q->getpage('User:' . Config::$user . '/Run');
    Globals::$wl = API::$q->getpage('Wikipedia:Huggle/Whitelist');
    Globals::$optin = API::$q->getpage('User:' . Config::$user . '/Optin');
    Globals::$aoptin = API::$q->getpage('User:' . Config::$user . '/AngryOptin');
    Globals::$stalk = array();
    Globals::$edit = array();
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutostalk.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$stalk[$tmp3[0]] = trim($tmp3[1]);
        }
    }
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutoedit.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$edit[$tmp3[0]] = trim($tmp3[1]);
        }
    }
}
开发者ID:Riamse,项目名称:cluebotng,代码行数:32,代码来源:misc_functions.php

示例2: doInit

function doInit()
{
    if (Config::$pass == null) {
        Config::$pass = trim(file_get_contents(getenv('HOME') . '/.cluebotng.password.only'));
    }
    Api::init();
    Api::$a->login(Config::$user, Config::$pass);
    Globals::$tfas = 0;
    Globals::$stdin = fopen('php://stdin', 'r');
    Globals::$run = Api::$q->getpage('User:' . Config::$user . '/Run');
    Globals::$wl = Api::$q->getpage('Wikipedia:Huggle/Whitelist');
    Globals::$optin = Api::$q->getpage('User:' . Config::$user . '/Optin');
    Globals::$aoptin = Api::$q->getpage('User:' . Config::$user . '/AngryOptin');
    Globals::$stalk = array();
    Globals::$edit = array();
    $tmp = explode("\n", Api::$q->getpage('User:' . Config::$owner . '/CBAutostalk.js'));
    foreach ($tmp as $tmp2) {
        if (strlen($tmp2) > 0 && substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            if (count($tmp3) == 2) {
                Globals::$stalk[$tmp3[0]] = trim($tmp3[1]);
            } else {
                print "Skipping auto stalk entry: {$tmp2}\n";
            }
        }
    }
    $tmp = explode("\n", Api::$q->getpage('User:' . Config::$owner . '/CBAutoedit.js'));
    foreach ($tmp as $tmp2) {
        if (strlen($tmp2) > 0 && substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            if (count($tmp3) == 2) {
                Globals::$edit[$tmp3[0]] = trim($tmp3[1]);
            } else {
                print "Skipping auto edit entry: {$tmp2}\n";
            }
        }
    }
}
开发者ID:pandalion98,项目名称:cluebotng,代码行数:38,代码来源:misc_functions.php

示例3: loop

 private static function loop($line)
 {
     $d = IRC::split($line);
     if ($d === null) {
         return;
     }
     if ($d['type'] == 'direct') {
         switch ($d['command']) {
             case 'ping':
                 self::send('PONG :' . $d['pieces'][0]);
                 break;
         }
     } else {
         switch ($d['command']) {
             case '376':
             case '422':
                 self::send('JOIN ' . self::$channel);
                 break;
             case 'privmsg':
                 if (strtolower($d['target']) == self::$channel) {
                     $rawmessage = $d['pieces'][0];
                     $message = str_replace("", '', $rawmessage);
                     $message = preg_replace('/\\003(\\d\\d?(,\\d\\d?)?)?/', '', $message);
                     $data = parseFeed($message);
                     if ($data === false) {
                         return;
                     }
                     $data['line'] = $message;
                     $data['rawline'] = $rawmessage;
                     if (stripos('N', $data['flags']) !== false) {
                         self::bail($data, 'New article');
                         return;
                     }
                     $stalkchannel = array();
                     foreach (Globals::$stalk as $key => $value) {
                         if (myfnmatch(str_replace('_', ' ', $key), str_replace('_', ' ', $data['user']))) {
                             $stalkchannel = array_merge($stalkchannel, explode(',', $value));
                         }
                     }
                     foreach (Globals::$edit as $key => $value) {
                         if (myfnmatch(str_replace('_', ' ', $key), str_replace('_', ' ', ($data['namespace'] == 'Main:' ? '' : $data['namespace']) . $data['title']))) {
                             $stalkchannel = array_merge($stalkchannel, explode(',', $value));
                         }
                     }
                     $stalkchannel = array_unique($stalkchannel);
                     foreach ($stalkchannel as $chan) {
                         IRC::say($chan, 'New edit: [[' . ($data['namespace'] == 'Main:' ? '' : $data['namespace']) . $data['title'] . ']] https://en.wikipedia.org/w/index.php?title=' . urlencode($data['namespace'] . $data['title']) . '&diff=prev&oldid=' . urlencode($data['revid']) . ' * ' . $data['user'] . ' * ' . $data['comment']);
                     }
                     switch ($data['namespace'] . $data['title']) {
                         case 'User:' . Config::$user . '/Run':
                             Globals::$run = Api::$q->getpage('User:' . Config::$user . '/Run');
                             break;
                         case 'Wikipedia:Huggle/Whitelist':
                             Globals::$wl = Api::$q->getpage('Wikipedia:Huggle/Whitelist');
                             break;
                         case 'User:' . Config::$user . '/Optin':
                             Globals::$optin = Api::$q->getpage('User:' . Config::$user . '/Optin');
                             break;
                         case 'User:' . Config::$user . '/AngryOptin':
                             Globals::$aoptin = Api::$q->getpage('User:' . Config::$user . '/AngryOptin');
                             break;
                     }
                     if ($data['namespace'] != 'Main:' and !preg_match('/\\* \\[\\[(' . preg_quote($data['namespace'] . $data['title'], '/') . ')\\]\\] \\- .*/i', Globals::$optin)) {
                         self::bail($data, 'Outside of valid namespaces');
                         return;
                     }
                     echo 'Processing: ' . $message . "\n";
                     Process::processEdit($data);
                 }
                 break;
         }
     }
 }
开发者ID:pandalion98,项目名称:cluebotng,代码行数:73,代码来源:feed_functions.php


注:本文中的Globals::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。