DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:arguments

Arguments Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Return a value from $_GET array

Last updated on
2006-01-05
Provides
Syntax

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

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: 2015-07-28 13:37 by 134.99.58.149