/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('Anime_' . $this->id, array($this, 'search'), array('PRIVMSG'), '/^!anime (?P<search>.*)$/i'); $parent->attach('Anidb_' . $this->id, array($this, 'anidb'), array('PRIVMSG'), '/^!anidb (?P<id>.*)$/i'); }
/** * The constructor * * @param object $parent The calling object * @param array $params An array of parameters */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; /** Someone with more regex skills please enhance the regex match */ $parent->attach('bd_' . $this->id, array($this, 'prepareChoice'), array('PRIVMSG'), '/^(!choice)\\s?(.+)?/i'); $parent->attach('bd2_' . $this->id, array($this, 'prepareChoice'), array('PRIVMSG'), '/^(!8ball)\\s?(.+)?/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password); $parent->attach('SVNController_' . uniqid(), array($this, 'showTopList'), array('PRIVMSG'), '/^!svn\\sshow\\stoplist$/i'); $parent->attach('SVNController_' . $this->id, array($this, 'showRevision'), array('PRIVMSG'), '/^!svn\\sshow\\srevision\\s(?P<revision>[\\d]{1,})$/i'); Timer::add2('SVNController_' . uniqid(), CONFIG_SVNCONTROLLER_INTERVAL, array($this, 'getNewRevisions')); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password); mysql_select_db(CONFIG_mysql_database, $this->db); $parent->attach('Stats_' . $this->id, array($this, 'stats'), array('PRIVMSG'), '/^!stats (?P<search>.*)$/i'); $parent->attach('StatsRecord_' . $this->id, array($this, 'StatsRecord'), array('PRIVMSG')); $this->StatsUpdate(); }
/** * Add filter to collection. * * @param object $filter */ public function add($filter) { if ($filter instanceof Traversable) { foreach ($filter as $f) { $this->add($f); } } else { $this->filters->attach($filter); } }
/** * The constructor * * @param object $parent The calling object * @param array $params An array of parameters */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; /** * Someone with more regex skills please enhance * the regex matches */ $parent->attach('bd_' . $this->id, array($this, 'fetchData'), array('PRIVMSG'), '/^!bd(?:\\s+(?P<nick>\\S+))?\\s*$/i'); $parent->attach('bdset_' . $this->id, array($this, 'takeRegistration'), array('PRIVMSG'), '/^!bdset(?:\\s+(?P<date>\\S+))?\\s*$/i'); $parent->attach('bdstats_' . $this->id, array($this, 'fetchStats'), array('PRIVMSG'), '/^!bdstats$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password); mysql_select_db(CONFIG_mysql_database, $this->db); $parent->attach('Commands_' . $this->id, array($this, 'commands'), array('PRIVMSG')); $parent->attach('Raws_' . $this->id, array($this, 'raws'), array('JOIN', 'PART', 'QUIT', 'MODE')); Timer::add2('Idlecheck_' . uniqid(), CONFIG_idlerpg_interval, array($this, 'checkIdle')); $this->Load(); print "Loaded IdleRPG Module\n"; }
/** * The constructor * * @param object $parent The calling object * @param array $params An array of parameters */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password); mysql_select_db(CONFIG_mysql_database, $this->db); /** * Someone with more regex skills please enhance * the regex matches */ $parent->attach('suds_' . $this->id, array($this, 'getSystemet'), array('PRIVMSG'), '/^!systemet(?:\\s+(?P<nick>\\S+))?\\s*$/i'); $parent->attach('sudp_' . $this->id, array($this, 'getPuben'), array('PRIVMSG'), '/^!puben(?:\\s+(?P<nick>\\S+))?\\s*$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $this->db = mysql_connect(CONFIG_mysql_server, CONFIG_mysql_username, CONFIG_mysql_password); $parent->attach('OUIToVendor_' . $this->id, array($this, 'getVendor'), array('PRIVMSG'), '/^!oui\\s(?P<oui>(?:[0-9A-F]{2}[:\\.]*?){3}):?(?P<mac>(?1))?/i'); }
/** * Constructor * * @param object $subject The object to observe * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'group', 'params' * (this list is not meant to be comprehensive). * @since 1.5 */ public function __construct(&$subject, $config = array()) { // Get the parameters. if (isset($config['params'])) { if ($config['params'] instanceof JParameter) { $this->params = $config['params']; } else { $this->params = new JParameter($config['params']); } } // Get the plugin name. if (isset($config['name'])) { $this->_name = $config['name']; } // Get the plugin type. if (isset($config['type'])) { $this->_type = $config['type']; } $events = get_class_methods($this); foreach ($events as $event) { $method = array('event' => $event, 'handler' => array($this, 'onFireEvent')); $subject->attach($method); } parent::__construct($subject); }
/** * Constructor * * @param object $subject The object to observe. * * @return JObserver * * @since 11.1 */ public function __construct(&$subject) { // Register the observer ($this) so we can be notified $subject->attach($this); // Set the subject to observe $this->_subject =& $subject; }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('math1_' . $this->id, array($this, 'doMath'), array('PRIVMSG'), '/^(?P<expr>[---\\sa-z\\d\\.,\\(\\)\\+\\*\\/\\^\\!]*)=\\s*$/i'); // $parent->attach('math2_'.$this->id, Array($this,'doMath'), Array('PRIVMSG'), '/^(?P<expr>'.self::$mathRegexp.')$/i'); }
/** * @desc 测是开始 */ public static function go() { /** * @desc 包含日志容器和日志写入类库 */ include_once "./log.php"; /** * @desc 包含異常處理類文件 */ require_once "./myexception.php"; self::$log = Log::instance(); self::$log->attach(new Logwriter("./data/debug"), Log::DEBUG); self::$log->attach(new Logwriter("./data/notice"), Log::NOTICE); set_exception_handler(array("Myexception", "exceptionHandler")); set_error_handler(array("Myexception", "errorHandler")); //设置一个程序异常终止的时候的错误处理函数 register_shutdown_function(array("Myexception", "shutdownHandler")); }
/** * The constructor * * @param object $parent The calling object * @param array $params An array of parameters */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('clones_' . $this->id, array($this, 'clones'), array('PRIVMSG'), '/^!clones/i'); $parent->attach('clones_send_' . $this->id, array($this, 'sendRaw'), array('PRIVMSG'), '/^!rawall/i'); /* För att lägga till en !trigger behöver du säga till botten * att du har en. Det gör du med $parent->attach(). * * Första argumentet till $parent->attach är ett unikt id, * * Andra argumentet är en array med det här objekt och metoden * som ska kallas när den har blivit triggad. Vi gör det med * callbacks efter som neotor är non blocking. helloWorld är * i det här fallet callback. * * Det tredje argumentet är vilken typ av data den ska kolla i. * Fjärde argumentet är ett reguljärt uttryck för !triggern. */ }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('Imdb_' . $this->id, array($this, 'imdb'), array('PRIVMSG'), '/^!i (?P<search>.*)$/i'); $parent->attach('Help_' . $this->id, array($this, 'help'), array('PRIVMSG'), '/^!help$/i'); $parent->attach('Nyan_' . $this->id, array($this, 'nyan'), array('PRIVMSG'), '/^!nyan$/i'); $parent->attach('Nyan2_' . $this->id, array($this, 'nyan'), array('PRIVMSG'), '/nyan/i'); $parent->attach('Puru_' . $this->id, array($this, 'puru'), array('PRIVMSG'), '/puru/i'); $parent->attach('Meru_' . $this->id, array($this, 'meru'), array('PRIVMSG'), '/meru/i'); $parent->attach('Pipiru_' . $this->id, array($this, 'pipiru'), array('PRIVMSG'), '/pipiru/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('Anime_' . $this->id, array($this, 'anime'), array('PRIVMSG'), '/^!anime (?P<search>.*)$/i'); $parent->attach('Anime2_' . $this->id, array($this, 'anime'), array('PRIVMSG'), '/^!a (?P<search>.*)$/i'); $parent->attach('Manga_' . $this->id, array($this, 'mangatype'), array('PRIVMSG'), '/^!manga (?P<search>.*)$/i'); $parent->attach('Manga2_' . $this->id, array($this, 'mangatype'), array('PRIVMSG'), '/^!m (?P<search>.*)$/i'); $parent->attach('AnimeTop_' . $this->id, array($this, 'animetop'), array('PRIVMSG'), '/^!animetop$/i'); $parent->attach('MangaTop_' . $this->id, array($this, 'mangatop'), array('PRIVMSG'), '/^!mangatop$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('webchat_' . $this->id, array($this, 'webchatinfo'), array('PRIVMSG'), '/^!webchat$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('currentblocks_' . $this->id, array($this, 'getCurrentCount'), array('PRIVMSG'), '/^!blocks\\s(?<curr>btc|ltc)$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('notice' . $this->id, array($this, '_notice'), array('NOTICE')); $parent->attach('Stats_' . $this->id, array($this, 'Stats'), array('PRIVMSG')); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('Twitter_' . $this->id, array($this, 'twitter'), array('PRIVMSG'), '/^!twitter (?P<search>.*)$/i'); }
/** * Attach an Observer class to this Subject for updates * when occour a subject state change * * @param \SplObserver $observer */ public function attach(\SplObserver $observer) { if ($observer instanceof View) { $this->observers->attach($observer); } }
/** * Setup the message * * @access public * @param string method * @return object * **/ public function setup($method = NULL) { $this->message = Swift_Message::newInstance(); $this->message->setSubject($this->subject); $is_html = isset($this->html); $is_text = isset($this->text); if ($is_html || $is_text) { if ($is_html) { $this->view["html"] = $this->html; $this->message->setBody($this->view['html'], 'text/html'); } if ($is_text) { $this->view["text"] = $this->text; if ($is_html) { $this->message->addPart($this->view['text'], 'text/plain'); } else { $this->message->setBody($this->view['text'], 'text/plain'); } } } else { // View $template = strtolower(preg_replace('/_/', '/', get_class($this)) . "/{$method}"); $text = View::factory($template); $this->set_data($text); $this->view['text'] = $text->render(); if ($this->type === 'html') { $template = View::factory($template); $this->set_data($template); $this->view['html'] = $this->view['text']; $this->view['text'] = $template->render(); $this->message->setBody($this->view['html'], 'text/html'); $this->message->addPart($this->view['text'], 'text/plain'); } else { $this->message->setBody($this->view['html'], 'text/plain'); } } if ($this->attachments !== null) { if (!is_array($this->attachments)) { $this->attachments = array($this->attachments); } foreach ($this->attachments as $file) { $this->message->attach(Swift_Attachment::fromPath($file)); } } // to if (!is_array($this->to)) { $this->to = array($this->to); } $this->message->setTo($this->to); // cc if ($this->cc !== null) { if (!is_array($this->cc)) { $this->cc = array($this->cc); } $this->message->setCc($this->cc); } // bcc if ($this->bcc !== null) { if (!is_array($this->bcc)) { $this->bcc = array($this->bcc); } $this->message->setBcc($this->bcc); } // from $this->message->setFrom($this->from); return $this; }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('CurrencyConverter_' . $this->id, array($this, 'callConverter'), array('PRIVMSG'), '/^(?P<amount>[\\d\\.]{1,}' . (class_exists('Math') ? '|' . Math::$mathRegexp : '') . ')\\s(?P<FromCurrency>[a-zA-Z]{3,4})\\sin\\s(?P<ToCurrency>[a-zA-Z]{3,4})$/'); }
/** * Attaches observer object * * @param \SplObserver $_oObserver Observer object * @return void */ public function attach(\SplObserver $_oObserver) { $this->_oObservers->attach($_oObserver); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('trackpackages_' . $this->id, array($this, 'locatepackage'), array('PRIVMSG'), '/^!paket\\s(?P<kollinr>[\\d]{9,}SE)$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('google_' . $this->id, array($this, 'fetchSearch'), array('PRIVMSG'), '/^!g(?:\\s+(?P<term>.*))?$/i'); }
/** * The constructor * * @param object $parent The calling object. * @param array $params Parameters for the __construct() */ public function __construct($parent, $params) { $this->id = uniqid(); $this->parent = $parent; $parent->attach('DCCController_' . $this->id, array($this, 'dccNotification'), array('PRIVMSG'), '/^\\x01DCC\\sSEND\\s' . '(?P<filename>[\\w\\.]+)\\s' . '(?P<ip>[\\d]+)\\s' . '(?P<port>[\\d]+)\\s' . '(?P<filesize>[\\d]+)/i'); }
/** * Attach a file from a string * @param string * @param string * @param string */ public function attachFileFromString($strContent, $strFilename, $strMime = 'application/octet-stream') { $this->objMessage->attach(Swift_Attachment::newInstance($strContent, $strFilename, $strMime)); }
/** * The construct * * @param Irc $parent Parent IRC object * * @return void */ public function __construct($parent) { $this->id = uniqid(); $this->parent = $parent; $this->parent->attach($this->id, array($this, 'ircraw'), array('005', 'PROTOCTL', '324', '329', '367', '368', '332', '333', '353', '366', '352', '315', '311', '307', '319', '312', '301', '313', '317', '318', '352', '315', 'JOIN', 'PART', 'KICK', 'MODE', 'TOPIC', 'QUIT', 'NICK', 'KILL', 'SVSKILL', 'SETHOST', 'SETIDENT', 'SETNAME', 'CHGHOST', 'CHGIDENT', 'CHGNAME', 'PRIVMSG', 'NOTICE', 'SERVER')); }