DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:pagetemplate:listing

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:pagetemplate:listing [2011-07-11 23:02] – [/lib/plugins/pagetemplate/action.php] 70.25.127.226plugin:pagetemplate:listing [2023-09-01 15:16] (current) Klap-in
Line 1: Line 1:
- +<sup>[[plugin:pagetemplate|← Back]]</sup>
  
 ==== Manual Installation === ==== Manual Installation ===
Line 17: Line 16:
  */  */
    
-if(!defined('DOKU_INC')) die(); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'action.php'); 
-require_once(DOKU_INC.'inc/parserutils.php'); 
-require_once(DOKU_INC.'inc/search.php'); 
-require_once(DOKU_INC.'inc/parser/parser.php'); 
 require_once('pagetemplate_backlinks.php'); require_once('pagetemplate_backlinks.php');
    
Line 31: Line 24:
    */    */
   function getInfo(){   function getInfo(){
-    return array( +    return [ 
-  'author' => 'Luke Howson', +        'author' => 'Luke Howson', 
-  'email'  => 'mail@lukehowson.com', + 'email'  => 'mail@lukehowson.com', 
-  'date'   => '2007-07-25', + 'date'   => '2007-07-25', 
-  'name'   => 'Page Template', + 'name'   => 'Page Template', 
-  'desc'   => 'Generates a template when Create this Page is clicked.', + 'desc'   => 'Generates a template when Create this Page is clicked.', 
- );+    ];
   }   }
    
Line 43: Line 36:
    * Register its handlers with the dokuwiki's event controller    * Register its handlers with the dokuwiki's event controller
    */    */
-  function register(&$controller) {+  function register(Doku_Event_Handler $controller) {
     $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'BEFORE',  $this, '_generateTemplate');     $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'BEFORE',  $this, '_generateTemplate');
     $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'AFTER',  $this, '_removeTemplate');     $controller->register_hook('HTML_PAGE_FROMTEMPLATE', 'AFTER',  $this, '_removeTemplate');
   }   }
      
-  function _removeTemplate(&$event, $param) {+  function _removeTemplate($event, $param) {
     $page = getID();     $page = getID();
     $theTemplate = _templateFN($page);     $theTemplate = _templateFN($page);
Line 65: Line 58:
    * Hooked into a newly created page (as editor boots up).    * Hooked into a newly created page (as editor boots up).
    */    */
-  function _generateTemplate(&$event, $param) {+  function _generateTemplate($event, $param) {
         // page already exists?         // page already exists?
         $page = getID();         $page = getID();
Line 158: Line 151:
  
   //add modes to parser   //add modes to parser
-  $pagetemplate_obj =plugin_load('syntax','pagetemplate');+  $pagetemplate_obj = plugin_load('syntax','pagetemplate');
   $std_modes = array('listblock','preformatted','notoc','nocache',   $std_modes = array('listblock','preformatted','notoc','nocache',
                      'header','table','linebreak','footnote','hr',                      'header','table','linebreak','footnote','hr',
Line 184: Line 177:
 ====/lib/plugins/pagetemplate/pagetemplate_backlinks.php==== ====/lib/plugins/pagetemplate/pagetemplate_backlinks.php====
  
-<code php>+<file php pagetemplate_backlinks.php>
 <?php <?php
 // High performance pagetemplate backlink // High performance pagetemplate backlink
 // subsystem // subsystem
 // @author 'Luke Howson' // @author 'Luke Howson'
- 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
  
 class PageTemplateBacklink { class PageTemplateBacklink {
Line 293: Line 284:
      
     //add modes to parser     //add modes to parser
-    $pagetemplate_obj =plugin_load('syntax','pagetemplate');+    $pagetemplate_obj = plugin_load('syntax','pagetemplate');
     $std_modes = array('listblock','preformatted','notoc','nocache',     $std_modes = array('listblock','preformatted','notoc','nocache',
                        'header','table','linebreak','footnote','hr',                        'header','table','linebreak','footnote','hr',
Line 316: Line 307:
  
 } }
-</code>+</file>
  
 ==== /lib/plugins/pagetemplate/syntax.php ==== ==== /lib/plugins/pagetemplate/syntax.php ====
  
-<code php>+<file php syntax.php>
 <?php <?php
 /** /**
Line 328: Line 319:
  * @author     Luke Howson <mail@lukehowson.com>  * @author     Luke Howson <mail@lukehowson.com>
  */  */
-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'); 
 require_once('pagetemplate_backlinks.php'); require_once('pagetemplate_backlinks.php');
  
Line 418: Line 406:
      * @return  array              Return an array with all data you want to use in render      * @return  array              Return an array with all data you want to use in render
      */      */
-    function handle($match, $state, $pos, &$handler){         +    function handle($match, $state, $pos, Doku_Handler $handler){         
         switch ($state) {         switch ($state) {
             case DOKU_LEXER_ENTER:             case DOKU_LEXER_ENTER:
Line 474: Line 462:
      * @return  boolean            rendered correctly?      * @return  boolean            rendered correctly?
      */      */
-    function render($format, &$renderer, $data) {+    function render($format, Doku_Renderer $renderer, $data) {
         if ($data[0] != 'pagetemplate') return;         if ($data[0] != 'pagetemplate') return;
         $pageName = $data[1];         $pageName = $data[1];
Line 628: Line 616:
 //Setup VIM: ex: et ts=4 enc=utf-8 : //Setup VIM: ex: et ts=4 enc=utf-8 :
  
-</code>+</file>
plugin/pagetemplate/listing.1310418123.txt.gz · Last modified: 2011-07-11 23:02 by 70.25.127.226

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