/** * The constructor will initialise a list of the people who are allowed * to evaluate direct PHP code, using the configuration manager. */ public function __construct() { $pConfiguration = Configuration::getInstance(); $aConfiguration = $pConfiguration->get('Owners'); if (!count($aConfiguration)) { return; } $this->m_sPrefix = $aConfiguration['Prefix']; $this->m_aOwnerInfo = array(); for ($i = 0; isset($aConfiguration[$i]); $i++) { list($Nickname, $Username, $Hostname) = preg_split('/!|@/s', strtolower($aConfiguration[$i]['Username'])); $this->m_aOwnerInfo[] = array('Nickname' => $Nickname, 'Username' => $Username, 'Hostname' => $Hostname, 'Password' => $aConfiguration[$i]['Password'], 'Identified' => isset($aConfiguration[$i]['Identified']) ? $aConfiguration[$i]['Identified'] : false, 'CachedUser' => ''); } }
/** * The constructor will create a new connection with the predefined * connection details. It's private because of the Singleton pattern. */ public function __construct() { $aConfiguration = Configuration::getInstance()->get('LVPDatabase'); parent::__construct($aConfiguration['hostname'], $aConfiguration['username'], $aConfiguration['password'], $aConfiguration['database']); }
/** * Here we process each individual message if it matches the right user and * channel. If so we can send it to the specific module to process it. * * @param Bot $pBot * @param string $channel * @param string $sNickname * @param string $message */ public function onChannelPrivmsg(Bot $pBot, $sChannel, $sNickname, $sMessage) { if ($sChannel[0] == '+' || $sChannel[0] == '%' || $sChannel[0] == '@' || $sChannel[0] == '&' || $sChannel[0] == '~') { $channel = substr($sChannel, 1); } $channel = strtolower($sChannel); $message = Util::stripFormat($sMessage); if ($channel == self::ECHO_CHANNEL || $channel == self::LOGGING_CHANNEL) { $pConfiguration = Configuration::getInstance(); $aConfiguration = $pConfiguration->get('LVP'); if (in_array($sNickname, $aConfiguration['NuwaniSistersEchoBots'])) { if ($message == '*** Global Gamemode Initialization') { Seen::resetOnlinePlayersAtGamemodeInit(); Merchant::resetInformation(); } else { Seen::setPersonInformation($message); Merchant::setInformation($message); TempHistory::messageHandler($message); if ($pBot['Nickname'] == 'Monique') { QuoteDevice::setInformation($pBot, $message); } } } if ($message == '!players') { Seen::syncOnlinePlayers(); } } if ($channel == self::RADIO_CHANNEL && $sNickname == 'LVP_Radio') { Radio::setNowPlayingInformation($message); } }
public function __construct() { $configuration = Configuration::getInstance(); $this->configuration = $configuration->get('Statistics'); $this->logger = new $this->configuration['ILoggerImplementation'](); }