OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / include / mos / class / plugin.php
1 <?php
2 /**
3 * @version              $Id: plugin.php 4955 2012-06-09 10:11:23Z fishbone $
4 * @package              Joomla.Framework
5 * @subpackage   Plugin
6 * @copyright    Copyright (C) 2005 - 2008 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 class JPlugin
30 {
31         /**
32          * A JParameter object holding the parameters for the plugin
33          *
34          * @var         A JParameter object
35          * @access      public
36          * @since       1.5
37          */
38         var     $params = null;
39
40         /**
41          * The name of the plugin
42          *
43          * @var         sring
44          * @access      protected
45          */
46         var $_name      = null;
47
48         /**
49          * The plugin type
50          *
51          * @var         string
52          * @access      protected
53          */
54         var $_type      = null;
55
56         /**
57          * Constructor
58          *
59          * For php4 compatability we must not use the __constructor as a constructor for plugins
60          * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
61          * This causes problems with cross-referencing necessary for the observer design pattern.
62          *
63          * @param object $subject The object to observe
64          * @param array  $config  An optional associative array of configuration settings.
65          * Recognized key values include 'name', 'group', 'params'
66          * (this list is not meant to be comprehensive).
67          * @since 1.5
68          */
69 /*      function JPlugin(& $subject, $config = array())  {
70                 parent::__construct($subject);
71         }*/
72
73         /**
74          * Constructor
75          */
76         function __construct(& $subject, $config = array())
77         {
78                 //Set the parameters
79                 if ( isset( $config['params'] ) ) {
80
81                         if(is_a($config['params'], 'JParameter')) {
82                                 $this->params = $config['params'];
83                         } else {
84                                 $this->params = new JParameter($config['params']);
85                         }
86                 }
87
88                 if ( isset( $config['name'] ) ) {
89                         $this->_name = $config['name'];
90                 }
91
92                 if ( isset( $config['type'] ) ) {
93                         $this->_type = $config['type'];
94                 }
95
96                 parent::__construct($subject);
97         }
98
99         /**
100          * Loads the plugin language file
101          *
102          * @access      public
103          * @param       string  $extension      The extension for which a language file should be loaded
104          * @param       string  $basePath       The basepath to use
105          * @return      boolean True, if the file has successfully loaded.
106          * @since       1.5
107          */
108         public static function loadLanguage($extension = '', $basePath = JPATH_BASE)
109         {
110         /*
111                 if(empty($extension)) {
112                         $extension = 'plg_'.$this->_type.'_'.$this->_name;
113                 }
114
115                 $lang =& JFactory::getLanguage();
116                 return $lang->load( strtolower($extension), $basePath);
117                 */
118                 return true;
119         }
120 }