DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:arguments

Arguments Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" no

plugin Return a value from $_GET array

Last updated on
2006-01-05
Provides
Syntax

The following security issue was reported for this extension: XSS vulnerability allows arbitrary JavaScript insertion. Author informed on 2008-02-24.

It is not recommended to use this extension until this issue was fixed. Extension authors should read the plugin security guidelines

Similar to variants

Tagged with get, variable

Contact me : Olive

lib/plugins/arguments/syntax.php :

/**
 * Return a value from $_GET
 * write {{arg>message}} to get "hello" when .../page?message=hello
 * note that the only permanent argument is "id"
 * !! You probably want ~~NOCACHE~~ with this plugin !!
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Olivier Fraysse <olivier at picapo dot 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');
 
class syntax_plugin_arguments extends DokuWiki_Syntax_Plugin {
    /**
     * return some info
     */
    function getInfo(){
        return array(
            'author' => 'Olivier Fraysse',
            'email'  => 'olivier at picapo dot com',
            'date'   => '2006-01-05',
            'name'   => 'GET arguments Plugin',
            'desc'   => 'Return an element from $_GET array',
            'url'    => 'http://www.dokuwiki.org/plugin:arguments',
        );
    }
 
    /**
     * What kind of syntax are we?
     */
    function getType(){
        return 'substition';
    }
 
    /**
     * What about paragraphs?
     */
    function getPType(){
        return 'normal';
    }
 
    /**
     * Where to sort in?
     */
    function getSort(){
        return 300;
    }
    /**
     * Connect pattern to lexer
     * match for {{arg>something}}
     */
    function connectTo($mode) {
        $this->Lexer->addSpecialPattern('\{\{arg>[^\}]+\}\}',$mode,'plugin_arguments');
    }
 
 
    /**
     * Handle the match
     */
    function handle($match, $state, $pos, &$handler){
        return substr($match,6,-2); //strip markup from start and end
    }
 
    /**
     * Create output
     */
    function render($mode, &$renderer, $data) {
        if(isset( $_GET[$data])){
            $renderer->doc .= $_GET[$data];
            return true;
        }
        return false;
    }
 
}
plugin/arguments.txt · Last modified: 2020-06-08 21:01 by antwoorden

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