CMSimple_XH 開発者ドキュメント
PluginConfig.php
1 <?php
2 
14 namespace XH;
15 
16 use ArrayAccess;
17 
31 class PluginConfig implements ArrayAccess
32 {
38  private $language;
39 
45  private $configs = array();
46 
52  public function __construct($language = false)
53  {
54  $this->language = $language;
55  }
56 
64  public function offsetExists($offset)
65  {
66  if (!isset($this->configs[$offset])) {
67  $this->loadConfig($offset);
68  }
69  return isset($this->configs[$offset]);
70  }
71 
79  public function offsetGet($offset)
80  {
81  if (!isset($this->configs[$offset])) {
82  $this->loadConfig($offset);
83  }
84  return $this->configs[$offset];
85  }
86 
95  public function offsetSet($offset, $value)
96  {
97  if (!isset($this->configs[$offset])) {
98  $this->loadConfig($offset);
99  }
100  $this->configs[$offset] = $value;
101  }
102 
110  public function offsetUnset($offset)
111  {
112  if (!isset($this->configs[$offset])) {
113  $this->loadConfig($offset);
114  }
115  unset($this->configs[$offset]);
116  }
117 
125  private function loadConfig($pluginname)
126  {
127  global $pth;
128 
129  pluginFiles($pluginname);
130  if ($this->language) {
131  XH_createLanguageFile($pth['file']['plugin_language']);
132  }
133  $this->configs += XH_readConfiguration(true, $this->language);
134  }
135 }
offsetUnset($offset)
offsetExists($offset)
__construct($language=false)
offsetSet($offset, $value)
pluginFiles($plugin)
Definition: functions.php:1377
XH_createLanguageFile($dst)
Definition: functions.php:1352
offsetGet($offset)
$pth
Definition: cms.php:230
XH_readConfiguration($plugin=false, $language=false)
Definition: functions.php:2304