Skip to content

Commit 0690ebc

Browse files
committed
Plugin structure update:
- renamed 'info.txt' to 'plugin.info.txt' - deleted no longer required function 'getInfo()' - fixed signatures for 'handle()' and 'render()' for PHP7.0 - changed README.md - upped version
1 parent 5010c6b commit 0690ebc

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# dokuwiki-plugin-fields
1+
# Dokuwiki Plugin Fields
22
This Dokuwiki plugin allows you to define “fields” in a page, which can be used anywhere in the document.
33
This can be very useful to set an author name, a reference string, or a version number for example,
44
and use those variables anywhere in the page.

info.txt

-8
This file was deleted.

plugin.info.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
base fields
2+
author Aurelien Bompard, LarsDW223
3+
4+
date 2016-09-14
5+
name Fields Plugin
6+
desc Store and recall user-defined fields
7+
url https://www.dokuwiki.org/plugin:fields

syntax.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Fields Plugin: Re-usable user fields
44
*
55
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6-
* @author Aurelien Bompard <[email protected]>
6+
* @author Aurelien Bompard <[email protected]>, LarsDW223
77
*/
88
// must be run within Dokuwiki
99
if(!defined('DOKU_INC')) die();
@@ -13,13 +13,6 @@
1313

1414
class syntax_plugin_fields extends DokuWiki_Syntax_Plugin {
1515

16-
/**
17-
* return some info
18-
*/
19-
function getInfo(){
20-
return confToHash(dirname(__FILE__).'/info.txt');
21-
}
22-
2316
/**
2417
* What kind of syntax are we?
2518
*/
@@ -45,7 +38,7 @@ function connectTo($mode) {
4538
/**
4639
* Handle the match
4740
*/
48-
function handle($match, $state, $pos, &$handler){
41+
public function handle($match, $state, $pos, Doku_Handler $handler) {
4942
$match = substr($match,9,-2); //strip markup
5043
$extinfo = explode('=',$match);
5144
$field_name = $extinfo[0];
@@ -62,7 +55,7 @@ function handle($match, $state, $pos, &$handler){
6255
/**
6356
* Create output
6457
*/
65-
function render($format, &$renderer, $data) {
58+
public function render($format, Doku_Renderer $renderer, $data) {
6659
global $ID;
6760
list($field_name, $field_value) = $data;
6861
if ($field_value == '') { // no value -> get the field

0 commit comments

Comments
 (0)