From 9626fb5c6a4d7451e88aa7bd7fa91306d3f3f1ea Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sat, 29 Apr 2017 01:09:30 +0200 Subject: Two changes have been made in this commit: + The method "Item::getArguments" has been optimized and checks now the syntax of the argument names (only A-Z, a-z, 0-9 and underscores are allowed). + The admin template has been changed and displays now the used arguments of an item within the list. --- core/namespace/Item.php | 9 ++++++--- template/admin/html/page/item.php | 9 +++++++++ template/admin/html/post/item.php | 9 +++++++++ template/admin/html/user/item.php | 9 +++++++++ template/admin/rsrc/main.css | 8 ++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/core/namespace/Item.php b/core/namespace/Item.php index 426dd2a..f1a0988 100644 --- a/core/namespace/Item.php +++ b/core/namespace/Item.php @@ -106,11 +106,14 @@ abstract class Item implements ItemInterface { #=============================================================================== public function getArguments(): array { if($argv = $this->Attribute->get('argv')) { - foreach(explode('|', rtrim($argv, '|')) as $delimeter) { + foreach(explode('|', $argv) as $delimeter) { $part = explode('=', $delimeter); - if(!empty($part[0])) { - $arguments[strtoupper($part[0])] = $part[1] ?? TRUE; + $argumentK = $part[0] ?? NULL; + $argumentV = $part[1] ?? TRUE; + + if(preg_match('#^[[:word:]]+$#', $argumentK)) { + $arguments[strtoupper($argumentK)] = $argumentV; } } } diff --git a/template/admin/html/page/item.php b/template/admin/html/page/item.php index 584a539..1a382bd 100644 --- a/template/admin/html/page/item.php +++ b/template/admin/html/page/item.php @@ -6,6 +6,15 @@

+ + + + +