source: branches/version-2_12-dev/data/class/plugin/SC_Plugin_Util.php @ 21683

Revision 21683, 4.0 KB checked in by Seasoft, 12 years ago (diff)

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

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2011 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// 棒グラフ生成クラス
25class SC_Plugin_Util {
26
27
28
29    /**
30     * 稼働中のプラグインを取得する。
31     */
32    function getEnablePlugin() {
33        $objQuery = new SC_Query_Ex();
34        $col = '*';
35        $table = 'dtb_plugin';
36        $where = 'enable = 1';
37        // XXX 2.11.0 互換のため
38        $arrCols = $objQuery->listTableFields($table);
39        if (in_array('priority', $arrCols)) {
40            $objQuery->setOrder('priority DESC, plugin_id ASC');
41        }
42        $arrRet = $objQuery->select($col,$table,$where);
43        return $arrRet;
44    }
45
46    /**
47     * インストールされているプラグインを取得する。
48     *
49     * @return array $arrRet インストールされているプラグイン.
50     */
51    function getAllPlugin() {
52        $objQuery = new SC_Query_Ex();
53        $col = '*';
54        $table = 'dtb_plugin';
55        // XXX 2.11.0 互換のため
56        $arrCols = $objQuery->listTableFields($table);
57        if (in_array('priority', $arrCols)) {
58            $objQuery->setOrder('plugin_id ASC');
59        }
60        $arrRet = $objQuery->select($col,$table);
61        return $arrRet;
62    }
63
64    /**
65     * プラグインIDをキーにプラグインを取得する。
66     *
67     * @param int $plugin_id プラグインID.
68     * @return array プラグインの基本情報.
69     */
70    function getPluginByPluginId($plugin_id) {
71        $objQuery =& SC_Query_Ex::getSingletonInstance();
72        $col = '*';
73        $table = 'dtb_plugin';
74        $where = 'plugin_id = ?';
75        $plugin = $objQuery->getRow($col, $table, $where, array($plugin_id));
76        return $plugin;
77    }
78
79
80    /**
81     * プラグインコードをキーにプラグインを取得する。
82     *
83     * @param string $plugin_code プラグインコード.
84     * @return array プラグインの基本情報.
85     */
86    function getPluginByPluginCode($plugin_code) {
87        $objQuery =& SC_Query_Ex::getSingletonInstance();
88        $col = '*';
89        $table = 'dtb_plugin';
90        $where = 'plugin_code = ?';
91        $plugin = $objQuery->getRow($col, $table, $where, array($plugin_code));
92        return $plugin;
93    }
94
95    /**
96     * プラグインIDをキーにプラグインを削除する。
97     *
98     * @param string $plugin_id プラグインID.
99     * @return array プラグインの基本情報.
100     */
101    function deletePluginByPluginId($plugin_id) {
102        $objQuery =& SC_Query_Ex::getSingletonInstance();
103        $objQuery->begin();
104        $where = 'plugin_id = ?';
105        $objQuery->delete('dtb_plugin', $where, array($plugin_id));
106        $objQuery->delete('dtb_plugin_hookpoint', $where, array($plugin_id));
107    }
108
109    /**
110     * プラグインディレクトリの取得
111     *
112     * @return array $arrPluginDirectory
113     */
114    function getPluginDirectory() {
115        $arrPluginDirectory = array();
116        if (is_dir(PLUGIN_UPLOAD_REALDIR)) {
117            if ($dh = opendir(PLUGIN_UPLOAD_REALDIR)) {
118                while (($pluginDirectory = readdir($dh)) !== false) {
119                    $arrPluginDirectory[] = $pluginDirectory;
120                }
121                closedir($dh);
122            }
123        }
124        return $arrPluginDirectory;
125    }
126}
Note: See TracBrowser for help on using the repository browser.