| | 2189 | function freepbx_get_contexts() { |
|---|
| | 2190 | $modules = module_getinfo(false, MODULE_STATUS_ENABLED); |
|---|
| | 2191 | |
|---|
| | 2192 | $contexts = array(); |
|---|
| | 2193 | |
|---|
| | 2194 | foreach ($modules as $modname => $mod) { |
|---|
| | 2195 | $funct = strtolower($modname.'_contexts'); |
|---|
| | 2196 | if (function_exists($funct)) { |
|---|
| | 2197 | // call the modulename_contexts() function |
|---|
| | 2198 | $contextArray = $funct(); // returns array with 'context' and 'description' |
|---|
| | 2199 | if (is_array($contextArray)) { |
|---|
| | 2200 | foreach ($contextArray as $con) { |
|---|
| | 2201 | if (isset($con['context'])) { |
|---|
| | 2202 | if (!isset($con['description'])) { |
|---|
| | 2203 | $con['description'] = $con['context']; |
|---|
| | 2204 | } |
|---|
| | 2205 | if (!isset($con['module'])) { |
|---|
| | 2206 | $con['module'] = $modname; |
|---|
| | 2207 | } |
|---|
| | 2208 | $contexts[ $con['context'] ] = $con['description']; |
|---|
| | 2209 | } |
|---|
| | 2210 | } |
|---|
| | 2211 | } |
|---|
| | 2212 | } |
|---|
| | 2213 | } |
|---|
| | 2214 | return $contexts; |
|---|
| | 2215 | } |
|---|
| | 2216 | |
|---|