[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/event/ -> event.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: event.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla.Framework
   5  * @subpackage    Event
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  jimport( 'joomla.base.observer' );
  19  
  20  /**
  21   * JEvent Class
  22   *
  23   * @abstract
  24   * @package        Joomla.Framework
  25   * @subpackage    Event
  26   * @since        1.5
  27   */
  28  class JEvent extends JObserver
  29  {
  30  
  31      /**
  32       * Constructor
  33       *
  34       * For php4 compatability we must not use the __constructor as a constructor for plugins
  35       * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  36       * This causes problems with cross-referencing necessary for the observer design pattern.
  37       *
  38       * @param object $subject The object to observe
  39       * @since 1.5
  40       */
  41  	function JEvent(& $subject) {
  42          parent::__construct($subject);
  43      }
  44  
  45      /**
  46       * Method to trigger events
  47       *
  48       * @access public
  49       * @param array Arguments
  50       * @return mixed Routine return value
  51       * @since 1.5
  52       */
  53  	function update(& $args)
  54      {
  55          /*
  56           * First lets get the event from the argument array.  Next we will unset the
  57           * event argument as it has no bearing on the method to handle the event.
  58           */
  59          $event = $args['event'];
  60          unset($args['event']);
  61  
  62          /*
  63           * If the method to handle an event exists, call it and return its return
  64           * value.  If it does not exist, return null.
  65           */
  66          if (method_exists($this, $event)) {
  67              return call_user_func_array ( array($this, $event), $args );
  68          } else {
  69              return null;
  70          }
  71      }
  72  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1