1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
<?php
class icms_plugins_Object {
public $_infoArray;
public function __construct($array) {
$this->_infoArray = $array;
}
public function getItemInfo($item) {
if (isset($this->_infoArray['items'][$item])) {
return $this->_infoArray['items'][$item];
} else {
return false;
}
}
public function getItemList() {
$itemsArray = $this->_infoArray['items'];
foreach ($itemsArray as $k=>$v) {
$ret[$k] = $v['caption'];
}
return $ret;
}
public function getItem() {
$ret = false;
foreach($this->_infoArray['items'] as $k => $v) {
$search_str = str_replace('%u', '', $v['url']);
if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) {
$ret = $k;
break;
}
}
return $ret;
}
public function getItemIdForItem($item) {
return $_REQUEST[$this->_infoArray['items'][$item]['request']];
}
}