[ci skip] Clean-up following PR #2864
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index b9c01ee..23c389e 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -59,7 +59,7 @@
* @var mixed
*/
public $template = '';
-
+
/**
* Replacements array for template
*
@@ -532,11 +532,11 @@
{
return $this;
}
-
+
if (is_string($this->template))
{
$today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today');
-
+
foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today', 'cal_cell_start_other', 'cal_cell_other', 'cal_cell_end_other') as $val)
{
if (preg_match('/\{'.$val.'\}(.*?)\{\/'.$val.'\}/si', $this->template, $match))
@@ -553,7 +553,7 @@
{
$this->replacements = array_merge($this->replacements, $this->template);
}
-
+
return $this;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5d5c5df..9ec4d0d 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -299,8 +299,8 @@
- Added method chaining support.
- Added configuration to generate days of other months instead of blank cells.
- - Auto set *next_prev_url* if it is empty and *show_prev_next* is set to TRUE.
- - The template now accepts an array in addition to the encoded string.
+ - Added auto-configuration for *next_prev_url* if it is empty and *show_prev_next* is set to TRUE.
+ - Added support for templating via an array in addition to the encoded string.
- :doc:`Cart Library <libraries/cart>` changes include:
diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst
index 792f1d5..b4f95db 100644
--- a/user_guide_src/source/libraries/calendar.rst
+++ b/user_guide_src/source/libraries/calendar.rst
@@ -60,11 +60,11 @@
$this->load->library('calendar');
$data = array(
- 3 => 'http://example.com/news/article/2006/03/',
- 7 => 'http://example.com/news/article/2006/07/',
- 13 => 'http://example.com/news/article/2006/13/',
- 26 => 'http://example.com/news/article/2006/26/'
- );
+ 3 => 'http://example.com/news/article/2006/03/',
+ 7 => 'http://example.com/news/article/2006/07/',
+ 13 => 'http://example.com/news/article/2006/13/',
+ 26 => 'http://example.com/news/article/2006/26/'
+ );
echo $this->calendar->generate(2006, 6, $data);
@@ -83,11 +83,11 @@
the calendar. Preferences are set by passing an array of preferences in
the second parameter of the loading function. Here is an example::
- $prefs = array (
- 'start_day' => 'saturday',
- 'month_type' => 'long',
- 'day_type' => 'short'
- );
+ $prefs = array(
+ 'start_day' => 'saturday',
+ 'month_type' => 'long',
+ 'day_type' => 'short'
+ );
$this->load->library('calendar', $prefs);
@@ -123,10 +123,10 @@
next/previous links requires that you set up your calendar code similar
to this example::
- $prefs = array (
- 'show_next_prev' => TRUE,
- 'next_prev_url' => 'http://example.com/index.php/calendar/show/'
- );
+ $prefs = array(
+ 'show_next_prev' => TRUE,
+ 'next_prev_url' => 'http://example.com/index.php/calendar/show/'
+ );
$this->load->library('calendar', $prefs);
@@ -147,63 +147,67 @@
============================
By creating a calendar template you have 100% control over the design of
-your calendar. Using the string method, each component of your calendar will be placed within a
-pair of pseudo-variables as shown here::
+your calendar. Using the string method, each component of your calendar
+will be placed within a pair of pseudo-variables as shown here::
$prefs['template'] = '
- {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
+ {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
- {heading_row_start}<tr>{/heading_row_start}
+ {heading_row_start}<tr>{/heading_row_start}
- {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
- {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
- {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
+ {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
+ {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
+ {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
- {heading_row_end}</tr>{/heading_row_end}
+ {heading_row_end}</tr>{/heading_row_end}
- {week_row_start}<tr>{/week_row_start}
- {week_day_cell}<td>{week_day}</td>{/week_day_cell}
- {week_row_end}</tr>{/week_row_end}
+ {week_row_start}<tr>{/week_row_start}
+ {week_day_cell}<td>{week_day}</td>{/week_day_cell}
+ {week_row_end}</tr>{/week_row_end}
- {cal_row_start}<tr>{/cal_row_start}
- {cal_cell_start}<td>{/cal_cell_start}
- {cal_cell_start_today}<td>{/cal_cell_start_today}
- {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other}
+ {cal_row_start}<tr>{/cal_row_start}
+ {cal_cell_start}<td>{/cal_cell_start}
+ {cal_cell_start_today}<td>{/cal_cell_start_today}
+ {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other}
- {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
- {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
+ {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
+ {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
- {cal_cell_no_content}{day}{/cal_cell_no_content}
- {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
+ {cal_cell_no_content}{day}{/cal_cell_no_content}
+ {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
- {cal_cell_blank} {/cal_cell_blank}
+ {cal_cell_blank} {/cal_cell_blank}
- {cal_cell_other}{day}{cal_cel_other}
+ {cal_cell_other}{day}{cal_cel_other}
- {cal_cell_end}</td>{/cal_cell_end}
- {cal_cell_end_today}</td>{/cal_cell_end_today}
- {cal_cell_end_other}</td>{/cal_cell_end_other}
- {cal_row_end}</tr>{/cal_row_end}
+ {cal_cell_end}</td>{/cal_cell_end}
+ {cal_cell_end_today}</td>{/cal_cell_end_today}
+ {cal_cell_end_other}</td>{/cal_cell_end_other}
+ {cal_row_end}</tr>{/cal_row_end}
- {table_close}</table>{/table_close}
+ {table_close}</table>{/table_close}
';
$this->load->library('calendar', $prefs);
echo $this->calendar->generate();
-Using the array method, you will pass `key => value` pairs. You can pass as many or as few values as you'd like. Omitted keys will use the default values inherit in the calendar class.
+Using the array method, you will pass `key => value` pairs. You can pass as
+many or as few values as you'd like. Omitted keys will use the default values
+inherited in the calendar class.
- $prefs['template'] = array(
- 'table_open' => '<table class="calendar">',
- 'cal_cell_start' => '<td class="day">',
- 'cal_cell_start_today' => '<td class="today">',
- );
+Example::
+
+ $prefs['template'] = array(
+ 'table_open' => '<table class="calendar">',
+ 'cal_cell_start' => '<td class="day">',
+ 'cal_cell_start_today' => '<td class="today">'
+ );
- $this->load->library('calendar', $prefs);
+ $this->load->library('calendar', $prefs);
- echo $this->calendar->generate();
+ echo $this->calendar->generate();
***************
Class Reference