function load(k_Context $context) { if ($context->session('identity')) { return $context->session('identity'); } return new k_Anonymous(); }
function load(k_Context $context) { // Default to English $phrases = array('Hello' => 'Hello', 'Meatballs' => 'Meatballs'); if ($context->language()->isoCode() == 'sv') { $phrases = array('Hello' => 'Bork, bork, bork!', 'Meatballs' => 'Swedish meatballs'); } return new SimpleTranslator($phrases); }
function load(k_Context $context) { if ($context->query('lang') == 'sv') { return new SwedishLanguage(); } else { if ($context->query('lang') == 'en') { return new EnglishLanguage(); } } return new EnglishLanguage(); }
function load(k_Context $context) { return new k_Translation2Translator($context->language()->isoCode()); }
function logRequestStart(k_Context $context) { $this->write('(request' . "\n" . ' (time "' . date("Y-m-d H:i:s") . '")' . "\n" . ' (method "' . $context->method() . '")' . "\n" . ' (request-uri "' . addslashes($context->requestUri()) . '")' . "\n" . ' (headers ' . $this->indent($this->dumper->dump($context->header())) . "))" . "\n"); }
/** * @param string * @param mixed The default value to return, if the value doesn't exist * @return string */ function get($key, $default = null) { return isset($this->state[$this->namespace . $key]) ? $this->state[$this->namespace . $key] : $this->context->query($this->namespace . $key, $default); }