plugin:condition
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:condition [2014-05-04 22:29] – [Condition plugin breaks useheading function in Dokuwiki] 80.134.96.245 | plugin:condition [2022-10-02 17:47] (current) – [condition Plugin] thalueng | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== condition | + | ====== condition |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : etienne.meleard@free.fr | email : etienne.meleard@free.fr | ||
type : Syntax | type : Syntax | ||
- | lastupdate : 2009-09-15 | + | lastupdate : 2017-11-30 |
compatible : | compatible : | ||
depends | depends | ||
conflicts | conflicts | ||
- | similar | + | similar |
tags : condition if syntax | tags : condition if syntax | ||
+ | securitywarning: | ||
- | downloadurl: | + | downloadurl: |
- | bugtracker : | + | bugtracker : https:// |
sourcerepo : https:// | sourcerepo : https:// | ||
donationurl: | donationurl: | ||
---- | ---- | ||
- | ===== Description ===== | ||
- | The Syntax [[plugins|Plugin]] allows to parse a content only if a specific | + | :!: Replace curly brackets string indices with square brackets in line 84 and 149 of '' |
+ | |||
+ | ===== Description ===== | ||
- | __**Warning :**__ //This plugin must not be considered as a way to securely hide data from users since a hit on the "show source" | + | The Syntax Plugin allows |
===== Syntax ===== | ===== Syntax ===== | ||
Line 32: | Line 34: | ||
</ | </ | ||
- | [condition_list] is a set of [condition] records separated by logical operators (&&, | + | '' |
- | [condition] is formed from a [key], followed by an [operator] (optional) and then a [value] (optional) | + | '' |
- | [key] is in the list (defined in base_tester.php as of 2009/09/15) : | + | '' |
- | - user : refers to the user " | + | - '' |
- | - group : refers to the user group-set | + | - '' |
- | - nsread : refers to the ability of the user to read a namespace | + | - '' |
- | - nsedit : refers to the ability of the user to edit a namespace | + | - '' |
- | - time : refers to the current server time | + | - '' |
- | - IP : refers to the client' | + | - '' |
- | [operator] signification is [key] dependent, for example : | + | '' |
- | * = or == : equality, membership, read/edit ability on ... | + | * '' |
- | * != : non-equality, | + | * '' |
* ... | * ... | ||
(browse base_tester.php for test_* methods for more information) | (browse base_tester.php for test_* methods for more information) | ||
- | [value] can be a string (whitespace, | + | '' |
- | DokuWiki code can contain DokuWiki syntax but be careful with high-level syntax (containers, | + | DokuWiki code can contain DokuWiki syntax but be careful with high-level syntax (containers, |
- | bug reports are welcome ... | + | |
- | **It is now sure that using the plugin inside a table cell won't work, working on it now, any help is welcome ...** | + | **It is now sure that using the plugin inside a table cell won't work, working on it now, any help is welcome...** |
- | Example : | + | Example: |
< | < | ||
<if user>You are **connected**< | <if user>You are **connected**< | ||
Line 69: | Line 70: | ||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Download | + | Search |
- | * [[http:// | + | * Latest Version: [[https:// |
- | * [[https:// | + | * Old Version: [[http:// |
===== Sources ===== | ===== Sources ===== | ||
Line 80: | Line 81: | ||
==== syntax.php ==== | ==== syntax.php ==== | ||
- | <code php> | + | <file php syntax.php> |
<?php | <?php | ||
/** | /** | ||
Line 139: | Line 140: | ||
// Handle the match | // Handle the match | ||
- | function handle($match, | + | function handle($match, |
if($state != DOKU_LEXER_UNMATCHED) return false; | if($state != DOKU_LEXER_UNMATCHED) return false; | ||
Line 277: | Line 278: | ||
* Create output | * Create output | ||
*/ | */ | ||
- | function render($mode, | + | function render($mode, |
global $INFO; | global $INFO; | ||
if(count($data) != 2) return false; | if(count($data) != 2) return false; | ||
Line 425: | Line 426: | ||
} //class | } //class | ||
?> | ?> | ||
- | </code> | + | </file> |
==== base_tester.php ==== | ==== base_tester.php ==== | ||
- | <code php> | + | <file php base_tester.php> |
<?php | <?php | ||
/* | /* | ||
Line 722: | Line 723: | ||
} | } | ||
?> | ?> | ||
- | </code> | + | </file> |
- | ==== How can I implement some other tests ? ==== | + | ==== How can I implement some other tests? ==== |
- | You must create the // | + | You must create the // |
<code php> | <code php> | ||
Line 737: | Line 738: | ||
</ | </ | ||
- | To add the test with the key " | + | To add the test with the key " |
<code php> | <code php> | ||
Line 758: | Line 759: | ||
</ | </ | ||
- | So that test can be used as : | + | So that test can be used as: |
< | < | ||
<if foo=bar> | <if foo=bar> | ||
Line 766: | Line 767: | ||
</ | </ | ||
- | If your test don't take a parameter you can define it as follows : | + | If your test don't take a parameter you can define it as follows: |
<code php> | <code php> | ||
Line 776: | Line 777: | ||
</ | </ | ||
- | This test is valid if " | + | This test is valid if " |
< | < | ||
<if foo>Page is under " | <if foo>Page is under " | ||
Line 783: | Line 784: | ||
==== TODO ==== | ==== TODO ==== | ||
- | * Allow multiple user custom test files (plugin style) ? | + | * Allow multiple user custom test files (plugin style)? |
* Ensure this works well with top-level containers | * Ensure this works well with top-level containers | ||
- | * clean-up and simplify code (mainly reduce calls to preg_replace/ | + | * clean-up and simplify code (mainly reduce calls to preg_replace/ |
- | ===== Discussion ===== | + | |
- | + | ||
- | ~~DISCUSSION~~ | + | |
==== While discussion isn't working ==== | ==== While discussion isn't working ==== | ||
Line 821: | Line 819: | ||
// | // | ||
- | :!: I have the same error, but this code doesn´t solve the problem. If I use the condition-plugin some where in the page all headings get lost for the TOC up to the line where you use the condition plugin. The next heading is used as first heading. If no heading is left, filename is used. // | + | :!: I have the same error, but this code doesn´t solve the problem. If I use the condition-plugin some where in the page all headings get lost for the TOC up to the line where you use the condition plugin. The next heading is used as first heading. If no heading is left, filename is used. |
+ | |||
+ | // | ||
+ | |||
+ | :!: The plugin **does not** work with my installation. I traced the [[https:// | ||
+ | // | ||
plugin/condition.1399235369.txt.gz · Last modified: 2014-05-04 22:29 by 80.134.96.245