1*27bbde00SAndreas Gohr<?php 2*27bbde00SAndreas Gohr/** 3*27bbde00SAndreas Gohr * Embed an image gallery 4*27bbde00SAndreas Gohr * 5*27bbde00SAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6*27bbde00SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 7*27bbde00SAndreas Gohr */ 8*27bbde00SAndreas Gohr 9*27bbde00SAndreas Gohrif(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 10*27bbde00SAndreas Gohrif(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11*27bbde00SAndreas Gohrrequire_once(DOKU_PLUGIN.'syntax.php'); 12*27bbde00SAndreas Gohrrequire_once(DOKU_INC.'inc/search.php'); 13*27bbde00SAndreas Gohrrequire_once(DOKU_INC.'inc/JpegMeta.php'); 14*27bbde00SAndreas Gohr 15*27bbde00SAndreas Gohrclass syntax_plugin_panoview extends DokuWiki_Syntax_Plugin { 16*27bbde00SAndreas Gohr /** 17*27bbde00SAndreas Gohr * return some info 18*27bbde00SAndreas Gohr */ 19*27bbde00SAndreas Gohr function getInfo(){ 20*27bbde00SAndreas Gohr return confToHash(dirname(__FILE__).'/info.txt'); 21*27bbde00SAndreas Gohr } 22*27bbde00SAndreas Gohr 23*27bbde00SAndreas Gohr /** 24*27bbde00SAndreas Gohr * What kind of syntax are we? 25*27bbde00SAndreas Gohr */ 26*27bbde00SAndreas Gohr function getType(){ 27*27bbde00SAndreas Gohr return 'substition'; 28*27bbde00SAndreas Gohr } 29*27bbde00SAndreas Gohr 30*27bbde00SAndreas Gohr /** 31*27bbde00SAndreas Gohr * What about paragraphs? 32*27bbde00SAndreas Gohr */ 33*27bbde00SAndreas Gohr function getPType(){ 34*27bbde00SAndreas Gohr return 'block'; 35*27bbde00SAndreas Gohr } 36*27bbde00SAndreas Gohr 37*27bbde00SAndreas Gohr /** 38*27bbde00SAndreas Gohr * Where to sort in? 39*27bbde00SAndreas Gohr */ 40*27bbde00SAndreas Gohr function getSort(){ 41*27bbde00SAndreas Gohr return 301; 42*27bbde00SAndreas Gohr } 43*27bbde00SAndreas Gohr 44*27bbde00SAndreas Gohr 45*27bbde00SAndreas Gohr /** 46*27bbde00SAndreas Gohr * Connect pattern to lexer 47*27bbde00SAndreas Gohr */ 48*27bbde00SAndreas Gohr function connectTo($mode) { 49*27bbde00SAndreas Gohr $this->Lexer->addSpecialPattern('\{\{panoview>[^}]*\}\}',$mode,'plugin_panoview'); 50*27bbde00SAndreas Gohr } 51*27bbde00SAndreas Gohr 52*27bbde00SAndreas Gohr /** 53*27bbde00SAndreas Gohr * Handle the match 54*27bbde00SAndreas Gohr */ 55*27bbde00SAndreas Gohr function handle($match, $state, $pos, &$handler){ 56*27bbde00SAndreas Gohr global $ID; 57*27bbde00SAndreas Gohr 58*27bbde00SAndreas Gohr $options = array( 59*27bbde00SAndreas Gohr 'width' => 500, 60*27bbde00SAndreas Gohr 'height' => 250, 61*27bbde00SAndreas Gohr 'align' => 'center', 62*27bbde00SAndreas Gohr 63*27bbde00SAndreas Gohr 64*27bbde00SAndreas Gohr 'image' => 'zoom:greetsiel.jpg', 65*27bbde00SAndreas Gohr 'imageWidth' => 7672, 66*27bbde00SAndreas Gohr 'imageHeight' => 1624, 67*27bbde00SAndreas Gohr 'initialZoom' => 2, 68*27bbde00SAndreas Gohr 69*27bbde00SAndreas Gohr 'tileBaseUri' => DOKU_BASE.'lib/plugins/panoview/tiles.php', 70*27bbde00SAndreas Gohr 'tileSize' => 256, 71*27bbde00SAndreas Gohr 'maxZoom' => 10, 72*27bbde00SAndreas Gohr 'blankTile' => DOKU_BASE.'lib/plugins/panoview/gfx/blank.gif', 73*27bbde00SAndreas Gohr 'loadingTile' => DOKU_BASE.'lib/plugins/panoview/gfx/progress.gif', 74*27bbde00SAndreas Gohr 75*27bbde00SAndreas Gohr ); 76*27bbde00SAndreas Gohr 77*27bbde00SAndreas Gohr 78*27bbde00SAndreas Gohr return $options; 79*27bbde00SAndreas Gohr } 80*27bbde00SAndreas Gohr 81*27bbde00SAndreas Gohr /** 82*27bbde00SAndreas Gohr * Create output 83*27bbde00SAndreas Gohr */ 84*27bbde00SAndreas Gohr function render($mode, &$R, $data) { 85*27bbde00SAndreas Gohr if($mode != 'xhtml') return false; 86*27bbde00SAndreas Gohr 87*27bbde00SAndreas Gohr require_once(DOKU_INC.'inc/JSON.php'); 88*27bbde00SAndreas Gohr $json = new JSON(); 89*27bbde00SAndreas Gohr 90*27bbde00SAndreas Gohr $img = '<img src="'.ml($data['image'],array('w'=>$data['width'],'h'=>$data['height'])).'" width="'.$data['width'].'" height="'.$data['height'].'" alt="" />'; 91*27bbde00SAndreas Gohr 92*27bbde00SAndreas Gohr 93*27bbde00SAndreas Gohr $R->doc .= ' 94*27bbde00SAndreas Gohr<div class="panoview_plugin" style="width: '.$data['width'].'px; height: '.$data['height'].'px;"> 95*27bbde00SAndreas Gohr <div class="well">'.$img.'</div> 96*27bbde00SAndreas Gohr <div class="surface"><!-- --></div> 97*27bbde00SAndreas Gohr <p class="controls" style="display: none"> 98*27bbde00SAndreas Gohr <span class="zoomIn" title="Zoom In">+</span> 99*27bbde00SAndreas Gohr <span class="zoomOut" title="Zoom Out">-</span> 100*27bbde00SAndreas Gohr </p> 101*27bbde00SAndreas Gohr <div class="options" style="display:none">'.hsc($json->encode($data)).'</div> 102*27bbde00SAndreas Gohr</div> 103*27bbde00SAndreas Gohr 104*27bbde00SAndreas Gohr'; 105*27bbde00SAndreas Gohr 106*27bbde00SAndreas Gohr 107*27bbde00SAndreas Gohr return true; 108*27bbde00SAndreas Gohr } 109*27bbde00SAndreas Gohr 110*27bbde00SAndreas Gohr 111*27bbde00SAndreas Gohr} 112*27bbde00SAndreas Gohr 113*27bbde00SAndreas Gohr//Setup VIM: ex: et ts=4 enc=utf-8 : 114