aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pmwiki.php11
-rw-r--r--scripts/forms.php9
-rw-r--r--scripts/markupexpr.php2
3 files changed, 14 insertions, 8 deletions
diff --git a/pmwiki.php b/pmwiki.php
index 08a9c3cf..2b746624 100644
--- a/pmwiki.php
+++ b/pmwiki.php
@@ -624,6 +624,17 @@ function ParseArgs($x, $optpat = '(?>(\\w+)[:=])') {
}
return $z;
}
+function PosArgs($args, $posnames) {
+ if (is_string($args)) $args = ParseArgs($args);
+ if (!is_array($posnames)) {
+ $posnames = array_slice(func_get_args(), 1);
+ }
+ while (count($posnames) > 0 && isset($args['']) && count($args['']) > 0) {
+ $n = array_shift($posnames);
+ if (!isset($args[$n])) $args[$n] = array_shift($args['']);
+ }
+ return $args;
+}
function PHSC($x, $flags=ENT_COMPAT, $enc=null, $dbl_enc=true) { # for PHP 5.4
if (is_null($enc)) $enc = "ISO-8859-1"; # single-byte charset
if (! is_array($x)) return @htmlspecialchars($x, $flags, $enc, $dbl_enc);
diff --git a/scripts/forms.php b/scripts/forms.php
index fd426d67..3c700415 100644
--- a/scripts/forms.php
+++ b/scripts/forms.php
@@ -125,13 +125,8 @@ function InputToHTML($pagename, $type, $args, &$opt) {
## get input arguments
if (!is_array($args)) $args = ParseArgs($args, '(?>([\\w-]+)[=])');
## convert any positional arguments to named arguments
- $posnames = @$InputTags[$type][':args'];
- if (!$posnames) $posnames = array('name', 'value');
- while (count($posnames) > 0 && @$args[''] && count($args['']) > 0) {
- $n = array_shift($posnames);
- if (!isset($args[$n])) $args[$n] = array_shift($args['']);
- }
-
+ $posnames = IsEnabled($InputTags[$type][':args'], array('name', 'value'));
+ $args = PosArgs($args, $posnames);
## merge defaults for input type with arguments
$opt = array_merge($InputTags[$type], $args);
diff --git a/scripts/markupexpr.php b/scripts/markupexpr.php
index 7f7de79b..2191e3c0 100644
--- a/scripts/markupexpr.php
+++ b/scripts/markupexpr.php
@@ -114,7 +114,7 @@ function MarkupExpression($pagename, $expr) {
if ($expr == $repl) { $expr = $out; break; }
$expr = str_replace($repl, Keep($out, 'P'), $expr);
}
- return preg_replace_callback($rpat, 'cb_expandkpv', $expr);
+ return preg_replace_callback($rpat, 'cb_expandkpv', strval($expr));
}
## ME_ftime handles {(ftime ...)} expressions.