aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/ArrayExt.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2012-05-28 15:28:35 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2012-05-28 15:28:35 +0000
commit054086b33dad4c4f7089cf2ebf0f52eed1d7a023 (patch)
treed78d83a895e239b3495e9ac52ecee0107b2a2f61 /h-source/Library/ArrayExt.php
parent7097598d5576ba5e9391b43f26bfc037c08d61c3 (diff)
administrators can now view the actions of a single user in a compact format
Diffstat (limited to 'h-source/Library/ArrayExt.php')
-rwxr-xr-xh-source/Library/ArrayExt.php80
1 files changed, 0 insertions, 80 deletions
diff --git a/h-source/Library/ArrayExt.php b/h-source/Library/ArrayExt.php
deleted file mode 100755
index 2b02c9e..0000000
--- a/h-source/Library/ArrayExt.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-// EasyGiant is a PHP framework for creating and managing dynamic content
-//
-// Copyright (C) 2009 - 2011 Antonio Gallo
-// See COPYRIGHT.txt and LICENSE.txt.
-//
-// This file is part of EasyGiant
-//
-// EasyGiant is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// EasyGiant is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with EasyGiant. If not, see <http://www.gnu.org/licenses/>.
-
-if (!defined('EG')) die('Direct access not allowed!');
-
-//class to manage arrays
-class ArrayExt {
-
- public $errorString = null; //string containing the list fields not found
- public $errorsNumb = null; //numbers of errors
-
- //get the subset of the associative array $associativeArray defined by the keys in the string $keyString (keys separated by comma)
- public function subset($associativeArray,$keyString,$func = 'none') {
- if (!in_array($func,explode(',',Params::$allowedSanitizeFunc))) {
- throw new Exception('"'.$func. '" argument not allowed in '.__METHOD__.' method');
- }
- $tempArray = array();
- if (strcmp($keyString,'') !== 0) {
- $keyArray=explode(',',$keyString);
- for ($i = 0; $i < count($keyArray); $i++)
- {
- $temp = array();
- //extract the function after the colon
- if (strstr($keyArray[$i],':')) {
- $temp = explode(':',$keyArray[$i]);
- } else {
- $temp[0] = $keyArray[$i];
- $temp[1] = 'none';
- }
- //exception
- if (!in_array($temp[1],explode(',',Params::$allowedSanitizeFunc))) {
- throw new Exception('"'.$temp[1]. '" function not allowed');
- }
- if (array_key_exists($temp[0],$associativeArray)) {
- $tempArray[$temp[0]] = call_user_func($temp[1],$associativeArray[$temp[0]]);
- } else {
- $tempArray[$temp[0]] = '';
- }
- }
- }
- return call_user_func($func.'Deep',$tempArray); //clean the array values
- }
-
- //exctract the complementary subset from an associative array ($associativeArray) of the subset identified by the keys $keyString
- public function subsetComplementary($associativeArray,$keyString,$func = 'none') {
- if (!in_array($func,explode(',',Params::$allowedSanitizeFunc))) {
- throw new Exception('"'.$func. '" argument not allowed in '.__METHOD__.' method');
- }
- $keyArray=explode(',',$keyString);
- $complementaryKeyArray = array();
- $keys = array_keys($associativeArray);
- foreach ($keys as $key) {
- if (!in_array($key,$keyArray)) {
- $complementaryKeyArray[] = $key;
- }
- }
- $complementaryKeyString = implode(',',$complementaryKeyArray);
- return $this->subset($associativeArray,$complementaryKeyString,$func);
- }
-
-}