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


PHP object::attach方法代码示例

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


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

示例1: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:13,代码来源:Anime.php

示例2: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:14,代码来源:Choice.php

示例3: __construct

 /**
  * 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'));
 }
开发者ID:bonan,项目名称:neotor,代码行数:15,代码来源:SVNController.php

示例4: __construct

 /**
  * 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();
 }
开发者ID:bonan,项目名称:neotor,代码行数:16,代码来源:ChannelStats.php

示例5: add

 /**
  * 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);
     }
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:15,代码来源:FilterCollection.php

示例6: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:18,代码来源:Birthday.php

示例7: __construct

 /**
  * 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";
 }
开发者ID:bonan,项目名称:neotor,代码行数:18,代码来源:idlerpg.php

示例8: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:19,代码来源:SpecialUserDays.php

示例9: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:13,代码来源:OUIToVendor.php

示例10: __construct

 /**
  * 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);
 }
开发者ID:joebushi,项目名称:joomla,代码行数:34,代码来源:plugin.php

示例11: __construct

 /**
  * 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;
 }
开发者ID:carmerin,项目名称:cesae-web,代码行数:16,代码来源:observer.php

示例12: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:13,代码来源:Math.php

示例13: go

 /**
  * @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"));
 }
开发者ID:sdgdsffdsfff,项目名称:phplog,代码行数:21,代码来源:testlog.php

示例14: __construct

 /**
  * 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. */
 }
开发者ID:bonan,项目名称:neotor,代码行数:25,代码来源:Clones.php

示例15: __construct

 /**
  * 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');
 }
开发者ID:bonan,项目名称:neotor,代码行数:18,代码来源:Commands.php


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