source: branches/camp/camp-2_13-plugin/data/class/plugin/SC_Plugin_Base.php @ 22635

Revision 22635, 3.7 KB checked in by adachi, 11 years ago (diff)

#2181 SC_Plugin_Base abstract外す

RevLine 
[21395]1<?php
2/*
3 * This file is part of EC-CUBE
4 *
[22206]5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
[21395]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 */
[22567]33abstract class SC_Plugin_Base
34{
[21395]35
[21794]36    protected $arrSelfInfo;
[21395]37
38    /**
39     * コンストラクタ
[21885]40     *
[21395]41     * @param array $arrSelfInfo 自身のプラグイン情報
42     * @return void
43     */
[22567]44    function __construct(array $arrSelfInfo)
45    {
[21395]46        $this->arrSelfInfo = $arrSelfInfo;
47    }
[21763]48    /**
49     * インストール
50     * installはプラグインのインストール時に実行されます.
51     * 引数にはdtb_pluginのプラグイン情報が渡されます.
52     *
53     * @param array $arrPlugin plugin_infoを元にDBに登録されたプラグイン情報(dtb_plugin)
54     * @return void
55     */
[22635]56    function install($arrPlugin, $objPluginInstaller = null) {
57       
58    }
[21829]59
[21763]60    /**
61     * アンインストール
62     * uninstallはアンインストール時に実行されます.
63     * 引数にはdtb_pluginのプラグイン情報が渡されます.
[21885]64     *
[21763]65     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
66     * @return void
67     */
[22635]68    function uninstall($arrPlugin, $objPluginInstaller = null) {
69       
70    }
[21829]71
[21763]72    /**
73     * 稼働
74     * enableはプラグインを有効にした際に実行されます.
75     * 引数にはdtb_pluginのプラグイン情報が渡されます.
76     *
77     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
78     * @return void
79     */
[22635]80    function enable($arrPlugin, $objPluginInstaller = null) {
81       
82    }
[21829]83
[21763]84    /**
85     * 停止
86     * disableはプラグインを無効にした際に実行されます.
87     * 引数にはdtb_pluginのプラグイン情報が渡されます.
88     *
89     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
90     * @return void
91     */
[22635]92    function disable($arrPlugin, $objPluginInstaller = null) {
93       
94    }
[21794]95
96    /**
97     * プラグインヘルパーへ, コールバックメソッドを登録します.
98     *
99     * @param object $objPluginHelper
100     * @param integer $priority
101     */
[22567]102    function register(SC_Helper_Plugin $objHelperPlugin, $priority)
103    {
[21794]104        if (isset($this->arrSelfInfo['plugin_hook_point'])) {
105            $arrHookPoints = $this->arrSelfInfo['plugin_hook_point'];
106            foreach ($arrHookPoints as $hook_point) {
107                if (isset($hook_point['callback'])) {
108                    $hook_point_name = $hook_point['hook_point'];
109                    $callback_name   = $hook_point['callback'];
110                    $objHelperPlugin->addAction($hook_point_name, array($this, $callback_name), $priority);
111                }
112            }
113        }
114    }
[21885]115
116    /**
117     * このプラグインのプラグイン情報を返す。
118     *
119     * @return array $arrSelfInfo 自身のプラグイン情報
120     */
[22567]121    function getPluginInfo()
122    {
[21885]123        return $this->arrSelfInfo;
124    }
125
[21395]126}
Note: See TracBrowser for help on using the repository browser.