2 class NP_PrePluginOptionsUpdate_TestCase1 extends NucleusPlugin {
4 // --------- Plug-in Info ---------------------------------
7 return 'NP_PrePluginOptionsUpdate_TestCase1';
11 function getAuthor() {
14 // an URL to the plugin website
16 return 'http://budts.be/weblog/';
19 // version of the plugin
20 function getVersion() {
24 // a description to be shown on the installed plugins listing
25 function getDescription() {
26 return 'A plugin to test the PrePluginOptionsUpdate event and the enhancement to the PrePluginOptionsEdit event';
29 function getEventList() { return array('PrePluginOptionsUpdate', 'PrePluginOptionsEdit'); }
32 $this->createItemOption('TestValue', 'TestOption', 'text', 'foobar', '');
33 $this->createMemberOption('MemberTestOptions', 'TestOption', 'text', 'foobar-member', '');
37 function supportsFeature($what) {
39 case 'SqlTablePrefix':
46 function event_PrePluginOptionsUpdate(&$data) {
47 if ($this->getID() == $data['plugid']) {
48 //this belongs to us :-)
49 //echo "PrePluginOptionsUpdate: TestCase-plugin<br/>";
50 //echo "optionname: ".$data['optionname']."<br/>";
51 //echo "context: ".$data['context']."<br/>";
52 //echo "contextid: ".$data['contextid']."<br/>";
53 //echo "value: ".$data['value']."<br/>";
54 if ($data['value'] == '') {
55 $data['value'] = 'no-value';
57 $data['value'] .= '-TEST';
59 //echo "new value: ".$data['value']."<br /><br/>";
62 if ($data['optionname'] == 'TestValue') {
63 $data['value'] .= '|||'.requestVar('np_testcase_item');
68 // function event_PrePluginOptionsEdit(&$data){
69 // echo 'event: PrePluginOptionsEdit<br/>';
70 // echo '$data: '.$data.'<br/>';
71 // echo 'context: '.$data['context'].'<br/>';
72 // echo 'contextid: '.$data['contextid'].'<br/>';
73 // for ($i == 0; $i < count($data['options']); $i++) {
74 // echo 'option-name: '.$data['options'][$i]['name'].' value: '.$data['options'][$i]['value'].'<br/>';
75 // echo 'extra: '.$data['options'][$i]['extra'].'<br/>';
76 // // $data['options'][$i]['extra'] .= 'test';
77 // // echo 'new extra: '.$data['options'][$i]['extra'].'<br/>';
81 function event_PrePluginOptionsEdit(&$data) {
82 //echo 'PrePluginOptionsEdit ';
83 // if ($data['context'] == 'item') {
84 //foreach($data['options'] as $option) {
85 foreach (array_keys($data['options']) as $optionKey) {
86 $option = &$data['options'][$optionKey];
87 // if (($option['pid'] == $this->getID)&&($option['name'] == 'TestValue')) {
88 if (($option['name'] == 'TestValue') && ($option['pid'] == $this->getID())) {
89 $option['extra'] .= ' <input type="text" name="np_testcase_item" />';
90 //echo 'Extra: '.$option['extra'].'<br/>';