summaryrefslogtreecommitdiffstats
path: root/system/libraries/Pagination.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-13 13:49:55 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-13 13:49:55 +0100
commitaef63e532bcede1d455bc27f0fc6f369ab74f203 (patch)
treecb45c347ce82f8fd2b4b898f591050293ee84267 /system/libraries/Pagination.php
parent0bd390c660290b7dc478955da6a8a7fbb3ca9fd6 (diff)
Add language translation support to CI_Pagination (#1589)
Diffstat (limited to 'system/libraries/Pagination.php')
-rw-r--r--system/libraries/Pagination.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index da4b89232..2f1bcfbad 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -304,6 +304,16 @@ class CI_Pagination {
*/
public function __construct($params = array())
{
+ $CI =& get_instance();
+ $CI->load->language('paginaton');
+ foreach (array('first_link', 'next_link', 'prev_link', 'last_link') as $key)
+ {
+ if (($val = $CI->lang->line('pagination_'.$key)) !== FALSE)
+ {
+ $this->$key = $val;
+ }
+ }
+
$this->initialize($params);
log_message('debug', 'Pagination Class Initialized');
}
@@ -316,7 +326,7 @@ class CI_Pagination {
* @param array $params Initialization parameters
* @return CI_Pagination
*/
- public function initialize($params = array())
+ public function initialize(array $params = array())
{
if (isset($params['attributes']) && is_array($params['attributes']))
{
@@ -332,14 +342,11 @@ class CI_Pagination {
unset($params['anchor_class']);
}
- if (count($params) > 0)
+ foreach ($params as $key => $val)
{
- foreach ($params as $key => $val)
+ if (property_exists($this, $this->$key))
{
- if (isset($this->$key))
- {
- $this->$key = $val;
- }
+ $this->$key = $val;
}
}