diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-04-28 07:07:48 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-04-28 07:07:48 +0000 |
commit | d76bf03f2ae9ffaa8c3ff65220f6ab752c00870a (patch) | |
tree | 2b4d158f5949853adb3ea157e30cfecf916f699c | |
parent | 60b7c42435e46d964a83f410c9e06692a4859ce7 (diff) | |
download | pmwiki.svn-d76bf03f2ae9ffaa8c3ff65220f6ab752c00870a.tar.bz2 |
Add (:if action browse,edit:) conditional.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4703 524c5546-5005-0410-9a3e-e25e191bd360
-rw-r--r-- | pmwiki.php | 2 | ||||
-rw-r--r-- | pub/guiedit/pmwiki.syntax.js | 2 | ||||
-rw-r--r-- | scripts/stdmarkup.php | 1 |
3 files changed, 4 insertions, 1 deletions
@@ -246,6 +246,8 @@ $Conditions['group'] = "(boolean)MatchPageNames(\$pagename, FixGlob(\$condparm, '$1$2.*'))"; $Conditions['name'] = "(boolean)MatchPageNames(\$pagename, FixGlob(\$condparm, '$1*.$2'))"; +$Conditions['action'] = + "(boolean)MatchNames(\$GLOBALS['action'], \$condparm, false)"; $Conditions['match'] = 'preg_match("!$condparm!",$pagename)'; $Conditions['authid'] = 'NoCache(@$GLOBALS["AuthId"] > "")'; $Conditions['equal'] = 'CompareArgs($condparm) == 0'; diff --git a/pub/guiedit/pmwiki.syntax.js b/pub/guiedit/pmwiki.syntax.js index 025744f3..62e13a79 100644 --- a/pub/guiedit/pmwiki.syntax.js +++ b/pub/guiedit/pmwiki.syntax.js @@ -72,7 +72,7 @@ ['meta2', '=meta', /(\(:(?:title|description|keywords))(.*?)(:\))/gi], ['meta3', '=meta>keyword>*attr>*keyword', /(\(:(?:(?:else\d*)?if\d*))(.*?)(:\))/ig, - /\b(expr|e_preview|enabled|auth(id)?|name|group|true|false|attachments|date|equal|match|exists|ontrail)\b/g, + /\b(expr|e_preview|enabled|auth(id)?|action|name|group|true|false|attachments|date|equal|match|exists|ontrail)\b/g, special, /[[\]()]+/g ], ['tmpl', '!meta>=keyword', /(\(:template[^\S\r\n]+)(\S.*?)(:\))/g, /^([ !]*)(each|first|last|defaults?|requires?|none)/], diff --git a/scripts/stdmarkup.php b/scripts/stdmarkup.php index 2afe852d..c368f1ca 100644 --- a/scripts/stdmarkup.php +++ b/scripts/stdmarkup.php @@ -114,6 +114,7 @@ function CondText2($pagename, $text, $code = '') { if (!isset($Conditions[$condname])) return preg_replace_callback($CondTextPattern, $repl, $condtext); + $tf = @eval("return ({$Conditions[$condname]});"); if ($tf xor $not) return preg_replace_callback($CondTextPattern, $repl, $condtext); |