source: branches/camp/camp-2_5-E/data/plugin/TestPlugin1/TestPlugin1.php @ 19565

Revision 19565, 1.7 KB checked in by miningbrownie, 13 years ago (diff)
Line 
1<?php
2
3class TestPlugin1 extends SC_Plugin {
4
5
6
7    function enable(String $classname){
8        return preg_match('/shopping|payment|products/',$classname)?
9        !preg_match('/list/', $classname)
10        :false
11        ;
12    }
13
14    function init(){
15
16    }
17
18
19    function getVersion(){
20        return "0.0.1";
21    }
22
23    function getName(){
24        return "TestPlugin1";
25    }
26
27    function process(){
28
29    }
30
31    function mobileprocess(){
32
33    }
34
35    public function install(){
36        $objQuery = new SC_Query();
37        $arrPlugins = $objQuery->get("dtb_plugin", "plugin_id", "plugin_name = ?",array($name));
38        $data = array(
39          'plugin_name' => $objForm->getValue('plugin_name'),
40          'path' => realpath(DATA_DIR.'/plugin/'.$objForm->getValue('plugin_name').'/'),
41          'enable' => '1',
42          'del_flg' => '0',
43          'class_name' => $objForm->getValue('plugin_name'),
44          'version' => $this->getVersion()
45        );
46        if($this->getInstallSQL() != null){
47            $objQuery->query($this->getInstallSQL());
48        }
49
50        if(count($arrPlugins) == 0){
51            $objQuery->insert("dtb_plugin", $data);
52        }else{
53            $objQuery->update('dtb_plugin',$data,'plugin_id = ?',array($arrPlugins[0]['plugin_id']));
54        }
55
56
57    }
58
59    public function uninstall($plugin_id){
60        $objQuery = new SC_Query();
61        $sql = $this->getUninstallSQL();
62        if($sql != null){
63            $objQuery->query($sql);
64        }
65        return $objQuery->update('dtb_plugin', array('del_flg'=>1), 'plugin_id = ?', $plugin_id);
66       
67    }
68
69    /**
70     *
71     * @return String インストール用のSQL
72     */
73    protected function getInstallSQL(){
74
75    }
76
77
78    protected function getUninstallSQL(){
79
80    }
81
82}
Note: See TracBrowser for help on using the repository browser.