From 77125f8a9e4545b1b845c81656c22b04184c6a6d Mon Sep 17 00:00:00 2001 From: petko Date: Mon, 22 Apr 2024 07:34:32 +0000 Subject: Add helper function PosArgs($args, $posnames). git-svn-id: svn://pmwiki.org/pmwiki/trunk@4696 524c5546-5005-0410-9a3e-e25e191bd360 --- scripts/forms.php | 9 ++------- scripts/markupexpr.php | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'scripts') 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. -- cgit v1.2.3