From e435eb82588cb71735260d9700e2e0bb0a8e311b Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 25 Oct 2013 15:14:59 +0200 Subject: [PATCH] initial commit --- README.md | 11 +++- action.php | 35 ++++++++++++ example/example.png | Bin 0 -> 12410 bytes plugin.info.txt | 7 +++ script.js | 14 +++++ style.css | 10 ++++ syntax.php | 132 ++++++++++++++++++++++++++++++++++++++++++++ textrotate.png | Bin 0 -> 356 bytes 8 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 action.php create mode 100644 example/example.png create mode 100644 plugin.info.txt create mode 100644 script.js create mode 100644 style.css create mode 100644 syntax.php create mode 100644 textrotate.png diff --git a/README.md b/README.md index eb63f82..bc4460c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -textrotate -========== +====== Textrotate Plugin for DokuWiki ====== -textrotate +All documentation for the Tagfilter Plugin is available online at: + + * http://dokuwiki.org/plugin:textrotate + +(c) 2013 by lisps + +See LICENSE for license info. \ No newline at end of file diff --git a/action.php b/action.php new file mode 100644 index 0000000..35a3b22 --- /dev/null +++ b/action.php @@ -0,0 +1,35 @@ +register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ()); + } + + /** + * Inserts the toolbar button + */ + function insert_button(&$event, $param) { + $event->data[] = array( + 'type' => 'format', + 'title' => 'Vertikaler Text generieren', + 'icon' => '../../plugins/textrotate/textrotate.png', + 'sample'=> 'Vertikaler Text', + 'open' => '!!', + 'close' =>'!!', + 'insert'=>'', + ); + } +} diff --git a/example/example.png b/example/example.png new file mode 100644 index 0000000000000000000000000000000000000000..f17ebe673d92b607d125770d4b0ff6372a552dae GIT binary patch literal 12410 zcmeHOd0dlcwx*pf(`mK0wTj9%<3^PNbtr^2v{qD#!nlDZKq`nx79s=)5SDRlu|fl* zh*;TL7bwy%F+dVR2y}`h6$q&YvO*9d#1J5c5Fl*1UqAstdi74{{^s7_{e#~ZKJu>T zJm)#*d0)=`#dr6LKdk?QiHXSy?>##Yn3%jA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GJW&{ znLc=52`JEM$vS2lV>#ZE%e!6~nmnHi(JUS7~wrD>8mxCc*3tNS&@_q9!(6)3aY&nIz64iPyX zhAA+q4gT{igSCE9Lexer->addSpecialPattern("]*>",$mode,'plugin_rotate'); + $this->Lexer->addEntryPattern( + '!!(?=.*!!)', + $mode, + 'plugin_textrotate' + ); + } + + function postConnect() { + $this->Lexer->addExitPattern( + '!!', + 'plugin_textrotate' + ); + } + + /* + * Handle the matches + */ + function handle($match, $state, $pos, &$handler){ + + switch ($state) { + case DOKU_LEXER_ENTER : + //$match=trim(substr($match,7,strlen($match)-7-1)); + //$opts["text"]=$match; + return array($state, array('')); + + case DOKU_LEXER_UNMATCHED : + return array($state, $match); + case DOKU_LEXER_EXIT : + return array($state, ''); + } + return $array(); + } + + + /* + * Create output + */ + function render($mode, &$renderer, $data) + { + global $INFO; + + list($state,$opt) = $data; + if($state != DOKU_LEXER_UNMATCHED) return true; + + if($mode == 'metadata') return false; + if($mode == 'xhtml') { + //disable caching + $basedir ='lib/images/tmp'; + $opt_r = explode('\\',$opt); + //$renderer->doc .= ''; + foreach($opt_r as $opt){ + $text = trim(utf8_decode($opt)); + + $img_name = sha1($text); + $file = $basedir.'/'. $img_name .'.png'; + + if(!file_exists($file)||true) { + @mkdir($basedir,777,true); + + $width = 15; + $height = strlen($text)*10; + $img = ImageCreate($width, $height); + + $black = ImageColorAllocate($img, 0, 0, 0); + $white = ImageColorAllocate($img, 255, 255, 255); + $blau = ImageColorAllocate($img, 0, 64, 128); + + ImageColorTransparent($img,$white); + ImageFill($img, 0, 0, $white); + + + $image_height = ImageSY($img); + imagestringup($img, 5, 0, $height-5, $text, $black); + ImagePNG($img,$file); + + } + //".$renderer->_xmlEntities($opt)." + + $renderer->doc .="adsf"; + } + //$renderer->doc .=""; + //$renderer->doc .="
"; + + } + else { + $renderer->doc .=str_replace('//',' ',$text); + } + return true; + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/textrotate.png b/textrotate.png new file mode 100644 index 0000000000000000000000000000000000000000..5fd125637b407723496a31d5bdbbc30bf20c2f8c GIT binary patch literal 356 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgfAgYLe1{c8HV4i;saeIW zci_YXOY7iubF@>=Fy2|%>GEUAO0BCxOb4s$>gpKmn|`mGT_}2{aKe=s%RS%E%T4^! zC&n-_ghO%v>qmhb?qo(+dM~S)`&{z&HpQh^yz^#Pgp{8<7{xs);<~6xzr|LbwIV*3 zTT&whlHY`eZ9Avt6~y6qOhWY7qKQjRxiCnyF)o2ZO4XCYZm? rTC+!G$4~KF!9UD?E>W2NFMJOJ$J!*x|JLz^Apd!~`njxgN@xNAZ^42B literal 0 HcmV?d00001