parent
7f099b211b
commit
5a913881a6
|
@ -8,21 +8,23 @@ INI files as source it enables you to store configuration in a familiar format.
|
||||||
defines some configuration files for its own purposes. Please note that both modules and framework
|
defines some configuration files for its own purposes. Please note that both modules and framework
|
||||||
keep their main configuration in the INI file called config.ini. Here's some example code:
|
keep their main configuration in the INI file called config.ini. Here's some example code:
|
||||||
|
|
||||||
<?php
|
```php
|
||||||
use \Icinga\Application\Config as IcingaConfig;
|
<?php
|
||||||
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
|
|
||||||
// Retrieve the default timezone using 'Europe/Berlin' in case it is not set
|
// Retrieve the default timezone using 'Europe/Berlin' in case it is not set
|
||||||
IcingaConfig::app()->global->get('defaultTimezone', 'Europe/Berlin');
|
IcingaConfig::app()->global->get('defaultTimezone', 'Europe/Berlin');
|
||||||
|
|
||||||
// If you don't pass a configuration name to IcingaConfig::app it tries to load values from the
|
// If you don't pass a configuration name to IcingaConfig::app it tries to load values from the
|
||||||
// application's config.ini. For using other files you have to pass this parameter though.
|
// application's config.ini. For using other files you have to pass this parameter though.
|
||||||
// The following example loads a section from the application's authentication.ini:
|
// The following example loads a section from the application's authentication.ini:
|
||||||
IcingaConfig::app('authentication')->get('ldap-authentication');
|
IcingaConfig::app('authentication')->get('ldap-authentication');
|
||||||
|
|
||||||
// If you don't pass a configuration name to IcingaConfig::module it tries to load values from
|
// If you don't pass a configuration name to IcingaConfig::module it tries to load values from
|
||||||
// the module's config.ini. For using other files you have to pass this parameter though.
|
// the module's config.ini. For using other files you have to pass this parameter though.
|
||||||
// The following example loads values from the example module's extra.ini:
|
// The following example loads values from the example module's extra.ini:
|
||||||
IcingaConfig::module('example', 'extra')->logging->get('enabled', true);
|
IcingaConfig::module('example', 'extra')->logging->get('enabled', true);
|
||||||
|
```
|
||||||
|
|
||||||
## Reload from disk
|
## Reload from disk
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,26 @@ class DocParser
|
||||||
$fileObject->flock(LOCK_UN);
|
$fileObject->flock(LOCK_UN);
|
||||||
}
|
}
|
||||||
$html = Parsedown::instance()->parse(implode('', $cat));
|
$html = Parsedown::instance()->parse(implode('', $cat));
|
||||||
|
$html = preg_replace_callback(
|
||||||
|
'#<pre><code class="language-php">(.*?)\</code></pre>#s',
|
||||||
|
array($this, 'highlight'),
|
||||||
|
$html
|
||||||
|
);
|
||||||
return array($html, $toc[0]->item);
|
return array($html, $toc[0]->item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syntax highlighting for PHP code
|
||||||
|
*
|
||||||
|
* @param $match
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function highlight($match)
|
||||||
|
{
|
||||||
|
return highlight_string(htmlspecialchars_decode($match[1]), true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract atx- or setext-style headers from the given lines
|
* Extract atx- or setext-style headers from the given lines
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue