phpldapadmin/application/classes/Config.php
2013-06-25 13:18:36 +10:00

108 lines
2.6 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends the core Kohana class by adding some core application
* specific functions, and configuration.
*
* @package PLA
* @subpackage Config
* @category Helpers
* @author Deon George
* @copyright (c) phpLDAPadmin Development Team
* @license http://dev.phpldapadmin.org/license.html
*/
class Config extends Kohana_Config {
// Our default logo, if there is no site logo
public static $logo = 'img/logo-small.png';
/**
* Some early initialisation
*
* At this point, KH hasnt been fully initialised either, so we cant rely on
* too many KH functions yet.
*
* NOTE: Kohana doesnt provide a parent construct for the Kohana_Config class.
*/
public function __construct() {
}
/**
* Get the singleton instance of Config.
*
* $config = Config::instance();
*
* @return Config
* @compat Restore KH 3.1 functionality
*/
public static function instance() {
if (Config::$_instance === NULL)
// Create a new instance
Config::$_instance = new Config;
return Config::$_instance;
}
/**
* Return our caching mechanism
*/
public static function cachetype() {
return is_null(Kohana::$config->load('config')->cache_type) ? 'file' : Kohana::$config->load('config')->cache_type;
}
public static function copywrite() {
return '(c) phpLDAPadmin Development Team';
}
public static function country() {
return NULL;
}
public static function language() {
// @todo To implement
return 'auto';
}
/**
* The URI to show for the login prompt.
* Normally if the user is logged in, we can replace it with something else
*/
public static function login_uri() {
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? $ao->name() : HTML::anchor('login',_('Login'));
}
public static function logo() {
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
}
public static function logo_uri($protocol=NULL) {
list ($path,$suffix) = explode('.',static::$logo);
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),$protocol);
}
public static function siteid($format=FALSE) {
return '';
}
/**
* Work out our site mode (dev,test,prod)
*/
public static function sitemode() {
return Kohana::$config->load('config.site')->mode;
}
public static function sitename() {
return 'phpLDAPadmin';
}
public static function theme() {
return Kohana::$config->load('config')->theme;
}
public static function version() {
// @todo Work out our versioning
return 'TBA';
}
}
?>