summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Calendar.php42
-rw-r--r--system/libraries/User_agent.php178
-rw-r--r--user_guide/libraries/trackback.html4
-rw-r--r--user_guide/libraries/uri.html2
-rw-r--r--user_guide/nav/nav.js1
5 files changed, 193 insertions, 34 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 23a6bf791..048934b82 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -398,27 +398,27 @@ class CI_Calendar {
function default_template()
{
return array (
- 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
- 'heading_row_start' => '<tr>',
- 'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
- 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
- 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
- 'heading_row_end' => '</tr>',
- 'week_row_start' => '<tr>',
- 'week_day_cell' => '<td>{week_day}</td>',
- 'week_row_end' => '</tr>',
- 'cal_row_start' => '<tr>',
- 'cal_cell_start' => '<td>',
- 'cal_cell_start_today' => '<td>',
- 'cal_cell_content' => '<a href="{content}">{day}</a>',
- 'cal_cell_content_today' => '<a href="{content}"><strong>{day}</strong></a>',
- 'cal_cell_no_content' => '{day}',
- 'cal_cell_no_content_today' => '<strong>{day}</strong>',
- 'cal_cell_blank' => '&nbsp;',
- 'cal_cell_end' => '</td>',
- 'cal_cell_end_today' => '</td>',
- 'cal_row_end' => '</tr>',
- 'table_close' => '</table>'
+ 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
+ 'heading_row_start' => '<tr>',
+ 'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
+ 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
+ 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
+ 'heading_row_end' => '</tr>',
+ 'week_row_start' => '<tr>',
+ 'week_day_cell' => '<td>{week_day}</td>',
+ 'week_row_end' => '</tr>',
+ 'cal_row_start' => '<tr>',
+ 'cal_cell_start' => '<td>',
+ 'cal_cell_start_today' => '<td>',
+ 'cal_cell_content' => '<a href="{content}">{day}</a>',
+ 'cal_cell_content_today' => '<a href="{content}"><strong>{day}</strong></a>',
+ 'cal_cell_no_content' => '{day}',
+ 'cal_cell_no_content_today' => '<strong>{day}</strong>',
+ 'cal_cell_blank' => '&nbsp;',
+ 'cal_cell_end' => '</td>',
+ 'cal_cell_end_today' => '</td>',
+ 'cal_row_end' => '</tr>',
+ 'table_close' => '</table>'
);
}
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 33e8451c6..8c63924b9 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -33,6 +33,9 @@ class CI_User_agent {
var $is_browser = FALSE;
var $is_robot = FALSE;
var $is_mobile = FALSE;
+
+ var $languages = array();
+ var $charsets = array();
var $platform = '';
var $browser = '';
@@ -40,7 +43,6 @@ class CI_User_agent {
var $moble = '';
var $robot = '';
-
var $platforms = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
@@ -55,12 +57,13 @@ class CI_User_agent {
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
- 'mac os x' => 'Mac OS X',
+ 'os x' => 'Mac OS X',
+ 'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
- 'sunos' => 'Sun Solaris',
'linux' => 'Linux',
'debian' => 'Debian',
+ 'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
@@ -80,12 +83,21 @@ class CI_User_agent {
'Internet Explorer' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
+ 'Chimera' => 'Chimera',
+ 'Phoenix' => 'Phoenix',
+ 'Firebird' => 'Firebird',
'Camino' => 'Camino',
+ 'Netscape' => 'Netscape',
+ 'OmniWeb' => 'OmniWeb',
'Mozilla' => 'Mozilla',
'Safari' => 'Safari',
'Konqueror' => 'Konqueror',
+ 'icab' => 'iCab',
'Lynx' => 'Lynx',
- 'ANTFresco' => 'Fresco'
+ 'Links' => 'Links',
+ 'hotjava' => 'HotJava',
+ 'amaya' => 'Amaya',
+ 'IBrowse' => 'IBrowse'
);
var $mobiles = array(
@@ -488,7 +500,7 @@ class CI_User_agent {
return FALSE;
}
-
+
// --------------------------------------------------------------------
/**
@@ -535,6 +547,51 @@ class CI_User_agent {
return FALSE;
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Set the accepted languages
+ *
+ * @access private
+ * @return void
+ */
+ function _set_languages()
+ {
+ if ((count($this->languages) == 0) AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '')
+ {
+ $languages = preg_replace('/(;q=.+)/i', '', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+
+ $this->languages = explode(',', $languages);
+ }
+
+ if (count($this->languages) == 0)
+ {
+ $this->languages = array('Undefined');
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set the accepted character sets
+ *
+ * @access private
+ * @return void
+ */
+ function _set_charsets()
+ {
+ if ((count($this->charsets) == 0) AND isset($_SERVER['HTTP_ACCEPT_CHARSET']) AND $_SERVER['HTTP_ACCEPT_CHARSET'] != '')
+ {
+ $charsets = preg_replace('/(;q=.+)/i', '', $_SERVER['HTTP_ACCEPT_CHARSET']);
+
+ $this->charsets = explode(',', $charsets);
+ }
+
+ if (count($this->charsets) == 0)
+ {
+ $this->charsets = array('Undefined');
+ }
+ }
// --------------------------------------------------------------------
@@ -578,12 +635,38 @@ class CI_User_agent {
// --------------------------------------------------------------------
/**
+ * Is this a referral from another site?
+ *
+ * @access public
+ * @return bool
+ */
+ function is_referral()
+ {
+ return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Agent String
+ *
+ * @access public
+ * @return string
+ */
+ function agent()
+ {
+ return $this->agent;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Get Platform
*
* @access public
* @return string
*/
- function get_platform()
+ function platform()
{
return $this->platform;
}
@@ -596,7 +679,7 @@ class CI_User_agent {
* @access public
* @return string
*/
- function get_browser()
+ function browser()
{
return $this->browser;
}
@@ -609,7 +692,7 @@ class CI_User_agent {
* @access public
* @return string
*/
- function get_version()
+ function version()
{
return $this->version;
}
@@ -622,7 +705,7 @@ class CI_User_agent {
* @access public
* @return string
*/
- function get_robot()
+ function robot()
{
return $this->robot;
}
@@ -634,11 +717,86 @@ class CI_User_agent {
* @access public
* @return string
*/
- function get_mobile()
+ function mobile()
{
return $this->mobile;
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Get the referrer
+ *
+ * @access public
+ * @return bool
+ */
+ function referrer()
+ {
+ return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : $_SERVER['HTTP_REFERER'];
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Get the accepted languages
+ *
+ * @access public
+ * @return array
+ */
+ function languages()
+ {
+ if (count($this->languages) == 0)
+ {
+ $this->_set_languages();
+ }
+
+ return $this->languages;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Get the accepted Character Sets
+ *
+ * @access public
+ * @return array
+ */
+ function charsets()
+ {
+ if (count($this->charsets) == 0)
+ {
+ $this->_set_charsets();
+ }
+
+ return $this->charsets;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Test for a particular language
+ *
+ * @access public
+ * @return bool
+ */
+ function accept_lang($lang = 'en')
+ {
+ return (in_array(strtolower($lang), $this->languages(), TRUE)) ? TRUE : FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Test for a particular character set
+ *
+ * @access public
+ * @return bool
+ */
+ function accept_charset($charset = 'utf-8')
+ {
+ return (in_array(strtolower($charset), $this->charsets(), TRUE)) ? TRUE : FALSE;
+ }
+
}
diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html
index c2c9e815e..0621d4e75 100644
--- a/user_guide/libraries/trackback.html
+++ b/user_guide/libraries/trackback.html
@@ -238,11 +238,11 @@ It returns TRUE on success and FALSE on failure. If it fails you will issue an
<div id="footer">
<p>
-Previous Topic:&nbsp;&nbsp;<a href="sessions.html">Session Class</a>
+Previous Topic:&nbsp;&nbsp;<a href="table.html">HTML Table Class</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="parser.html">Template Parser Class</a>
+Next Topic:&nbsp;&nbsp;<a href="unit_testing.html">Unit Testing Class</a>
<p>
<p><a href="http://www.codeigniter.com">Code Igniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 &nbsp;&middot;&nbsp; <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
</div>
diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html
index 8d2f2ee31..e221f4c63 100644
--- a/user_guide/libraries/uri.html
+++ b/user_guide/libraries/uri.html
@@ -249,7 +249,7 @@ Previous Topic:&nbsp;&nbsp;<a href="parser.html">Template Parser Class</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="validation.html">Validation Class</a>
+Next Topic:&nbsp;&nbsp;<a href="user_agent.html">User Agent Class</a>
<p>
<p><a href="http://www.codeigniter.com">Code Igniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 &nbsp;&middot;&nbsp; <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
</div>
diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js
index 8d1955729..b280e8fc7 100644
--- a/user_guide/nav/nav.js
+++ b/user_guide/nav/nav.js
@@ -78,6 +78,7 @@ function create_menu(basepath)
'<li><a href="'+base+'libraries/output.html">Output Class</a></li>' +
'<li><a href="'+base+'libraries/pagination.html">Pagination Class</a></li>' +
'<li><a href="'+base+'libraries/sessions.html">Session Class</a></li>' +
+ '<li><a href="'+base+'libraries/table.html">Table Class</a></li>' +
'<li><a href="'+base+'libraries/trackback.html">Trackback Class</a></li>' +
'<li><a href="'+base+'libraries/parser.html">Template Parser Class</a></li>' +
'<li><a href="'+base+'libraries/unit_testing.html">Unit Testing Class</a></li>' +