From 6125a279693a54d04cbd63d7aee03cf7b9a85f00 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 21 Feb 2014 16:58:13 +0200 Subject: Remove CI_Calendar:: Only use it in generate(). --- system/libraries/Calendar.php | 44 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'system') diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index cdcbfe9d7..1a0d02ba0 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -39,20 +39,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_Calendar { - /** - * Reference to CodeIgniter instance - * - * @var object - */ - protected $CI; - - /** - * Current local time - * - * @var int - */ - public $local_time; - /** * Calendar layout template * @@ -109,6 +95,17 @@ class CI_Calendar { */ public $show_other_days = FALSE; + // -------------------------------------------------------------------- + + /** + * CI Singleton + * + * @var object + */ + protected $CI; + + // -------------------------------------------------------------------- + /** * Class constructor * @@ -128,12 +125,7 @@ class CI_Calendar { $this->CI->lang->load('calendar'); } - $this->local_time = time(); - - if (count($config) > 0) - { - $this->initialize($config); - } + empty($config) OR $this->initialize($config); log_message('debug', 'Calendar Class Initialized'); } @@ -179,10 +171,12 @@ class CI_Calendar { */ public function generate($year = '', $month = '', $data = array()) { + $local_time = time(); + // Set and validate the supplied month/year if (empty($year)) { - $year = date('Y', $this->local_time); + $year = date('Y', $local_time); } elseif (strlen($year) === 1) { @@ -195,7 +189,7 @@ class CI_Calendar { if (empty($month)) { - $month = date('m', $this->local_time); + $month = date('m', $local_time); } elseif (strlen($month) === 1) { @@ -226,9 +220,9 @@ class CI_Calendar { // Set the current month/year/day // We use this to determine the "today" date - $cur_year = date('Y', $this->local_time); - $cur_month = date('m', $this->local_time); - $cur_day = date('j', $this->local_time); + $cur_year = date('Y', $local_time); + $cur_month = date('m', $local_time); + $cur_day = date('j', $local_time); $is_current_month = ($cur_year == $year && $cur_month == $month); -- cgit v1.2.3-24-g4f1b