當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。