71 lines
1.7 KiB
PHP
71 lines
1.7 KiB
PHP
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||
|
|
||
|
/**
|
||
|
* This is class is for site level configuration
|
||
|
*
|
||
|
* @package lnApp
|
||
|
* @category Helpers
|
||
|
* @author Deon George
|
||
|
* @copyright (c) 2009-2013 Deon George
|
||
|
* @license http://dev.leenooks.net/license.html
|
||
|
*/
|
||
|
abstract class lnApp_Site {
|
||
|
/**
|
||
|
* Return our application name
|
||
|
*/
|
||
|
public static function Appname() {
|
||
|
return Kohana::$config->load('config')->appname;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show a date using a site configured format
|
||
|
*/
|
||
|
public static function Date($date) {
|
||
|
return (is_null($date) OR ! $date) ? '' : date(Kohana::$config->load('config')->date_format,$date);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show a date using a site configured format
|
||
|
* @note We need this function here, since we call self:: methods, which need to resolve to the child class.
|
||
|
*/
|
||
|
public static function Datetime($date) {
|
||
|
return sprintf('%s %s',self::Date($date),self::Time($date));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return the site configured language
|
||
|
*/
|
||
|
public static function Language() {
|
||
|
return Kohana::$config->load('config')->language;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return the protocol that the site is using
|
||
|
*
|
||
|
* @param string URL to be included in the return
|
||
|
*/
|
||
|
public static function Protocol($url='') {
|
||
|
static $secure = NULL;
|
||
|
|
||
|
if (! $secure AND Request::current())
|
||
|
$secure = Request::current()->secure() ? 'https://' : 'http://';
|
||
|
|
||
|
return $secure.($url ? $url : '');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return the site theme
|
||
|
*/
|
||
|
public static function Theme() {
|
||
|
return 'theme/'.Kohana::$config->load('config')->theme;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Show a time using a site configured format
|
||
|
*/
|
||
|
public static function Time($date) {
|
||
|
return date(Kohana::$config->load('config')->date_format,($date ? $date : time()));
|
||
|
}
|
||
|
}
|
||
|
?>
|