09
November 2006

pukiwiki プラグイン開発覚え書き1

pukiwiki プラグインを作成する上での覚え書きです。

(1) 定数の定義

     define('定数名', 値);

(2) プラグイン形式に対応した関数定義

   プラグイン名が、"test" だった場合、

     ファイル名 :  test.inc.php

     インライン型関数名 : plugin_test_inline

     ブロック型関数名 : plugin_test_convert


(3) プラグイン引数の取得

      引数の数 :   func_num_args();

      引数の値 :  func_get_args();

 

$args = func_get_args();
for ($idx = 0; $idx < func_num_args(); ++$idx) {
    $result .= $args[$idx] . "<br/>";
}

(4) ファイル名ボディ取得

$file = basename(\\aaaa\bbb\ccc.txt)

(5) config データの作成

     plugin は固有のデータを持つことができます。これらは、wiki ページとして作成されますが、

    特殊な名前を用いることで、通常のページからアクセスできないようになっています。

コンフィグページ名ルール  

 :config/plugin/<プラグイン名>/<コンフィグページ名>  

ex) :config/plugin/test/test_data 

(6)     データの記述方法

   config データは、wiki のテーブル記述方式で、2次元配列まで(?)記述できるようです。

  また、データは複数記述することができます。

記述方法 記述例1 記述例2

* <データ名>          

|Data type|h

|<データ1>|

|<データ2>|

|<データ3>|

* DataType                  

|DataType|h

|integer|

|string|

|double|

|bool|

* TitleList

|Index|Id|Title|Comment|h

|1|id1|テスト1|コメント1|

|2|id2|テスト2|コメント2|        

* SelectList

|Title|Value|h

|選択肢1|100| 

|選択肢2|200| 

 

 (7) config データの読み込み方

     ・ config へのパスは、 plugin からのパスとなる

     ・ Config クラス生成時に、config データがない場合は、 Config::read で失敗する。

  ・  Config::get で、簡単に配列データを取得できる。


define('CONFIG_NAME','test_data');


$config = new Config("plugin/test/".CONFIG_NAME);
$config->config_name = CONFIG_NAME;

if ($config->read() == false) {
    return "read error.";
}

$data_type = $config->get('DataType');

foreach ($data_type as $type) {
    $result .= $type."<br/>"
}

     Config クラスは、 pukiwiki\lib\config.php にあります。その中からの使用方法の引用をみると

   config データを動的に変更したりできるようです。

/*
 * $obj = new Config('plugin/plugin_name/')
 * $obj->read();
 * $array = & $obj->get($title);
 * $array[] = array(4, 5, 6);  // Add - directly
 * $obj->add($title, array(4, 5, 6)); // Add - method of Config object
 * $array = array(1=>array(1, 2, 3));  // Replace - directly
 * $obj->put($title, array(1=>array(1, 2, 3)); // Replace - method of Config object
 * $obj->put_values($title, NULL); // Delete
 * $obj->write();
 */

 

 


Posted by kei at 07:04 | Comments (433) | Trackbacks (0)
<< COREBlogのFormat | Main | Apache 2.2 インストールメモ >>
Comments
Re: pukiwiki プラグイン開発覚え書き1

blood type 0 diet Blood type 0 diet . erotic group sex story Erotic group sex story . wife sex thumb Wife sex thumb . 663792

Posted by: wife sex thumb at January 15,2008 02:15
Re: pukiwiki プラグイン開発覚え書き1

explicite sex Explicite sex . swinger sex groups Swinger sex groups . male masturbation toy Male masturbation toy . 674439

Posted by: male masturbation toy at January 23,2008 10:59
Re: pukiwiki プラグイン開発覚え書き1

chubby fucking mature Chubby fucking mature . russian suck teen Russian suck teen . directory newspaper wv yahoo Directory newspaper wv yahoo . 329537

Posted by: directory newspaper wv yahoo at January 27,2008 09:22