This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnapp/classes/lnApp/Site.php

78 lines
1.9 KiB
PHP
Raw Normal View History

2014-08-22 06:50:01 +00:00
<?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));
}
2014-08-22 13:34:38 +00:00
/**
* Return the site configured language
*/
public static function ID($format=FALSE) {
return $format ? sprintf('%02s',Kohana::$config->load('config')->id) : Kohana::$config->load('config')->id;
2014-08-22 13:34:38 +00:00
}
2014-08-22 06:50:01 +00:00
/**
* 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) {
2014-08-22 07:06:15 +00:00
return date(Kohana::$config->load('config')->time_format,($date ? $date : time()));
2014-08-22 06:50:01 +00:00
}
}
?>