summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Calendar.php44
1 files changed, 19 insertions, 25 deletions
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
@@ -40,20 +40,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
*
* @var mixed
@@ -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);