1<?php 2/** 3 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 4 * @author Dan Kreiser <dan.kreiser@gmail.com> 5 */ 6 7// must be run within Dokuwiki 8if(!defined('DOKU_INC')) die(); 9 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(DOKU_PLUGIN.'action.php'); 12 13class action_plugin_googlechart extends DokuWiki_Action_Plugin { 14 15 /** 16 * return some info 17 * 18 * @author Dan Kreiser <dan.kreiser@gmail.com> 19 */ 20 function getInfo(){ 21 return array_merge(confToHash(dirname(__FILE__).'/README'), array('name' => 'Toolbar Component')); 22 } 23 24 /** 25 * register the eventhandlers 26 * 27 */ 28 function register(&$controller){ 29 $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ()); 30 31 } 32 33 34 35 function handle_toolbar(&$event, $param) { 36 $event->data[] =array ( 37 'type' => 'picker', 38 'title' => $this->getLang('google chart api'), 39 'icon' => '../../plugins/googlechart/images/toolbar/buttons/googlechart.png', 40 'list' => array( 41 array( 42 'type' => 'insert', 43 'title' => 'Pie 3D', 44 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/pie3d.png', 45 'insert' => '<googlechart>\ncht=p3\nchs=280x100\nchd=t:10,20,30,40\nchds=0,100\nchl=May|June|July\n</googlechart>\n' 46 ), 47 array( 48 'type' => 'insert', 49 'title' => 'Pie 2D', 50 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/pie2d.png', 51 'insert' => '<googlechart>\ncht=p\nchs=280x100\nchd=t:10,20,30,40\nchds=0,100\nchl=May|June|July\n</googlechart>\n' 52 ), 53 array( 54 'type' => 'insert', 55 'title' => 'Vertical Bars', 56 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/vbar.png', 57 'insert' => '<googlechart>\nchxt=x,x,y,y\ncht=bvs\nchd=s:c9ucD\nchls=2.0\nchs=250x125\nchxl=1:%7CMartinis%7C3:%7CScore\nchxp=1,50%7C3,50\n</googlechart>\n' 58 59 ), 60 array( 61 'type' => 'insert', 62 'title' => 'Horizontal Bars', 63 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/hbar.png', 64 'insert' =>'<googlechart>\nchxt=x,y,r,t\ncht=bhs\nchd=s:EUjVu\nchco=76A4FB\nchls=2.0\nchs=200x190\n</googlechart>\n' 65 ), 66 array( 67 'type' => 'insert', 68 'title' => 'Line Chart', 69 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/line-chart.png', 70 'insert' => '<googlechart>\nchxt=x,x,y,y\ncht=lc\nchd=s:cEAELFJHHHKUju9uuXUc\nchco=76A4FB\nchls=2.0\nchs=200x125\nchxl=1:|Freezing|Hot|3:|Low|High\nchma=40,20,20,30\n</googlechart>\n' 71 ), 72 array( 73 'type' => 'insert', 74 'title' => 'Gauge', 75 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/gauge.png', 76 'insert' => '<googlechart>\nchs=200x125\ncht=gom\nchd=t:70\nchco=FF0000,FF8040,FFFF00,00FF00,00FFFF,0000FF,800080\nchxt=x,y\nchxl=0:|Groovy|1:|slow|faster|crazy\n</googlechart>\n' 77 ), 78 array( 79 'type' => 'insert', 80 'title' => 'LATEX', 81 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/tex.png', 82 'insert' => '<googlechart>\ncht=tx\nchl=NH_K(M)=\left[\sum_{i=1}^{n/2}\left(\left( m_{2i-1}+k_{2i-1}\right) mod 2^w\right)\cdot\left(\left(m_{2i}+k_{2i}\right) mod 2^{w}\right)\right]mod 2^{2w}\n</googlechart>\n' 83 ), 84 array( 85 'type' => 'insert', 86 'title' => 'Notice', 87 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/notice.png', 88 'insert' => '<googlechart>\nchst=d_fnote_title\nchld=pinned_c|1|004400|l|Joe|Today+2-for-1+!|555-1234\n</googlechart>\n' 89 ), 90 array( 91 'type' => 'insert', 92 'title' => 'Venn chart', 93 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/venn.png', 94 'insert' => '<googlechart>\ncht=v\nchs=200x100\nchd=t:100,80,60,30,30,30,10\nchco=FF6342,ADDE63,63C6DE\nchdl=A|B|C\n</googlechart>\n' 95 ), 96 array( 97 'type' => 'insert', 98 'title' => 'Graph', 99 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/graph.png', 100 'insert' => '<googlechart>\ncht=gv:neato\nchl=digraph{A->B->C->A}\nchs=150x150\n</googlechart>\n' 101 ), 102 array( 103 'type' => 'insert', 104 'title' => 'QR', 105 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/qr.png', 106 'insert' => '<googlechart>\ncht=qr\nchs=200x200\nchl=Dokuwiki+is+the+best+wiki\nchoe=UTF-8\n</googlechart>\n' 107 ), 108 array( 109 'type' => 'insert', 110 'title' => 'MAP', 111 'icon' => '../../plugins/googlechart/images/toolbar/googlechart/map.png', 112 'insert' => '<googlechart>\ncht=map:fixed=-60,0,80,-35\nchs=600x350\nchld=CA-BC|CN|IT|GR|US-UT\nchdl=Vancouver|Beijing|Torino|Athens|Salt+Lake+City\nchco=B3BCC0|5781AE|FF0000|FFC726|885E80|518274\nchtt=Last+Five+Olympic+Hosts\nchm=f2010+Winter,000000,0,0,10\nf2008+Summer,000000,0,1,10\nf2008+Winter,000000,0,2,10,1,:-5:10\nf2004+Summer,000000,0,3,10\nf2004+Summer,000000,0,4,10\nchma=0,110,0,0\n</googlechart>\n' 113 ) 114 115 ) 116 ); 117 } 118} 119 120