public static function getLangISO() { if (self::$LAST_USER !== false) { return self::$LAST_USER->getLangISO(); } elseif (self::$LAST_CHANNEL !== false) { return self::$LAST_CHANNEL->getLangISO(); } elseif (self::$LAST_SERVER !== false) { return self::$LAST_SERVER->getLangISO(); } else { return 'en'; } }
/** * @param int $sid * @param string $name * @return Dog_Channel */ public static function getOrCreate(Dog_Server $server, $name) { $sid = $server->getID(); if (false !== ($channel = self::getForServer($sid, $name))) { return $channel; } $channel = new self(array('chan_id' => '0', 'chan_sid' => $sid, 'chan_name' => $name, 'chan_lang' => $server->getLangISO(), 'chan_pass' => NULL, 'chan_modes' => '', 'chan_triggers' => NULL, 'chan_options' => self::DEFAULT_OPTIONS)); return $channel->insert() ? $channel : false; }