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

Revision 22857, 3.6 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。
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    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    abstract function install($arrPlugin);
56
57    /**
58     * アンインストール
59     * uninstallはアンインストール時に実行されます.
60     * 引数にはdtb_pluginのプラグイン情報が渡されます.
61     *
62     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
63     * @return void
64     */
65    abstract function uninstall($arrPlugin);
66
67    /**
68     * 稼働
69     * enableはプラグインを有効にした際に実行されます.
70     * 引数にはdtb_pluginのプラグイン情報が渡されます.
71     *
72     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
73     * @return void
74     */
75    abstract function enable($arrPlugin);
76
77    /**
78     * 停止
79     * disableはプラグインを無効にした際に実行されます.
80     * 引数にはdtb_pluginのプラグイン情報が渡されます.
81     *
82     * @param array $arrPlugin プラグイン情報の連想配列(dtb_plugin)
83     * @return void
84     */
85    abstract function disable($arrPlugin);
86
87    /**
88     * プラグインヘルパーへ, コールバックメソッドを登録します.
89     *
90     * @param object $objPluginHelper
91     * @param integer $priority
92     */
93    function register(SC_Helper_Plugin $objHelperPlugin, $priority)
94    {
95        if (isset($this->arrSelfInfo['plugin_hook_point'])) {
96            $arrHookPoints = $this->arrSelfInfo['plugin_hook_point'];
97            foreach ($arrHookPoints as $hook_point) {
98                if (isset($hook_point['callback'])) {
99                    $hook_point_name = $hook_point['hook_point'];
100                    $callback_name   = $hook_point['callback'];
101                    $objHelperPlugin->addAction($hook_point_name, array($this, $callback_name), $priority);
102                }
103            }
104        }
105    }
106
107    /**
108     * このプラグインのプラグイン情報を返す。
109     *
110     * @return array $arrSelfInfo 自身のプラグイン情報
111     */
112    function getPluginInfo()
113    {
114        return $this->arrSelfInfo;
115    }
116}
Note: See TracBrowser for help on using the repository browser.