hpdl
|
1
|
1
|
<?php
|
|
2
|
/*
|
mattice
|
151
|
3
|
$Id: object_info.php 1863 2009-03-06 23:53:49Z hpdl $
|
hpdl
|
1
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
hpdl
|
1863
|
8
|
Copyright (c) 2009 osCommerce
|
hpdl
|
1
|
9
|
|
hpdl
|
1498
|
10
|
This program is free software; you can redistribute it and/or modify
|
|
11
|
it under the terms of the GNU General Public License v2 (1991)
|
|
12
|
as published by the Free Software Foundation.
|
hpdl
|
1
|
13
|
*/
|
|
14
|
|
hpdl
|
1863
|
15
|
/**
|
|
16
|
* The osC_ObjectInfo class wraps an object instance around an array data set
|
|
17
|
*/
|
|
18
|
|
hpdl
|
1338
|
19
|
class osC_ObjectInfo {
|
hpdl
|
1348
|
20
|
|
hpdl
|
1863
|
21
|
/**
|
|
22
|
* Holds the array data set values
|
|
23
|
*
|
|
24
|
* @var array
|
|
25
|
* @access private
|
|
26
|
*/
|
|
27
|
|
|
28
|
private $_data = array();
|
|
29
|
|
|
30
|
/**
|
|
31
|
* Constructor, loads the array data set into the object instance
|
|
32
|
*
|
|
33
|
* @param array $data The array data set to insert into the object instance
|
|
34
|
* @access public
|
|
35
|
*/
|
|
36
|
|
|
37
|
public function __construct($data) {
|
|
38
|
$this->_data = $data;
|
hpdl
|
1
|
39
|
}
|
hpdl
|
1338
|
40
|
|
hpdl
|
1863
|
41
|
/**
|
|
42
|
* Get the value of a key element in the array data set
|
|
43
|
*
|
|
44
|
* @param string $key The name of the array key
|
|
45
|
* @access public
|
|
46
|
*/
|
|
47
|
|
|
48
|
public function get($key) {
|
|
49
|
return $this->_data[$key];
|
hpdl
|
1338
|
50
|
}
|
|
51
|
|
hpdl
|
1863
|
52
|
/**
|
|
53
|
* Get the value of a key element in the array data set and protect the output value
|
|
54
|
*
|
|
55
|
* @param string $key The name of the array key
|
|
56
|
* @access public
|
|
57
|
*/
|
|
58
|
|
|
59
|
public function getProtected($key) {
|
|
60
|
return osc_output_string_protected($this->_data[$key]);
|
hpdl
|
1348
|
61
|
}
|
hpdl
|
1863
|
62
|
|
|
63
|
/**
|
|
64
|
* Get the integer value of a key element in the array data set
|
|
65
|
*
|
|
66
|
* @param string $key The name of the array key
|
|
67
|
* @access public
|
|
68
|
*/
|
|
69
|
|
|
70
|
public function getInt($key) {
|
|
71
|
return (int)$this->_data[$key];
|
hpdl
|
1338
|
72
|
}
|
hpdl
|
1863
|
73
|
|
|
74
|
/**
|
|
75
|
* Get the whole array data set
|
|
76
|
*
|
|
77
|
* @access public
|
|
78
|
*/
|
|
79
|
|
|
80
|
public function getAll() {
|
|
81
|
return $this->_data;
|
|
82
|
}
|
|
83
|
|
|
84
|
/**
|
|
85
|
* Set a value in the array data set
|
|
86
|
*
|
|
87
|
* @param string $key The name of the array key
|
|
88
|
* @param string $value The value of the array key
|
|
89
|
* @access public
|
|
90
|
*/
|
|
91
|
|
|
92
|
public function set($key, $value) {
|
|
93
|
$this->_data[$key] = $value;
|
|
94
|
}
|
|
95
|
|
|
96
|
/**
|
|
97
|
* Checks the existance of a key in the array data set
|
|
98
|
*
|
|
99
|
* @param string $key The name of the array key
|
|
100
|
* @access public
|
|
101
|
*/
|
|
102
|
|
|
103
|
public function exists($key) {
|
|
104
|
return isset($this->_data[$key]);
|
|
105
|
}
|
hpdl
|
1
|
106
|
}
|
|
107
|
?>
|