|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
Contains the main (general) configuration for Erebot. More...
Inheritance diagram for Erebot\Config\Main:Public Member Functions | |
| __clone () | |
| __construct ($configData, $source,\Erebot\IntlInterface $translator) | |
| __destruct () | |
| getCommandsPrefix () | |
| getConfigFile () | |
| getGroupIdentity () | |
| getNetworkCfg ($network) | |
| getNetworks () | |
| getPidfile () | |
| getTimezone () | |
| getTranslator ($component) | |
| getUserIdentity () | |
| getVersion () | |
| load ($configData, $source) | |
| mustDaemonize () | |
Public Member Functions inherited from Erebot\Config\Proxy | |
| __clone () | |
| __destruct () | |
| getMainCfg () | |
| getModule ($moduleName) | |
| getModules ($recursive) | |
| getTranslator ($component) | |
| parseBool ($module, $param, $default=null) | |
| parseInt ($module, $param, $default=null) | |
| parseReal ($module, $param, $default=null) | |
| parseString ($module, $param, $default=null) | |
Public Member Functions inherited from Erebot\Interfaces\Config\Proxy | |
| getMainCfg () | |
| getModule ($moduleName) | |
| getModules ($recursive) | |
| parseBool ($module, $param, $default=null) | |
| parseInt ($module, $param, $default=null) | |
| parseReal ($module, $param, $default=null) | |
| parseString ($module, $param, $default=null) | |
Protected Attributes | |
| $commandsPrefix | |
| The prefix used to recognize commands. | |
| $configFile | |
| The (relative or absolute) path to the configuration, if available. | |
| $coreTranslator | |
| Translator used by core files. | |
| $daemonize | |
| Whether to daemonize the bot or not. | |
| $groupIdentity | |
| Group identity to switch to. | |
| $networks | |
| A list of Erebot::Config::Network objects. | |
| $pidfile | |
| File where the bot's PID will be written. | |
| $timezone | |
| The bot's current timezone. | |
| $userIdentity | |
| User identity to switch to. | |
| $version | |
| The configuration file's version string. | |
Protected Attributes inherited from Erebot\Config\Proxy | |
| $locale | |
| The current locale. | |
| $modules | |
| Array of modules loaded at this particular configuration level. | |
| $proxified | |
| Reference to a proxified object. | |
Private Member Functions | |
| stripXGlobWrappers (&$domxml) | |
Additional Inherited Members | |
Static Public Member Functions inherited from Erebot\Config\Proxy | |
| static | parseBoolHelper ($value) |
| static | parseIntHelper ($value) |
| static | parseRealHelper ($value) |
Public Attributes inherited from Erebot\Interfaces\Config\Main | |
| const | LOAD_FROM_FILE = 1 |
| Indicates that the configuration must be loaded from a file. | |
| const | LOAD_FROM_STRING = 2 |
| Indicates that the configuration must be loaded from a string. | |
Protected Member Functions inherited from Erebot\Config\Proxy | |
| __construct (\Erebot\Interfaces\Config\Proxy $proxified,\SimpleXMLElement $xml) | |
| parseSomething ($module, $param, $default,\Erebot\CallableInterface $parser, $origin,\Erebot\CallableInterface $checker) | |
Contains the main (general) configuration for Erebot.
This class deals with settings which affect the whole bot such as its version string. It also contains references to instances of Erebot::Config::Network.
| Erebot\Config\Main::__construct | ( | $configData, | |
| $source, | |||
| \Erebot\IntlInterface | $translator | ||
| ) |
Creates a new instance of the Erebot::Config::Main class.
| string | $configData | Either a (relative or absolute) path to the configuration file to load or a string representation of the configuration, depending on the value of the $source parameter. |
| opaque | $source | Erebot::Interfaces::Config::Main::LOAD_FROM_FILE or Erebot::Interfaces::Config::Main::LOAD_FROM_STRING, depending on whether $configData contains a filename or the string representation of the configuration data, respectively. |
| Erebot::IntlInterface | $translator | Translator to use for messages coming from core files. |
| Erebot::InvalidValueException | The configuration file did not exist or contained invalid values. This exception is also thrown when the $source parameter contains an invalid value. |
Definition at line 86 of file Main.php.
References Erebot\Config\Main\load().
| Erebot\Config\Main::__destruct | ( | ) |
Destructs Erebot::Config::Main instances.
| Erebot\Config\Main::__clone | ( | ) |
Prevents cloning of this class to avoid escape from the singleton design pattern.
Implements Erebot\Interfaces\Config\Main.
| Erebot\Config\Main::getCommandsPrefix | ( | ) |
Returns the prefix used by commands.
| string | The prefix for commands, such as '!'. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 316 of file Main.php.
References Erebot\Config\Main\$commandsPrefix.
| Erebot\Config\Main::getConfigFile | ( | ) |
Returns the name of the currently loaded configuration file.
| string | Currently loaded configuration file. |
| null | No configuration file has been loaded or the configuration was loaded using Erebot::Interfaces::Config::Main::LOAD_FROM_STRING. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 322 of file Main.php.
References Erebot\Config\Main\$configFile.
| Erebot\Config\Main::getGroupIdentity | ( | ) |
Returns the group identity the bot should switch to upon startup.
| string | The group name or GID the bot must switch to, or null if the bot should keep its current group identity. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 334 of file Main.php.
References Erebot\Config\Main\$groupIdentity.
| Erebot\Config\Main::getNetworkCfg | ( | $network | ) |
Returns the configuration object for a particular IRC network.
| string | $network | The name of the IRC network whose configuration we're interested in. |
| Erebot::Interfaces::Config::Network | The configuration object for that network. |
| Erebot::NotFoundException | No such network has been configured on the bot. |
Implements Erebot\Interfaces\Config\Main.
| Erebot\Config\Main::getNetworks | ( | ) |
Returns all IRC network configurations.
| array | A list of network configurations, as objects implementing Erebot::Interfaces::Config::Network. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 298 of file Main.php.
References Erebot\Config\Main\$networks.
| Erebot\Config\Main::getPidfile | ( | ) |
Returns the file where the bot's PID should be written to upon startup.
| string | The file where the bot's PID should be written, or null if its PID should not be written anywhere. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 346 of file Main.php.
References Erebot\Config\Main\$pidfile.
| Erebot\Config\Main::getTimezone | ( | ) |
Returns the bot's timezone.
| string | The bot's current timezone, such as 'Europe/Paris'. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 310 of file Main.php.
References Erebot\Config\Main\$timezone.
| Erebot\Config\Main::getTranslator | ( | $component | ) |
Returns the appropriate i18n object to use for translations at this configuration level.
| string | $component | Name of the component we're interested in. This should be set to the name of a module or "Erebot" for the core translator. |
| Erebot::IntlInterface | A translator object. |
| Erebot::NotFoundException | No appropriate translator exists for this configuration level. |
Implements Erebot\Interfaces\Config\Proxy.
Definition at line 352 of file Main.php.
References Erebot\Config\Main\$coreTranslator, Erebot\IntlInterface\LC_MESSAGES, Erebot\IntlInterface\LC_MONETARY, Erebot\IntlInterface\LC_NUMERIC, and Erebot\IntlInterface\LC_TIME.
| Erebot\Config\Main::getUserIdentity | ( | ) |
Returns the user identity the bot should switch to upon startup.
| string | The user name or GID the bot must switch to, or null if the bot should keep its current user identity. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 340 of file Main.php.
References Erebot\Config\Main\$userIdentity.
| Erebot\Config\Main::getVersion | ( | ) |
Returns the configuration file's version string.
| string | The bot's version, such as '0.20-pre'. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 304 of file Main.php.
References Erebot\Config\Main\$version.
| Erebot\Config\Main::load | ( | $configData, | |
| $source | |||
| ) |
(Re)loads a configuration file.
| string | $configData | Either a (relative or absolute) path to the configuration file to load or a string representation of the configuration, depending on the value of the $source parameter. |
| opaque | $source | Erebot::Interfaces::Config::Main::LOAD_FROM_FILE or Erebot::Interfaces::Config::Main::LOAD_FROM_STRING, depending on whether $configData contains a filename or the string representation of the configuration data, respectively. |
| Erebot::InvalidValueException | The configuration file did not exist or contained invalid values. This exception is also thrown when the $source parameter contains an invalid value. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 142 of file Main.php.
References Erebot\Config\Main\$daemonize, Erebot\Config\Main\$groupIdentity, Erebot\Config\Main\$pidfile, Erebot\Config\Main\$userIdentity, Erebot\URI\fromAbsPath(), Erebot\Config\Proxy\parseBool(), and Erebot\Config\Main\stripXGlobWrappers().
Referenced by Erebot\Config\Main\__construct().
| Erebot\Config\Main::mustDaemonize | ( | ) |
Indicates whether the bot should "daemonize" itself upon startup.
| bool | true if the bot must turn into a daemon, false otherwise. |
Implements Erebot\Interfaces\Config\Main.
Definition at line 328 of file Main.php.
References Erebot\Config\Main\$daemonize.
|
private |
Removes wrapping xglob tags that were automatically added by the Erebot::XGlobStream wrapper.
| DOMDocument | $domxml | A DOM node with the document resulting from the parsing and interpretation of the configuration file. |
Definition at line 125 of file Main.php.
References Erebot\XGlobStream\TAG, and Erebot\XGlobStream\XMLNS.
Referenced by Erebot\Config\Main\load().