source: branches/version-2_13-dev/data/class/plugin/SC_Plugin_Base.php @ 23124

Revision 23124, 3.7 KB checked in by kimoto, 11 years ago (diff)

#2043 typo修正・ソース整形・ソースコメントの改善 for 2.13.0
PHP4的な書き方の修正

Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 *
23 *
24 */
25
26/**
27 * プラグインの基底クラス
28 *
29 * @package Plugin
30 * @author LOCKON CO.,LTD.
31 * @version $Id: $
32 */
33abstract class SC_Plugin_Base
34{
35    protected $arrSelfInfo;
36
37    /**
38     * コンストラクタ
39     *
40     * @param  array $arrSelfInfo 自身のプラグイン情報
41     * @return void
42     */
43    public function __construct(array $arrSelfInfo)
44    {
45        $this->arrSelfInfo = $arrSelfInfo;
46    }
47    /**
48     * インストール
49     * installはプラグインのインストール時に実行されます.
50     * 引数にはdtb_pluginのプラグイン情報が渡されます.
51     *
52     * @param  array $arrPlugin plugin_infoを元にDBに登録されたプラグイン情報(dtb_plugin)
53     * @return void
54     */
55    public function install($arrPlugin, $objPluginInstaller = null)
56    {
57    }
58
59    /**
60     * アンインストール
61     * uninstallはアンインストール時に実行されます.
62     * 引数にはdtb_pluginのプラグイン情報が渡されます.
63     *
64     * @param  array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
65     * @return void
66     */
67    public function uninstall($arrPlugin, $objPluginInstaller = null)
68    {
69    }
70
71    /**
72     * 稼働
73     * enableはプラグインを有効にした際に実行されます.
74     * 引数にはdtb_pluginのプラグイン情報が渡されます.
75     *
76     * @param  array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
77     * @return void
78     */
79    public function enable($arrPlugin, $objPluginInstaller = null)
80    {
81    }
82
83    /**
84     * 停止
85     * disableはプラグインを無効にした際に実行されます.
86     * 引数にはdtb_pluginのプラグイン情報が渡されます.
87     *
88     * @param  array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
89     * @return void
90     */
91    public function disable($arrPlugin, $objPluginInstaller = null)
92    {
93    }
94
95    /**
96     * プラグインヘルパーへ, コールバックメソッドを登録します.
97     *
98     * @param object  $objPluginHelper
99     * @param integer $priority
100     */
101    public function register(SC_Helper_Plugin $objHelperPlugin, $priority)
102    {
103        if (isset($this->arrSelfInfo['plugin_hook_point'])) {
104            $arrHookPoints = $this->arrSelfInfo['plugin_hook_point'];
105            foreach ($arrHookPoints as $hook_point) {
106                if (isset($hook_point['callback'])) {
107                    $hook_point_name = $hook_point['hook_point'];
108                    $callback_name   = $hook_point['callback'];
109                    $objHelperPlugin->addAction($hook_point_name, array($this, $callback_name), $priority);
110                }
111            }
112        }
113    }
114
115    /**
116     * このプラグインのプラグイン情報を返す。
117     *
118     * @return array $arrSelfInfo 自身のプラグイン情報
119     */
120    public function getPluginInfo()
121    {
122        return $this->arrSelfInfo;
123    }
124}
Note: See TracBrowser for help on using the repository browser.