1 | <?php |
---|
2 | |
---|
3 | class SC_Helper_Plugin{ |
---|
4 | |
---|
5 | /** |
---|
6 | * enableかどうかを判別する |
---|
7 | * インスタンス化 |
---|
8 | */ |
---|
9 | public static function load(LC_Page $lcpage){ |
---|
10 | //データベースからクラス名を読み込む |
---|
11 | $objQuery = new SC_Query(); |
---|
12 | $col = "*"; |
---|
13 | $table = "dtb_plugin"; |
---|
14 | $where = "enable = 1 AND del_flg = 0"; |
---|
15 | $arrRet = $objQuery->select($col, $table, $where); |
---|
16 | $arrEnablePlugins = array(); |
---|
17 | $class_name = get_class($lcpage); |
---|
18 | |
---|
19 | // 実行されたぺーじ |
---|
20 | // 現在のページで使用するプラグインが存在するかどうかを検証する |
---|
21 | foreach ($arrRet as $key => $value){ |
---|
22 | // プラグインを稼働させるクラス名のリストを取得する |
---|
23 | // プラグインのディレクトリ内の設定ファイルを参照する |
---|
24 | require_once DATA_PATH.'plugin/'.$value['class_name'].'/config.php'; |
---|
25 | if( in_array($class_name,$arrPluginPageList) == true ){ |
---|
26 | require_once DATA_PATH.'plugin/'.$value['class_name'].'/'.$value['class_name'].'.php'; |
---|
27 | $arrPluginList[] = $value['class_name']; |
---|
28 | } |
---|
29 | } |
---|
30 | return $arrPluginList; |
---|
31 | } |
---|
32 | |
---|
33 | /* 読み込んだプラグインの実行用メソッド |
---|
34 | * |
---|
35 | */ |
---|
36 | public static function process(LC_Page $lcpage){ |
---|
37 | //プラグインの名前を判別してページ内で有効なプラグインがあれば実行する |
---|
38 | $arrPluginList = SC_Helper_Plugin::load($lcpage); |
---|
39 | if(count($arrPluginList) > 0){ |
---|
40 | foreach ($arrPluginList as $key => $value){ |
---|
41 | $instance = new $value; |
---|
42 | $instance->process($lcpage); |
---|
43 | } |
---|
44 | } |
---|
45 | return $lcpage; |
---|
46 | } |
---|
47 | |
---|
48 | /** |
---|
49 | * 稼働中のプラグインを取得する。 |
---|
50 | */ |
---|
51 | public static function getEnablePlugin(){ |
---|
52 | $objQuery = new SC_Query(); |
---|
53 | $col = '*'; |
---|
54 | $table = 'dtb_plugin'; |
---|
55 | $where = 'enable = 1 AND del_flg = 0'; |
---|
56 | $arrRet = $objQuery->select($col,$table,$where); |
---|
57 | return $arrRet; |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * インストールされているプラグインを取得する。 |
---|
62 | */ |
---|
63 | public static function getAllPlugin(){ |
---|
64 | $objQuery = new SC_Query(); |
---|
65 | $col = '*'; |
---|
66 | $table = 'dtb_plugin'; |
---|
67 | $where = 'del_flg = 0'; |
---|
68 | $arrRet = $objQuery->select($col,$table,$where); |
---|
69 | return $arrRet; |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | public static function getFilesystemPlugins(){ |
---|
74 | |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|