XOOPS  2.6.0
functions.config.php
Go to the documentation of this file.
1 <?php
14 if (!defined("FRAMEWORKS_ART_FUNCTIONS_CONFIG")):
15  define("FRAMEWORKS_ART_FUNCTIONS_CONFIG", true);
16 
23  function mod_loadConfig($dirname = "")
24  {
26  if (empty($dirname) && !$xoops->isModule()) {
27  return null;
28  }
29  $dirname = !empty($dirname) ? $dirname : $xoops->module->getVar("dirname");
30 
31  if ($xoops->isModule() && $xoops->module->getVar("dirname", "n") == $dirname) {
32  if (!empty($xoops->moduleConfig)) {
33  $moduleConfig = $xoops->moduleConfig;
34  } else {
35  return null;
36  }
37  } else {
38 
39  if (!$moduleConfig = Xoops_Cache::read("{$dirname}_config")) {
40  $moduleConfig = mod_fetchConfig($dirname);
41  Xoops_Cache::write("{$dirname}_config", $moduleConfig);
42  }
43  }
44  if ($customConfig = @include \XoopsBaseConfig::get('root-path') . "/modules/{$dirname}/include/plugin.php") {
45  $moduleConfig = array_merge($moduleConfig, $customConfig);
46  }
47  return $moduleConfig;
48  }
49 
54  function mod_loadConfg($dirname = "")
55  {
56  return mod_loadConfig($dirname);
57  }
58 
65  function mod_fetchConfig($dirname = "")
66  {
67  if (empty($dirname)) {
68  return null;
69  }
70 
72  if (!$module = $xoops->getModuleByDirname($dirname)) {
73  trigger_error("Module '{$dirname}' does not exist", E_USER_WARNING);
74  return null;
75  }
76  $config_handler = $xoops->getHandlerConfig();
77  $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
78  $configs = $config_handler->getConfigs($criteria);
79  $moduleConfig = array();
80  foreach (array_keys($configs) as $i) {
81  $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
82  }
83  unset($module, $configs);
84 
85  return $moduleConfig;
86  }
87 
88  function mod_fetchConfg($dirname = "")
89  {
90  return mod_fetchConfig($dirname);
91  }
92 
100  function mod_clearConfig($dirname = "")
101  {
102  if (empty($dirname)) {
103  return false;
104  }
105 
106 
107  return Xoops_Cache::delete("{$dirname}_config");
108  }
109 
110  function mod_clearConfg($dirname = "")
111  {
112  return mod_clearConfig($dirname);
113  }
114 
mod_clearConfig($dirname="")
$i
Definition: dialog.php:68
static getInstance()
Definition: Xoops.php:160
mod_clearConfg($dirname="")
static read($key)
Definition: Legacy.php:94
$xoops
Definition: admin.php:25
mod_loadConfig($dirname="")
if($_SERVER['REQUEST_METHOD']== 'POST') $config_handler
static get($name)
mod_loadConfg($dirname="")
$module
Definition: main.php:52
$configs
Definition: config.php:27
static write($key, $value, $duration=0)
Definition: Legacy.php:76
$criteria
$dirname
Definition: backend.php:38
static delete($key)
Definition: Legacy.php:108
mod_fetchConfg($dirname="")
mod_fetchConfig($dirname="")