プラグインの作成方法

プラグインの使い方

ルートIDを引数にして、Pukiwiki に次のように記述すればよい

&route(91d77cdc5f1fb99291550adc714ee9d4);

添付ファイルの使い方

<?php
function plugin_js_inline(){
  global $vars;

  $aryargs = func_get_args();
  $arylength = func_num_args();

  $attach_file = '/pukiwiki/index.php?plugin=attach&pcmd=open&file=' . urlencode($aryargs[0]) . '&refer=' . urlencode($vars['page']);

  $size = '';
  if ($arylength == 3) {
    $size = ' width="' . $aryargs[1] . '" height="' . $aryargs[2] . '"';
  }

  return '<iframe src="' . $attach_file . '"' . $size . ' style="border:solid"></iframe>';
}
?>

ページ名は グローバル変数 $vars に 'page' をキーに格納されている

 
&js(sample.html,320,240);

[source] [reload]

Youtube

<?php
function plugin_youtube_inline(){
  $aryargs = func_get_args();
  $arylength = func_num_args();
  
  $videoId = $aryargs[0];
  $width = 512;
  $height = 384;

  if (func_num_args() > 2){
    if ($aryargs[1] == '4:3s') {
      $width = 256;
      $height = 192;
    } else if ($aryargs[1] == '4:3') {
      $width = 512;
      $height = 384;    
    } else if ($aryargs[1] == '16:9s') {
      $width = 320;
      $height = 192;    
    } else if ($aryargs[1] == '16:9') {
      $width = 640;
      $height = 384;    
    } 
  }

  return '<object width="' . $width . '" height="' . $height . '">'
         . '<param name="movie" value="http://www.youtube.com/v/' . $videoId . '"></param>'
         . '<embed src="http://www.youtube.com/v/' . $videoId . '" '
         . ' type="application/x-shockwave-flash"'
         . ' wmode="transparent" width="'. $width . '" height="' . $height . '"></embed>'
         . '</object>'; 
}
?>

Google Docs

<?php
function plugin_gdoc_inline(){
  global $vars;

  $aryargs = func_get_args();
  $arylength = func_num_args();
  
  $size = ''; 
  if ($arylength == 5) {
    $size = ' width="' . $aryargs[2] . '" height="' . $aryargs[3] . '"';
  }

  if ($aryargs[0] == 'spreadsheet'){
    return '<iframe src="https://spreadsheets.google.com/spreadsheet/ccc?key='
      . $aryargs[1] 
      . '&hl=ja&ui=2&rm=demo&chrome=false#gid=0" style="border:solid" ' . $size . '>'
      . '</iframe>';
  }
}
?>

Google Chart API で数式

経過日を表示する

?.jpg.to

Graphviz

#graphviz{{{
digraph {
node [shape = box, fontname = "sans-serif", fontsize = 8];
"オブジェクト型"->"コンテナ型"
"オブジェクト型"->"None"
"オブジェクト型"->"数値型"
"数値型"->"bool"
"数値型"->"int"
"数値型"->"float"
"数値型"->"Complex\n(複素数)"
"コンテナ型"->"シーケンス型"
"シーケンス型"->"list"
"シーケンス型"->"tuple\n(変更不可list)"
"シーケンス型"->"文字列"
"シーケンス型"->"range"
"コンテナ型"->"集合型"
"集合型"->"set"
"集合型"->"frozenset\n(変更不可set)"
"コンテナ型"->"マップ型"
"マップ型"->"Dictionary"
"iteratable"->"list"
"iteratable"->"tuple\n(変更不可list)"
"iteratable"->"文字列"
"iteratable"->"range"
"iteratable"->"set"
"iteratable"->"frozenset\n(変更不可set)"
"iteratable"->"Dictionary"
}
&#x7d;&#x7d;&#x7d;

a graph image


FrontPage


添付ファイル: filesample.html 4451件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2014-02-25 (火) 01:39:59 (3706d)
Short-URL: https://at-sushi.com:443/pukiwiki/index.php?cmd=s&k=9fe4d6d099
ISBN10
ISBN13
9784061426061