Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/application/plugin/plugin.php

Documentation is available at plugin.php

  1. <?php
  2. /**
  3. @version        $Id$
  4. @package        Joomla.Framework
  5. @subpackage    Application
  6. @copyright    Copyright (C) 2005 - 2007 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.  * JPlugin Class
  22.  *
  23.  * @abstract
  24.  * @author        Louis Landry <[email protected]>
  25.  * @package        Joomla.Framework
  26.  * @subpackage    Application
  27.  * @since        1.5
  28.  */
  29. class JPlugin extends JObserver 
  30. {
  31.  
  32.     /**
  33.      * Constructor
  34.      *
  35.      * For php4 compatability we must not use the __constructor as a constructor for plugins
  36.      * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  37.      * This causes problems with cross-referencing necessary for the observer design pattern.
  38.      *
  39.      * @param object $subject The object to observe
  40.      * @since 1.5
  41.      */
  42.     function JPlugin($subject{
  43.         parent::__construct($subject);
  44.     }
  45.  
  46.     /**
  47.      * Method to trigger events based upon the JAuthenticate object
  48.      *
  49.      * @access public
  50.      * @param array Arguments
  51.      * @return mixed Routine return value
  52.      * @since 1.5
  53.      */
  54.     function update($args)
  55.     {
  56.         /*
  57.          * First lets get the event from the argument array.  Next we will unset the
  58.          * event argument as it has no bearing on the method to handle the event.
  59.          */
  60.         $event $args['event'];
  61.         unset($args['event']);
  62.  
  63.         /*
  64.          * If the method to handle an event exists, call it and return its return
  65.          * value.  If it does not exist, return null.
  66.          */
  67.         if (method_exists($this$event)) {
  68.             return call_user_func_array array($this$event)$args );
  69.         else {
  70.             return null;
  71.         }
  72.     }
  73. }
  74.  
  75. ?>

Documentation generated on Mon, 05 Mar 2007 21:19:08 +0000 by phpDocumentor 1.3.1