DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:previous

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:previous [2010-11-03 16:14] – [previous plugin] Theo-Kplugin:previous [2015-05-27 22:36] (current) Klap-in
Line 19: Line 19:
 In your plugins folder create a folder named "previous". In this folder you create the file syntax.php with the following content In your plugins folder create a folder named "previous". In this folder you create the file syntax.php with the following content
  
-<code php>+<code php syntax.php>
 <?php <?php
 /** /**
Line 31: Line 31:
 if (!defined('DOKU_INC')) die(); if (!defined('DOKU_INC')) die();
  
-if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); 
-if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); 
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
- 
-require_once DOKU_PLUGIN.'syntax.php'; 
  
 class syntax_plugin_previous extends DokuWiki_Syntax_Plugin { class syntax_plugin_previous extends DokuWiki_Syntax_Plugin {
Line 46: Line 41:
  
  
-    function handle($match, $state, $pos, &$handler){+    function handle($match, $state, $pos, Doku_Handler $handler){
  $match = substr($match, 8, -2);  $match = substr($match, 8, -2);
         list($url, $alt)   = explode('>',$match,2);         list($url, $alt)   = explode('>',$match,2);
Line 59: Line 54:
  
  
- function render($mode, &$R, $data) {+ function render($mode, Doku_Renderer $R, $data) {
         if($mode != 'xhtml') return false;         if($mode != 'xhtml') return false;
  
-        if(!$data['url']){ 
             $R->doc .= '<div class="plugin_previous">';             $R->doc .= '<div class="plugin_previous">';
             $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">';             $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">';
Line 68: Line 62:
             $R->doc .= '</a>';             $R->doc .= '</a>';
             $R->doc .= '</div>';             $R->doc .= '</div>';
-        }else{ +
-            $opts = array( +
-                        'title' => $data['alt'], +
-                        'src'   => $data['url'], +
-                        'style' => 'width:'.$data['width'].'; height:'.$data['height'], +
-                        ); +
-            if(!$data['border']) $opts['frameborder'] = 0; +
-            if(!$data['scroll']) $opts['scrolling'] = 'no'; +
-            if($data['align'])   $opts['align'] = $data['align']; +
-            $params = buildAttributes($opts); +
-  +
-            $R->doc .= '<div class="plugin_previous">'; +
-            $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">'; +
-            $R->doc .= hsc($data['alt']); +
-            $R->doc .= '</a>'; +
-            $R->doc .= '</div>'; +
-        }+
         return true;         return true;
  }  }
Line 96: Line 74:
 If you want an other color or anything; create a style.css file within the Previous map, with for example: If you want an other color or anything; create a style.css file within the Previous map, with for example:
  
-<code css>+<code css style.css>
 div.plugin_previous a{ div.plugin_previous a{
   color: #007500 !important;   color: #007500 !important;
plugin/previous.txt · Last modified: 2015-05-27 22:36 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki