aboutsummaryrefslogtreecommitdiff
path: root/pmwiki.php
diff options
context:
space:
mode:
authorpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2024-04-22 07:34:32 +0000
committerpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2024-04-22 07:34:32 +0000
commit77125f8a9e4545b1b845c81656c22b04184c6a6d (patch)
treea55126bf5cb322133174fd585110e65fa67e3807 /pmwiki.php
parente779af6e7ffd1fcef8f096fa1cf9cf773e100b9b (diff)
downloadpmwiki.svn-77125f8a9e4545b1b845c81656c22b04184c6a6d.tar.bz2
Add helper function PosArgs($args, $posnames).
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4696 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'pmwiki.php')
-rw-r--r--pmwiki.php11
1 files changed, 11 insertions, 0 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);