From 68656728cf13ee1317e9082ae3705ca7bb7a1392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ctibor=20Bran=C4=8D=C3=ADk?= Date: Wed, 23 Mar 2016 20:43:48 +0100 Subject: Add imagebox and note plugins. --- lib/plugins/imagebox/conf/default.php | 4 ++ lib/plugins/imagebox/conf/metadata.php | 4 ++ lib/plugins/imagebox/lang/ar/lang.php | 2 + lib/plugins/imagebox/lang/bg/lang.php | 2 + lib/plugins/imagebox/lang/ca/lang.php | 2 + lib/plugins/imagebox/lang/cs/lang.php | 2 + lib/plugins/imagebox/lang/da/lang.php | 2 + lib/plugins/imagebox/lang/de/lang.php | 2 + lib/plugins/imagebox/lang/el/lang.php | 2 + lib/plugins/imagebox/lang/en/lang.php | 2 + lib/plugins/imagebox/lang/eo/lang.php | 2 + lib/plugins/imagebox/lang/es/lang.php | 2 + lib/plugins/imagebox/lang/et/lang.php | 2 + lib/plugins/imagebox/lang/eu/lang.php | 2 + lib/plugins/imagebox/lang/fi/lang.php | 2 + lib/plugins/imagebox/lang/fo/lang.php | 2 + lib/plugins/imagebox/lang/fr/lang.php | 2 + lib/plugins/imagebox/lang/gl/lang.php | 2 + lib/plugins/imagebox/lang/he/lang.php | 2 + lib/plugins/imagebox/lang/hr/lang.php | 2 + lib/plugins/imagebox/lang/hu/lang.php | 2 + lib/plugins/imagebox/lang/id/lang.php | 2 + lib/plugins/imagebox/lang/it/lang.php | 2 + lib/plugins/imagebox/lang/ja/lang.php | 2 + lib/plugins/imagebox/lang/ko/lang.php | 2 + lib/plugins/imagebox/lang/ku/lang.php | 2 + lib/plugins/imagebox/lang/lt/lang.php | 2 + lib/plugins/imagebox/lang/lv/lang.php | 2 + lib/plugins/imagebox/lang/mg/lang.php | 2 + lib/plugins/imagebox/lang/nl/lang.php | 2 + lib/plugins/imagebox/lang/no/lang.php | 2 + lib/plugins/imagebox/lang/pl/lang.php | 2 + lib/plugins/imagebox/lang/pt/lang.php | 2 + lib/plugins/imagebox/lang/ro/lang.php | 2 + lib/plugins/imagebox/lang/ru/lang.php | 2 + lib/plugins/imagebox/lang/sk/lang.php | 2 + lib/plugins/imagebox/lang/sl/lang.php | 2 + lib/plugins/imagebox/lang/sr/lang.php | 2 + lib/plugins/imagebox/lang/sv/lang.php | 2 + lib/plugins/imagebox/lang/tr/lang.php | 2 + lib/plugins/imagebox/lang/uk/lang.php | 2 + lib/plugins/imagebox/lang/vi/lang.php | 2 + lib/plugins/imagebox/lang/zh/lang.php | 2 + lib/plugins/imagebox/magnify-clip.png | Bin 0 -> 267 bytes lib/plugins/imagebox/style.css | 60 +++++++++++++++++ lib/plugins/imagebox/syntax.php | 119 +++++++++++++++++++++++++++++++++ 46 files changed, 269 insertions(+) create mode 100755 lib/plugins/imagebox/conf/default.php create mode 100755 lib/plugins/imagebox/conf/metadata.php create mode 100755 lib/plugins/imagebox/lang/ar/lang.php create mode 100755 lib/plugins/imagebox/lang/bg/lang.php create mode 100755 lib/plugins/imagebox/lang/ca/lang.php create mode 100755 lib/plugins/imagebox/lang/cs/lang.php create mode 100755 lib/plugins/imagebox/lang/da/lang.php create mode 100755 lib/plugins/imagebox/lang/de/lang.php create mode 100755 lib/plugins/imagebox/lang/el/lang.php create mode 100755 lib/plugins/imagebox/lang/en/lang.php create mode 100755 lib/plugins/imagebox/lang/eo/lang.php create mode 100755 lib/plugins/imagebox/lang/es/lang.php create mode 100755 lib/plugins/imagebox/lang/et/lang.php create mode 100755 lib/plugins/imagebox/lang/eu/lang.php create mode 100755 lib/plugins/imagebox/lang/fi/lang.php create mode 100755 lib/plugins/imagebox/lang/fo/lang.php create mode 100755 lib/plugins/imagebox/lang/fr/lang.php create mode 100755 lib/plugins/imagebox/lang/gl/lang.php create mode 100755 lib/plugins/imagebox/lang/he/lang.php create mode 100755 lib/plugins/imagebox/lang/hr/lang.php create mode 100755 lib/plugins/imagebox/lang/hu/lang.php create mode 100755 lib/plugins/imagebox/lang/id/lang.php create mode 100755 lib/plugins/imagebox/lang/it/lang.php create mode 100755 lib/plugins/imagebox/lang/ja/lang.php create mode 100755 lib/plugins/imagebox/lang/ko/lang.php create mode 100755 lib/plugins/imagebox/lang/ku/lang.php create mode 100755 lib/plugins/imagebox/lang/lt/lang.php create mode 100755 lib/plugins/imagebox/lang/lv/lang.php create mode 100755 lib/plugins/imagebox/lang/mg/lang.php create mode 100755 lib/plugins/imagebox/lang/nl/lang.php create mode 100755 lib/plugins/imagebox/lang/no/lang.php create mode 100755 lib/plugins/imagebox/lang/pl/lang.php create mode 100755 lib/plugins/imagebox/lang/pt/lang.php create mode 100755 lib/plugins/imagebox/lang/ro/lang.php create mode 100755 lib/plugins/imagebox/lang/ru/lang.php create mode 100755 lib/plugins/imagebox/lang/sk/lang.php create mode 100755 lib/plugins/imagebox/lang/sl/lang.php create mode 100755 lib/plugins/imagebox/lang/sr/lang.php create mode 100755 lib/plugins/imagebox/lang/sv/lang.php create mode 100755 lib/plugins/imagebox/lang/tr/lang.php create mode 100755 lib/plugins/imagebox/lang/uk/lang.php create mode 100755 lib/plugins/imagebox/lang/vi/lang.php create mode 100755 lib/plugins/imagebox/lang/zh/lang.php create mode 100755 lib/plugins/imagebox/magnify-clip.png create mode 100755 lib/plugins/imagebox/style.css create mode 100755 lib/plugins/imagebox/syntax.php (limited to 'lib/plugins/imagebox') diff --git a/lib/plugins/imagebox/conf/default.php b/lib/plugins/imagebox/conf/default.php new file mode 100755 index 000000000..9d8a2655c --- /dev/null +++ b/lib/plugins/imagebox/conf/default.php @@ -0,0 +1,4 @@ + array('If necessary','Always','Never')); +$meta['center_align'] = array('onoff'); +$meta['default_caption_style'] = array('multichoice','_choices' => array('Normal','Italic','Bold')); \ No newline at end of file diff --git a/lib/plugins/imagebox/lang/ar/lang.php b/lib/plugins/imagebox/lang/ar/lang.php new file mode 100755 index 000000000..54c0c801b --- /dev/null +++ b/lib/plugins/imagebox/lang/ar/lang.php @@ -0,0 +1,2 @@ +, myst6re + */ + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +class syntax_plugin_imagebox extends DokuWiki_Syntax_Plugin { + + function getInfo(){ + return array( + 'author' => 'FFTiger / myst6re', + 'email' => 'myst6re@wikisquare.com', + 'date' => '2010-05-30', + 'name' => 'Imagebox Plugin', + 'desc' => 'Entoure les images avec un cadre de décoration.', + 'url' => 'http://www.wikisquare.com/', + ); + } + + function getType(){ return 'protected'; } + function getAllowedTypes() { return array('substition','protected','disabled','formatting'); } + function getSort(){ return 315; } + function getPType(){ return 'block'; } + function connectTo($mode) { $this->Lexer->addEntryPattern('\[\{\{[^\|\}]+\|*(?=[^\}]*\}\}\])',$mode,'plugin_imagebox'); } + function postConnect() { $this->Lexer->addExitPattern('\}\}\]','plugin_imagebox'); } + + function handle($match, $state, $pos, &$handler){ + switch($state){ + case DOKU_LEXER_ENTER: + $match=Doku_Handler_Parse_Media(substr($match,3)); + $match['w'] = $match['width']; + $dispMagnify = ($match['w'] || $match['height']) && $this->getConf('display_magnify')=='If necessary' || $this->getConf('display_magnify')=='Always'; + + $gimgs = false; + list($src,$hash) = explode('#',$match['src'],2); + + if($match['type']=='internalmedia') { + global $ID; + $exists = false; + resolve_mediaid(getNS($ID), $src, $exists); + + if($dispMagnify) { + $match['detail'] = ml($src,array('id'=>$ID,'cache'=>$match['cache']),($match['linking']=='direct')); + if($hash) $match['detail'] .= '#'.$hash; + } + + if($exists) $gimgs = @getImageSize(mediaFN($src)); + } + else { + if($dispMagnify) { + $match['detail'] = ml($src,array('cache'=>'cache'),false); + if($hash) $match['detail'] .= '#'.$hash; + } + + $gimgs = @getImageSize($src); + } + + $match['exist'] = $gimgs!==false; + + if(!$match['w'] && $match['exist']){ + ($match['height'])? + $match['w'] = $match['height']*$gimgs[0]/$gimgs[1]: + $match['w'] = $gimgs[0]; + } + + if(!$match['align'] || $match['align']=='center'&&!$this->getConf('center_align')) + $match['align'] = 'rien'; + return array($state,$match); + + case DOKU_LEXER_UNMATCHED: + return array($state,$match); + + case DOKU_LEXER_EXIT: + return array($state,$match); + } + } + + function render($mode, &$renderer, $data){ + if($mode == 'xhtml'){ + list($state,$match) = $data; + + switch($state){ + case DOKU_LEXER_ENTER: + $renderer->doc.= '
'; + if($match['exist']) + $renderer->$match['type']($match['src'],$match['title'],'box2',$match['width'],$match['height'],$match['cache'],$match['linking']); + else + $renderer->doc.= 'Invalid Link'; + $renderer->doc.= '
'; + if($match['detail']) { + $renderer->doc.= ''; + } + break; + + case DOKU_LEXER_UNMATCHED: + $style=$this->getConf('default_caption_style'); + if($style=='Italic') $renderer->doc .= ''.$renderer->_xmlEntities($match).''; + elseif($style=='Bold') $renderer->doc .= ''.$renderer->_xmlEntities($match).''; + else $renderer->doc .= $renderer->_xmlEntities($match); + break; + + case DOKU_LEXER_EXIT: + $renderer->doc.= '
'; + break; + } + return true; + } + return false; + } +} + +//Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3