| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: plugin.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla.Framework 5 * @subpackage Plugin 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.event.event' ); 19 20 /** 21 * JPlugin Class 22 * 23 * @abstract 24 * @package Joomla.Framework 25 * @subpackage Plugin 26 * @since 1.5 27 */ 28 class JPlugin extends JEvent 29 { 30 /** 31 * A JParameter object holding the parameters for the plugin 32 * 33 * @var A JParameter object 34 * @access public 35 * @since 1.5 36 */ 37 var $params = null; 38 39 /** 40 * The name of the plugin 41 * 42 * @var sring 43 * @access protected 44 */ 45 var $_name = null; 46 47 /** 48 * The plugin type 49 * 50 * @var string 51 * @access protected 52 */ 53 var $_type = null; 54 55 /** 56 * Constructor 57 * 58 * For php4 compatability we must not use the __constructor as a constructor for plugins 59 * because func_get_args ( void ) returns a copy of all passed arguments NOT references. 60 * This causes problems with cross-referencing necessary for the observer design pattern. 61 * 62 * @param object $subject The object to observe 63 * @param array $config An optional associative array of configuration settings. 64 * Recognized key values include 'name', 'group', 'params' 65 * (this list is not meant to be comprehensive). 66 * @since 1.5 67 */ 68 function JPlugin(& $subject, $config = array()) { 69 parent::__construct($subject); 70 } 71 72 /** 73 * Constructor 74 */ 75 function __construct(& $subject, $config = array()) 76 { 77 //Set the parameters 78 if ( isset( $config['params'] ) ) { 79 80 if(is_a($config['params'], 'JParameter')) { 81 $this->params = $config['params']; 82 } else { 83 $this->params = new JParameter($config['params']); 84 } 85 } 86 87 if ( isset( $config['name'] ) ) { 88 $this->_name = $config['name']; 89 } 90 91 if ( isset( $config['type'] ) ) { 92 $this->_type = $config['type']; 93 } 94 95 parent::__construct($subject); 96 } 97 98 /** 99 * Loads the plugin language file 100 * 101 * @access public 102 * @param string $extension The extension for which a language file should be loaded 103 * @param string $basePath The basepath to use 104 * @return boolean True, if the file has successfully loaded. 105 * @since 1.5 106 */ 107 function loadLanguage($extension = '', $basePath = JPATH_BASE) 108 { 109 if(empty($extension)) { 110 $extension = 'plg_'.$this->_type.'_'.$this->_name; 111 } 112 113 $lang =& JFactory::getLanguage(); 114 return $lang->load( strtolower($extension), $basePath); 115 } 116 117 118 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |