summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorRonald Beilsma <beilsma@gmail.com>2012-01-10 15:45:31 +0100
committerRonald Beilsma <beilsma@gmail.com>2012-01-10 15:45:31 +0100
commit25dcb93d05bd098e89188ea0691adf72228bd131 (patch)
tree37d3d769f2e64bebb48a98378c7aee3ab4c17efe /system/libraries
parentdb66eb38cfc4a2ab6c8816b8f7663211232d4f4e (diff)
parente9a5a862a1252548b463aa738e50e8d9bfd01379 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Cache/Cache.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_dummy.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php2
-rw-r--r--system/libraries/Calendar.php2
-rw-r--r--system/libraries/Cart.php2
-rw-r--r--system/libraries/Driver.php4
-rw-r--r--system/libraries/Email.php2
-rw-r--r--system/libraries/Encrypt.php2
-rw-r--r--system/libraries/Form_validation.php48
-rw-r--r--system/libraries/Ftp.php2
-rw-r--r--system/libraries/Image_lib.php243
-rw-r--r--system/libraries/Javascript.php2
-rw-r--r--system/libraries/Log.php2
-rw-r--r--system/libraries/Migration.php4
-rw-r--r--system/libraries/Pagination.php16
-rw-r--r--system/libraries/Parser.php2
-rw-r--r--system/libraries/Profiler.php2
-rw-r--r--system/libraries/Session.php2
-rw-r--r--system/libraries/Table.php2
-rw-r--r--system/libraries/Trackback.php2
-rw-r--r--system/libraries/Typography.php2
-rw-r--r--system/libraries/Unit_test.php2
-rw-r--r--system/libraries/Upload.php2
-rw-r--r--system/libraries/User_agent.php2
-rw-r--r--system/libraries/Xmlrpc.php429
-rw-r--r--system/libraries/Xmlrpcs.php2
-rw-r--r--system/libraries/Zip.php2
-rw-r--r--system/libraries/javascript/Jquery.php2
30 files changed, 336 insertions, 456 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 87253739c..2e78a6660 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index 90b68688d..93993d07a 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php
index ff787e90b..fcd55da39 100644
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 194279726..4a81b0422 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index 0037e6755..ffe6f2ff7 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 605765bf6..a05a7babf 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 01a0cb8ce..ba8d69be2 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 183a95985..4e8944311 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -76,7 +76,7 @@ class CI_Driver_Library {
if (file_exists($filepath))
{
include_once $filepath;
- break;
+ break 2;
}
}
}
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 1066535c7..922107e9f 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 92b0b3c4a..e297576e6 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index d83afdd25..0a6a2af0d 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -78,7 +78,6 @@ class CI_Form_validation {
* This function takes an array of field names and validation
* rules as input, validates the info, and stores it
*
- * @access public
* @param mixed
* @param string
* @return void
@@ -168,7 +167,6 @@ class CI_Form_validation {
* Lets users set their own error messages on the fly. Note: The key
* name has to match the function name that it corresponds to.
*
- * @access public
* @param string
* @param string
* @return string
@@ -192,7 +190,6 @@ class CI_Form_validation {
*
* Permits a prefix/suffix to be added to each error message
*
- * @access public
* @param string
* @param string
* @return void
@@ -212,7 +209,6 @@ class CI_Form_validation {
*
* Gets the error message associated with a particular field
*
- * @access public
* @param string the field name
* @return void
*/
@@ -243,7 +239,6 @@ class CI_Form_validation {
*
* Returns the error messages as a string, wrapped in the error delimiters
*
- * @access public
* @param string
* @param string
* @return str
@@ -286,7 +281,6 @@ class CI_Form_validation {
*
* This function does all the work.
*
- * @access public
* @return bool
*/
public function run($group = '')
@@ -371,7 +365,6 @@ class CI_Form_validation {
/**
* Traverse a multidimensional $_POST array index until the data is found
*
- * @access protected
* @param array
* @param array
* @param integer
@@ -392,7 +385,6 @@ class CI_Form_validation {
/**
* Re-populate the _POST array with our finalized and processed data
*
- * @access protected
* @return null
*/
protected function _reset_post_array()
@@ -450,7 +442,6 @@ class CI_Form_validation {
/**
* Executes the Validation routines
*
- * @access protected
* @param array
* @param array
* @param mixed
@@ -680,7 +671,6 @@ class CI_Form_validation {
/**
* Translate a field name
*
- * @access protected
* @param string the field name
* @return string
*/
@@ -711,7 +701,6 @@ class CI_Form_validation {
* Permits you to repopulate a form field with the value it was submitted
* with, or, if that value doesn't exist, with the default
*
- * @access public
* @param string the field name
* @param string
* @return void
@@ -741,7 +730,6 @@ class CI_Form_validation {
* Enables pull-down lists to be set to the value the user
* selected in the event of an error
*
- * @access public
* @param string
* @param string
* @return string
@@ -785,7 +773,6 @@ class CI_Form_validation {
* Enables radio buttons to be set to the value the user
* selected in the event of an error
*
- * @access public
* @param string
* @param string
* @return string
@@ -829,7 +816,6 @@ class CI_Form_validation {
* Enables checkboxes to be set to the value the user
* selected in the event of an error
*
- * @access public
* @param string
* @param string
* @return string
@@ -845,7 +831,6 @@ class CI_Form_validation {
/**
* Required
*
- * @access public
* @param string
* @return bool
*/
@@ -859,7 +844,6 @@ class CI_Form_validation {
/**
* Performs a Regular Expression match test.
*
- * @access public
* @param string
* @param regex
* @return bool
@@ -874,7 +858,6 @@ class CI_Form_validation {
/**
* Match one field to another
*
- * @access public
* @param string
* @param field
* @return bool
@@ -894,9 +877,11 @@ class CI_Form_validation {
// --------------------------------------------------------------------
/**
- * Match one field to another
+ * Is Unique
+ *
+ * Check if the input value doesn't already exist
+ * in the specified database field.
*
- * @access public
* @param string
* @param field
* @return bool
@@ -917,7 +902,6 @@ class CI_Form_validation {
/**
* Minimum Length
*
- * @access public
* @param string
* @param value
* @return bool
@@ -942,7 +926,6 @@ class CI_Form_validation {
/**
* Max Length
*
- * @access public
* @param string
* @param value
* @return bool
@@ -967,7 +950,6 @@ class CI_Form_validation {
/**
* Exact Length
*
- * @access public
* @param string
* @param value
* @return bool
@@ -992,7 +974,6 @@ class CI_Form_validation {
/**
* Valid Email
*
- * @access public
* @param string
* @return bool
*/
@@ -1006,7 +987,6 @@ class CI_Form_validation {
/**
* Valid Emails
*
- * @access public
* @param string
* @return bool
*/
@@ -1033,7 +1013,6 @@ class CI_Form_validation {
/**
* Validate IP Address
*
- * @access public
* @param string
* @return bool
*/
@@ -1047,7 +1026,6 @@ class CI_Form_validation {
/**
* Alpha
*
- * @access public
* @param string
* @return bool
*/
@@ -1061,7 +1039,6 @@ class CI_Form_validation {
/**
* Alpha-numeric
*
- * @access public
* @param string
* @return bool
*/
@@ -1075,7 +1052,6 @@ class CI_Form_validation {
/**
* Alpha-numeric with underscores and dashes
*
- * @access public
* @param string
* @return bool
*/
@@ -1089,7 +1065,6 @@ class CI_Form_validation {
/**
* Numeric
*
- * @access public
* @param string
* @return bool
*/
@@ -1104,7 +1079,6 @@ class CI_Form_validation {
/**
* Is Numeric
*
- * @access public
* @param string
* @return bool
*/
@@ -1118,7 +1092,6 @@ class CI_Form_validation {
/**
* Integer
*
- * @access public
* @param string
* @return bool
*/
@@ -1132,7 +1105,6 @@ class CI_Form_validation {
/**
* Decimal number
*
- * @access public
* @param string
* @return bool
*/
@@ -1146,7 +1118,6 @@ class CI_Form_validation {
/**
* Greather than
*
- * @access public
* @param string
* @return bool
*/
@@ -1164,7 +1135,6 @@ class CI_Form_validation {
/**
* Less than
*
- * @access public
* @param string
* @return bool
*/
@@ -1182,7 +1152,6 @@ class CI_Form_validation {
/**
* Is a Natural number (0,1,2,3, etc.)
*
- * @access public
* @param string
* @return bool
*/
@@ -1196,7 +1165,6 @@ class CI_Form_validation {
/**
* Is a Natural number, but not a zero (1,2,3, etc.)
*
- * @access public
* @param string
* @return bool
*/
@@ -1213,7 +1181,6 @@ class CI_Form_validation {
* Tests a string for characters outside of the Base64 alphabet
* as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
*
- * @access public
* @param string
* @return bool
*/
@@ -1230,7 +1197,6 @@ class CI_Form_validation {
* This function allows HTML to be safely shown in a form.
* Special characters are converted.
*
- * @access public
* @param string
* @return string
*/
@@ -1259,7 +1225,6 @@ class CI_Form_validation {
/**
* Prep URL
*
- * @access public
* @param string
* @return string
*/
@@ -1283,7 +1248,6 @@ class CI_Form_validation {
/**
* Strip Image Tags
*
- * @access public
* @param string
* @return string
*/
@@ -1297,7 +1261,6 @@ class CI_Form_validation {
/**
* XSS Clean
*
- * @access public
* @param string
* @return string
*/
@@ -1311,7 +1274,6 @@ class CI_Form_validation {
/**
* Convert PHP tags to entities
*
- * @access public
* @param string
* @return string
*/
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 99850a9e5..ab395b0a0 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 20ca1f055..dc7d362ce 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -67,8 +67,8 @@ class CI_Image_lib {
public $wm_padding = 0; // Padding around text
public $wm_hor_offset = 0; // Lets you push text to the right
public $wm_vrt_offset = 0; // Lets you push text down
- public $wm_font_color = '#ffffff'; // Text color
- public $wm_shadow_color = ''; // Dropshadow color
+ protected $wm_font_color = '#ffffff'; // Text color
+ protected $wm_shadow_color = ''; // Dropshadow color
public $wm_shadow_distance = 2; // Dropshadow distance
public $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image
@@ -85,7 +85,7 @@ class CI_Image_lib {
public $create_fnc = 'imagecreatetruecolor';
public $copy_fnc = 'imagecopyresampled';
public $error_msg = array();
- public $wm_use_drop_shadow = FALSE;
+ protected $wm_use_drop_shadow = FALSE;
public $wm_use_truetype = FALSE;
/**
@@ -111,7 +111,6 @@ class CI_Image_lib {
*
* Resets values in case this class is used in a loop
*
- * @access public
* @return void
*/
public function clear()
@@ -154,7 +153,6 @@ class CI_Image_lib {
/**
* initialize image preferences
*
- * @access public
* @param array
* @return bool
*/
@@ -167,7 +165,33 @@ class CI_Image_lib {
{
foreach ($props as $key => $val)
{
- $this->$key = $val;
+ if (property_exists($this, $key))
+ {
+ if (in_array($key, array('wm_font_color', 'wm_shadow_color')))
+ {
+ if (preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
+ {
+ /* $matches[1] contains our hex color value, but it might be
+ * both in the full 6-length format or the shortened 3-length
+ * value.
+ * We'll later need the full version, so we keep it if it's
+ * already there and if not - we'll convert to it. We can
+ * access string characters by their index as in an array,
+ * so we'll do that and use concatenation to form the final
+ * value:
+ */
+ $val = (strlen($matches[1]) === 6)
+ ? '#'.$matches[1]
+ : '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ $this->$key = $val;
+ }
}
}
@@ -334,22 +358,6 @@ class CI_Image_lib {
$this->y_axis = ($this->y_axis == '' OR ! is_numeric($this->y_axis)) ? 0 : $this->y_axis;
// Watermark-related Stuff...
- if ($this->wm_font_color != '')
- {
- if (strlen($this->wm_font_color) == 6)
- {
- $this->wm_font_color = '#'.$this->wm_font_color;
- }
- }
-
- if ($this->wm_shadow_color != '')
- {
- if (strlen($this->wm_shadow_color) == 6)
- {
- $this->wm_shadow_color = '#'.$this->wm_shadow_color;
- }
- }
-
if ($this->wm_overlay_path != '')
{
$this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path));
@@ -359,6 +367,10 @@ class CI_Image_lib {
{
$this->wm_use_drop_shadow = TRUE;
}
+ elseif ($this->wm_use_drop_shadow == TRUE AND $this->wm_shadow_color == '')
+ {
+ $this->wm_use_drop_shadow = FALSE;
+ }
if ($this->wm_font_path != '')
{
@@ -376,18 +388,11 @@ class CI_Image_lib {
* This is a wrapper function that chooses the proper
* resize function based on the protocol specified
*
- * @access public
* @return bool
*/
public function resize()
{
- $protocol = 'image_process_'.$this->image_library;
-
- if (preg_match('/gd2$/i', $protocol))
- {
- $protocol = 'image_process_gd';
- }
-
+ $protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;
return $this->$protocol('resize');
}
@@ -399,18 +404,11 @@ class CI_Image_lib {
* This is a wrapper function that chooses the proper
* cropping function based on the protocol specified
*
- * @access public
* @return bool
*/
public function crop()
{
- $protocol = 'image_process_'.$this->image_library;
-
- if (preg_match('/gd2$/i', $protocol))
- {
- $protocol = 'image_process_gd';
- }
-
+ $protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;
return $this->$protocol('crop');
}
@@ -422,7 +420,6 @@ class CI_Image_lib {
* This is a wrapper function that chooses the proper
* rotation function based on the protocol specified
*
- * @access public
* @return bool
*/
public function rotate()
@@ -453,7 +450,6 @@ class CI_Image_lib {
if ($this->image_library == 'imagemagick' OR $this->image_library == 'netpbm')
{
$protocol = 'image_process_'.$this->image_library;
-
return $this->$protocol('rotate');
}
@@ -474,7 +470,6 @@ class CI_Image_lib {
*
* This function will resize or crop
*
- * @access public
* @param string
* @return bool
*/
@@ -484,20 +479,14 @@ class CI_Image_lib {
// If the target width/height match the source, AND if the new file name is not equal to the old file name
// we'll simply make a copy of the original with the new name... assuming dynamic rendering is off.
- if ($this->dynamic_output === FALSE)
+ if ($this->dynamic_output === FALSE AND $this->orig_width == $this->width AND $this->orig_height == $this->height)
{
- if ($this->orig_width == $this->width AND $this->orig_height == $this->height)
+ if ($this->source_image != $this->new_image AND @copy($this->full_src_path, $this->full_dst_path))
{
- if ($this->source_image != $this->new_image)
- {
- if (@copy($this->full_src_path, $this->full_dst_path))
- {
- @chmod($this->full_dst_path, FILE_WRITE_MODE);
- }
- }
-
- return TRUE;
+ @chmod($this->full_dst_path, FILE_WRITE_MODE);
}
+
+ return TRUE;
}
// Let's set up our values based on the action
@@ -586,7 +575,6 @@ class CI_Image_lib {
*
* This function will resize, crop or rotate
*
- * @access public
* @param string
* @return bool
*/
@@ -601,9 +589,7 @@ class CI_Image_lib {
if ( ! preg_match("/convert$/i", $this->library_path))
{
- $this->library_path = rtrim($this->library_path, '/').'/';
-
- $this->library_path .= 'convert';
+ $this->library_path = rtrim($this->library_path, '/').'/convert';
}
// Execute the command
@@ -656,7 +642,6 @@ class CI_Image_lib {
*
* This function will resize, crop or rotate
*
- * @access public
* @param string
* @return bool
*/
@@ -740,7 +725,6 @@ class CI_Image_lib {
/**
* Image Rotate Using GD
*
- * @access public
* @return bool
*/
public function image_rotate_gd()
@@ -793,7 +777,6 @@ class CI_Image_lib {
*
* This function will flip horizontal or vertical
*
- * @access public
* @return bool
*/
public function image_mirror_gd()
@@ -808,11 +791,8 @@ class CI_Image_lib {
if ($this->rotation_angle == 'hor')
{
- for ($i = 0; $i < $height; $i++)
+ for ($i = 0; $i < $height; $i++, $left = 0, $right = $width-1)
{
- $left = 0;
- $right = $width-1;
-
while ($left < $right)
{
$cl = imagecolorat($src_img, $left, $i);
@@ -828,11 +808,8 @@ class CI_Image_lib {
}
else
{
- for ($i = 0; $i < $width; $i++)
+ for ($i = 0; $i < $width; $i++, $top = 0, $bot = $height-1)
{
- $top = 0;
- $bot = $height-1;
-
while ($top < $bot)
{
$ct = imagecolorat($src_img, $i, $top);
@@ -878,7 +855,6 @@ class CI_Image_lib {
* This is a wrapper function that chooses the type
* of watermarking based on the specified preference.
*
- * @access public
* @param string
* @return bool
*/
@@ -899,7 +875,6 @@ class CI_Image_lib {
/**
* Watermark - Graphic Version
*
- * @access public
* @return bool
*/
public function overlay_watermark()
@@ -993,12 +968,9 @@ class CI_Image_lib {
{
$this->image_display_gd($src_img);
}
- else
+ elseif ( ! $this->image_save_gd($src_img))
{
- if ( ! $this->image_save_gd($src_img))
- {
- return FALSE;
- }
+ return FALSE;
}
imagedestroy($src_img);
@@ -1012,7 +984,6 @@ class CI_Image_lib {
/**
* Watermark - Text Version
*
- * @access public
* @return bool
*/
public function text_watermark()
@@ -1031,21 +1002,6 @@ class CI_Image_lib {
// Fetch source image properties
$this->get_image_properties();
- // Set RGB values for text and shadow
- $this->wm_font_color = str_replace('#', '', $this->wm_font_color);
- $this->wm_shadow_color = str_replace('#', '', $this->wm_shadow_color);
-
- $R1 = hexdec(substr($this->wm_font_color, 0, 2));
- $G1 = hexdec(substr($this->wm_font_color, 2, 2));
- $B1 = hexdec(substr($this->wm_font_color, 4, 2));
-
- $R2 = hexdec(substr($this->wm_shadow_color, 0, 2));
- $G2 = hexdec(substr($this->wm_shadow_color, 2, 2));
- $B2 = hexdec(substr($this->wm_shadow_color, 4, 2));
-
- $txt_color = imagecolorclosest($src_img, $R1, $G1, $B1);
- $drp_color = imagecolorclosest($src_img, $R2, $G2, $B2);
-
// Reverse the vertical offset
// When the image is positioned at the bottom
// we don't want the vertical offset to push it
@@ -1065,7 +1021,9 @@ class CI_Image_lib {
if ($this->wm_use_truetype == TRUE)
{
if ($this->wm_font_size == '')
- $this->wm_font_size = '17';
+ {
+ $this->wm_font_size = 17;
+ }
$fontwidth = $this->wm_font_size-($this->wm_font_size/4);
$fontheight = $this->wm_font_size;
@@ -1090,11 +1048,11 @@ class CI_Image_lib {
switch ($this->wm_vrt_alignment)
{
- case "T" :
+ case 'T':
break;
- case "M": $y_axis += ($this->orig_height/2)+($fontheight/2);
+ case 'M': $y_axis += ($this->orig_height/2)+($fontheight/2);
break;
- case "B": $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight/2));
+ case 'B': $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight/2));
break;
}
@@ -1104,32 +1062,48 @@ class CI_Image_lib {
// Set horizontal alignment
switch ($this->wm_hor_alignment)
{
- case "L":
+ case 'L':
break;
- case "R":
- if ($this->wm_use_drop_shadow)
- $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text));
- $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text));
+ case 'R':
+ if ($this->wm_use_drop_shadow)
+ {
+ $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text));
+ $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text));
+ }
break;
- case "C":
- if ($this->wm_use_drop_shadow)
- $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2);
- $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2);
+ case 'C':
+ if ($this->wm_use_drop_shadow)
+ {
+ $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2);
+ $x_axis += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2);
+ }
break;
}
- // Add the text to the source image
- if ($this->wm_use_truetype)
+ if ($this->wm_use_drop_shadow)
{
- if ($this->wm_use_drop_shadow)
+ /* Set RGB values for text and shadow
+ *
+ * First character is #, so we don't really need it.
+ * Get the rest of the string and split it into 2-length
+ * hex values:
+ */
+ $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2);
+ $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2]));
+ $drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2);
+ $drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[2]), hexdec($drp_color[3]));
+
+ // Add the text to the source image
+ if ($this->wm_use_truetype)
+ {
imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text);
imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text);
- }
- else
- {
- if ($this->wm_use_drop_shadow)
+ }
+ else
+ {
imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color);
imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color);
+ }
}
// Output the final image
@@ -1155,7 +1129,6 @@ class CI_Image_lib {
* This simply creates an image resource handle
* based on the type of image being processed
*
- * @access public
* @param string
* @return resource
*/
@@ -1212,7 +1185,6 @@ class CI_Image_lib {
* Takes an image resource as input and writes the file
* to the specified destination
*
- * @access public
* @param resource
* @return bool
*/
@@ -1273,7 +1245,6 @@ class CI_Image_lib {
/**
* Dynamically outputs an image
*
- * @access public
* @param resource
* @return void
*/
@@ -1309,7 +1280,6 @@ class CI_Image_lib {
* This function lets us re-proportion the width/height
* if users choose to maintain the aspect ratio when resizing.
*
- * @access public
* @return void
*/
public function image_reproportion()
@@ -1350,7 +1320,6 @@ class CI_Image_lib {
*
* A helper function that gets info about the file
*
- * @access public
* @param string
* @return mixed
*/
@@ -1369,26 +1338,24 @@ class CI_Image_lib {
}
$vals = getimagesize($path);
-
$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
-
- $mime = (isset($types[$vals['2']])) ? 'image/'.$types[$vals['2']] : 'image/jpg';
+ $mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg';
if ($return == TRUE)
{
- $v['width'] = $vals['0'];
- $v['height'] = $vals['1'];
- $v['image_type'] = $vals['2'];
- $v['size_str'] = $vals['3'];
- $v['mime_type'] = $mime;
-
- return $v;
+ return array(
+ 'width' => $vals[0],
+ 'height' => $vals[1],
+ 'image_type' => $vals[2],
+ 'size_str' => $vals[3],
+ 'mime_type' => $mime
+ );
}
- $this->orig_width = $vals['0'];
- $this->orig_height = $vals['1'];
- $this->image_type = $vals['2'];
- $this->size_str = $vals['3'];
+ $this->orig_width = $vals[0];
+ $this->orig_height = $vals[1];
+ $this->image_type = $vals[2];
+ $this->size_str = $vals[3];
$this->mime_type = $mime;
return TRUE;
@@ -1410,7 +1377,6 @@ class CI_Image_lib {
* 'new_height' => ''
* );
*
- * @access public
* @param array
* @return array
*/
@@ -1458,7 +1424,6 @@ class CI_Image_lib {
* $array['ext'] = '.jpg';
* $array['name'] = 'my.cool';
*
- * @access public
* @param array
* @return array
*/
@@ -1475,17 +1440,16 @@ class CI_Image_lib {
/**
* Is GD Installed?
*
- * @access public
* @return bool
*/
public function gd_loaded()
{
if ( ! extension_loaded('gd'))
{
- if ( ! dl('gd.so'))
- {
- return FALSE;
- }
+ /* As it is stated in the PHP manual, dl() is not always available
+ * and even if so - it could generate an E_WARNING message on failure
+ */
+ return (function_exists('dl') AND @dl('gd.so'));
}
return TRUE;
@@ -1496,7 +1460,6 @@ class CI_Image_lib {
/**
* Get GD version
*
- * @access public
* @return mixed
*/
public function gd_version()
@@ -1517,7 +1480,6 @@ class CI_Image_lib {
/**
* Set error message
*
- * @access public
* @param string
* @return void
*/
@@ -1549,7 +1511,6 @@ class CI_Image_lib {
/**
* Show error messages
*
- * @access public
* @param string
* @return string
*/
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index f872d672f..33df6007a 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 7f3a307f3..944173fdd 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index eb5161d76..d07097223 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 3.0
@@ -322,7 +322,7 @@ class CI_Migration {
*/
protected function _get_version()
{
- $row = $this->db->get($this->_migration_table)->row();
+ $row = $this->db->select('version')->get($this->_migration_table)->row();
return $row ? $row->version : 0;
}
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 63b750bdb..35ac541e8 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -142,6 +142,12 @@ class CI_Pagination {
// Determine the current page number.
$CI =& get_instance();
+ // See if we are using a prefix or suffix on links
+ if ($this->prefix != '' OR $this->suffix != '')
+ {
+ $this->cur_page = (int) str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment));
+ }
+
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
if ($CI->input->get($this->query_string_segment) != $base_page)
@@ -149,7 +155,7 @@ class CI_Pagination {
$this->cur_page = (int) $CI->input->get($this->query_string_segment);
}
}
- elseif ($CI->uri->segment($this->uri_segment) != $base_page)
+ elseif ( ! $this->cur_page AND $CI->uri->segment($this->uri_segment) != $base_page)
{
$this->cur_page = (int) $CI->uri->segment($this->uri_segment);
}
@@ -160,7 +166,7 @@ class CI_Pagination {
$this->cur_page = $base_page;
}
- $this->num_links = (int)$this->num_links;
+ $this->num_links = (int) $this->num_links;
if ($this->num_links < 1)
{
@@ -222,13 +228,13 @@ class CI_Pagination {
{
$i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page;
- if (($i == 0 OR ($this->use_page_numbers && $i == 1)) AND $this->first_url != '')
+ if ($i == $base_page AND $this->first_url != '')
{
$output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
else
{
- $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix;
+ $i = ($i == $base_page) ? '' : $this->prefix.$i.$this->suffix;
$output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 39aa61e45..321248277 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 9cbd69bb2..89c616543 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 137b037b8..04103a4d9 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 1851bf3bc..fb154e50f 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.3.1
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index b5e68507f..79a009133 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index ac9486a6b..46c73ef8b 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index fd3880d29..38d767c69 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.3.1
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 826bcceb8..0c63886e7 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index c31ff2646..cd644c00d 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 7b1e3fa6e..730a0fc49 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -1,13 +1,13 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -44,38 +44,38 @@ if ( ! function_exists('xml_parser_create'))
*/
class CI_Xmlrpc {
- var $debug = FALSE; // Debugging on or off
- var $xmlrpcI4 = 'i4';
- var $xmlrpcInt = 'int';
- var $xmlrpcBoolean = 'boolean';
- var $xmlrpcDouble = 'double';
- var $xmlrpcString = 'string';
- var $xmlrpcDateTime = 'dateTime.iso8601';
- var $xmlrpcBase64 = 'base64';
- var $xmlrpcArray = 'array';
- var $xmlrpcStruct = 'struct';
-
- var $xmlrpcTypes = array();
- var $valid_parents = array();
- var $xmlrpcerr = array(); // Response numbers
- var $xmlrpcstr = array(); // Response strings
-
- var $xmlrpc_defencoding = 'UTF-8';
- var $xmlrpcName = 'XML-RPC for CodeIgniter';
- var $xmlrpcVersion = '1.1';
- var $xmlrpcerruser = 800; // Start of user errors
- var $xmlrpcerrxml = 100; // Start of XML Parse errors
- var $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp
-
- var $client;
- var $method;
- var $data;
- var $message = '';
- var $error = ''; // Error string for request
- var $result;
- var $response = array(); // Response from remote server
-
- var $xss_clean = TRUE;
+ public $debug = FALSE; // Debugging on or off
+ public $xmlrpcI4 = 'i4';
+ public $xmlrpcInt = 'int';
+ public $xmlrpcBoolean = 'boolean';
+ public $xmlrpcDouble = 'double';
+ public $xmlrpcString = 'string';
+ public $xmlrpcDateTime = 'dateTime.iso8601';
+ public $xmlrpcBase64 = 'base64';
+ public $xmlrpcArray = 'array';
+ public $xmlrpcStruct = 'struct';
+
+ public $xmlrpcTypes = array();
+ public $valid_parents = array();
+ public $xmlrpcerr = array(); // Response numbers
+ public $xmlrpcstr = array(); // Response strings
+
+ public $xmlrpc_defencoding = 'UTF-8';
+ public $xmlrpcName = 'XML-RPC for CodeIgniter';
+ public $xmlrpcVersion = '1.1';
+ public $xmlrpcerruser = 800; // Start of user errors
+ public $xmlrpcerrxml = 100; // Start of XML Parse errors
+ public $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp
+
+ public $client;
+ public $method;
+ public $data;
+ public $message = '';
+ public $error = ''; // Error string for request
+ public $result;
+ public $response = array(); // Response from remote server
+
+ public $xss_clean = TRUE;
//-------------------------------------
// VALUES THAT MULTIPLE CLASSES NEED
@@ -83,7 +83,7 @@ class CI_Xmlrpc {
public function __construct($config = array())
{
- $this->xmlrpcName = $this->xmlrpcName;
+ $this->xmlrpcName = $this->xmlrpcName;
$this->xmlrpc_backslash = chr(92).chr(92);
// Types for info sent back and forth
@@ -101,23 +101,23 @@ class CI_Xmlrpc {
// Array of Valid Parents for Various XML-RPC elements
$this->valid_parents = array('BOOLEAN' => array('VALUE'),
- 'I4' => array('VALUE'),
- 'INT' => array('VALUE'),
- 'STRING' => array('VALUE'),
- 'DOUBLE' => array('VALUE'),
- 'DATETIME.ISO8601' => array('VALUE'),
- 'BASE64' => array('VALUE'),
- 'ARRAY' => array('VALUE'),
- 'STRUCT' => array('VALUE'),
- 'PARAM' => array('PARAMS'),
- 'METHODNAME' => array('METHODCALL'),
- 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
- 'MEMBER' => array('STRUCT'),
- 'NAME' => array('MEMBER'),
- 'DATA' => array('ARRAY'),
- 'FAULT' => array('METHODRESPONSE'),
- 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
- );
+ 'I4' => array('VALUE'),
+ 'INT' => array('VALUE'),
+ 'STRING' => array('VALUE'),
+ 'DOUBLE' => array('VALUE'),
+ 'DATETIME.ISO8601' => array('VALUE'),
+ 'BASE64' => array('VALUE'),
+ 'ARRAY' => array('VALUE'),
+ 'STRUCT' => array('VALUE'),
+ 'PARAM' => array('PARAMS'),
+ 'METHODNAME' => array('METHODCALL'),
+ 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+ 'MEMBER' => array('STRUCT'),
+ 'NAME' => array('MEMBER'),
+ 'DATA' => array('ARRAY'),
+ 'FAULT' => array('METHODRESPONSE'),
+ 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
+ );
// XML-RPC Responses
@@ -128,7 +128,7 @@ class CI_Xmlrpc {
$this->xmlrpcerr['incorrect_params'] = '3';
$this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method';
$this->xmlrpcerr['introspect_unknown'] = '4';
- $this->xmlrpcstr['introspect_unknown'] = "Cannot inspect signature for request: method unknown";
+ $this->xmlrpcstr['introspect_unknown'] = 'Cannot inspect signature for request: method unknown';
$this->xmlrpcerr['http_error'] = '5';
$this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server.";
$this->xmlrpcerr['no_data'] = '6';
@@ -144,7 +144,7 @@ class CI_Xmlrpc {
// Initialize Prefs
//-------------------------------------
- function initialize($config = array())
+ public function initialize($config = array())
{
if (count($config) > 0)
{
@@ -163,9 +163,9 @@ class CI_Xmlrpc {
// Take URL and parse it
//-------------------------------------
- function server($url, $port=80)
+ public function server($url, $port=80)
{
- if (substr($url, 0, 4) != "http")
+ if (strpos($url, 'http') !== 0)
{
$url = "http://".$url;
}
@@ -187,7 +187,7 @@ class CI_Xmlrpc {
// Set Timeout
//-------------------------------------
- function timeout($seconds=5)
+ public function timeout($seconds = 5)
{
if ( ! is_null($this->client) && is_int($seconds))
{
@@ -200,7 +200,7 @@ class CI_Xmlrpc {
// Set Methods
//-------------------------------------
- function method($function)
+ public function method($function)
{
$this->method = $function;
}
@@ -210,7 +210,7 @@ class CI_Xmlrpc {
// Take Array of Data and Create Objects
//-------------------------------------
- function request($incoming)
+ public function request($incoming)
{
if ( ! is_array($incoming))
{
@@ -231,42 +231,34 @@ class CI_Xmlrpc {
// Set Debug
//-------------------------------------
- function set_debug($flag = TRUE)
+ public function set_debug($flag = TRUE)
{
- $this->debug = ($flag == TRUE) ? TRUE : FALSE;
+ $this->debug = ($flag == TRUE);
}
//-------------------------------------
// Values Parsing
//-------------------------------------
- function values_parsing($value, $return = FALSE)
+ public function values_parsing($value, $return = FALSE)
{
if (is_array($value) && array_key_exists(0, $value))
{
- if ( ! isset($value['1']) OR ( ! isset($this->xmlrpcTypes[$value['1']])))
+ if ( ! isset($value[1]) OR ( ! isset($this->xmlrpcTypes[$value[1]])))
{
- if (is_array($value[0]))
- {
- $temp = new XML_RPC_Values($value['0'], 'array');
- }
- else
- {
- $temp = new XML_RPC_Values($value['0'], 'string');
- }
+ $temp = new XML_RPC_Values($value[0], (is_array($value[0]) ? 'array' : 'string'));
}
- elseif (is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array'))
+ else
{
- while (list($k) = each($value['0']))
+ if (is_array($value[0]) && ($value[1] == 'struct' OR $value[1] == 'array'))
{
- $value['0'][$k] = $this->values_parsing($value['0'][$k], TRUE);
+ while (list($k) = each($value[0]))
+ {
+ $value[0][$k] = $this->values_parsing($value[0][$k], TRUE);
+ }
}
- $temp = new XML_RPC_Values($value['0'], $value['1']);
- }
- else
- {
- $temp = new XML_RPC_Values($value['0'], $value['1']);
+ $temp = new XML_RPC_Values($value[0], $value[1]);
}
}
else
@@ -283,24 +275,18 @@ class CI_Xmlrpc {
// Sends XML-RPC Request
//-------------------------------------
- function send_request()
+ public function send_request()
{
$this->message = new XML_RPC_Message($this->method,$this->data);
$this->message->debug = $this->debug;
- if ( ! $this->result = $this->client->send($this->message))
- {
- $this->error = $this->result->errstr;
- return FALSE;
- }
- elseif ( ! is_object($this->result->val))
+ if ( ! $this->result = $this->client->send($this->message) OR ! is_object($this->result->val))
{
$this->error = $this->result->errstr;
return FALSE;
}
$this->response = $this->result->decode();
-
return TRUE;
}
// END
@@ -309,7 +295,7 @@ class CI_Xmlrpc {
// Returns Error
//-------------------------------------
- function display_error()
+ public function display_error()
{
return $this->error;
}
@@ -319,7 +305,7 @@ class CI_Xmlrpc {
// Returns Remote Server Response
//-------------------------------------
- function display_response()
+ public function display_response()
{
return $this->response;
}
@@ -329,9 +315,9 @@ class CI_Xmlrpc {
// Sends an Error Message for Server Request
//-------------------------------------
- function send_error_message($number, $message)
+ public function send_error_message($number, $message)
{
- return new XML_RPC_Response('0',$number, $message);
+ return new XML_RPC_Response(0, $number, $message);
}
// END
@@ -340,14 +326,11 @@ class CI_Xmlrpc {
// Send Response for Server Request
//-------------------------------------
- function send_response($response)
+ public function send_response($response)
{
// $response should be array of values, which will be parsed
// based on their data and type into a valid group of XML-RPC values
-
- $response = $this->values_parsing($response);
-
- return new XML_RPC_Response($response);
+ return new XML_RPC_Response($this->values_parsing($response));
}
// END
@@ -364,13 +347,13 @@ class CI_Xmlrpc {
*/
class XML_RPC_Client extends CI_Xmlrpc
{
- var $path = '';
- var $server = '';
- var $port = 80;
- var $errno = '';
- var $errstring = '';
- var $timeout = 5;
- var $no_multicall = FALSE;
+ public $path = '';
+ public $server = '';
+ public $port = 80;
+ public $errno = '';
+ public $errstring = '';
+ public $timeout = 5;
+ public $no_multicall = FALSE;
public function __construct($path, $server, $port=80)
{
@@ -381,7 +364,7 @@ class XML_RPC_Client extends CI_Xmlrpc
$this->path = $path;
}
- function send($msg)
+ public function send($msg)
{
if (is_array($msg))
{
@@ -393,7 +376,7 @@ class XML_RPC_Client extends CI_Xmlrpc
return $this->sendPayload($msg);
}
- function sendPayload($msg)
+ public function sendPayload($msg)
{
$fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout);
@@ -411,12 +394,12 @@ class XML_RPC_Client extends CI_Xmlrpc
}
$r = "\r\n";
- $op = "POST {$this->path} HTTP/1.0$r";
- $op .= "Host: {$this->server}$r";
- $op .= "Content-Type: text/xml$r";
- $op .= "User-Agent: {$this->xmlrpcName}$r";
- $op .= "Content-Length: ".strlen($msg->payload). "$r$r";
- $op .= $msg->payload;
+ $op = "POST {$this->path} HTTP/1.0$r"
+ . "Host: {$this->server}$r"
+ . "Content-Type: text/xml$r"
+ . "User-Agent: {$this->xmlrpcName}$r"
+ . "Content-Length: ".strlen($msg->payload)."$r$r"
+ . $msg->payload;
if ( ! fputs($fp, $op, strlen($op)))
@@ -430,8 +413,8 @@ class XML_RPC_Client extends CI_Xmlrpc
return $resp;
}
-} // end class XML_RPC_Client
-
+}
+// end class XML_RPC_Client
/**
* XML-RPC Response class
@@ -442,11 +425,11 @@ class XML_RPC_Client extends CI_Xmlrpc
*/
class XML_RPC_Response
{
- var $val = 0;
- var $errno = 0;
- var $errstr = '';
- var $headers = array();
- var $xss_clean = TRUE;
+ public $val = 0;
+ public $errno = 0;
+ public $errstr = '';
+ public $headers = array();
+ public $xss_clean = TRUE;
public function __construct($val, $code = 0, $fstr = '')
{
@@ -454,7 +437,14 @@ class XML_RPC_Response
{
// error
$this->errno = $code;
- $this->errstr = htmlentities($fstr);
+ if ( ! is_php('5.4'))
+ {
+ $this->errstr = htmlspecialchars($fstr, ENT_NOQUOTES, 'UTF-8');
+ }
+ else
+ {
+ $this->errstr = htmlspecialchars($fstr, ENT_XML1 | ENT_NOQUOTES, 'UTF-8');
+ }
}
else if ( ! is_object($val))
{
@@ -468,27 +458,26 @@ class XML_RPC_Response
}
}
- function faultCode()
+ public function faultCode()
{
return $this->errno;
}
- function faultString()
+ public function faultString()
{
return $this->errstr;
}
- function value()
+ public function value()
{
return $this->val;
}
- function prepare_response()
+ public function prepare_response()
{
- $result = "<methodResponse>\n";
- if ($this->errno)
- {
- $result .= '<fault>
+ return "<methodResponse>\n"
+ . ($this->errno
+ ? '<fault>
<value>
<struct>
<member>
@@ -501,23 +490,16 @@ class XML_RPC_Response
</member>
</struct>
</value>
-</fault>';
- }
- else
- {
- $result .= "<params>\n<param>\n" .
- $this->val->serialize_class() .
- "</param>\n</params>";
- }
- $result .= "\n</methodResponse>";
- return $result;
+</fault>'
+ : "<params>\n<param>\n".$this->val->serialize_class()."</param>\n</params>")
+ . "\n</methodResponse>";
}
- function decode($array=FALSE)
+ public function decode($array = FALSE)
{
$CI =& get_instance();
-
- if ($array !== FALSE && is_array($array))
+
+ if (is_array($array))
{
while (list($key) = each($array))
{
@@ -556,7 +538,7 @@ class XML_RPC_Response
// XML-RPC Object to PHP Types
//-------------------------------------
- function xmlrpc_decoder($xmlrpc_val)
+ public function xmlrpc_decoder($xmlrpc_val)
{
$kind = $xmlrpc_val->kindOf();
@@ -567,12 +549,10 @@ class XML_RPC_Response
elseif ($kind == 'array')
{
reset($xmlrpc_val->me);
- list($a,$b) = each($xmlrpc_val->me);
- $size = count($b);
-
+ $b = current($xmlrpc_val->me);
$arr = array();
- for ($i = 0; $i < $size; $i++)
+ for ($i = 0, $size = count($b); $i < $size; $i++)
{
$arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]);
}
@@ -596,7 +576,7 @@ class XML_RPC_Response
// ISO-8601 time to server or UTC time
//-------------------------------------
- function iso8601_decode($time, $utc=0)
+ public function iso8601_decode($time, $utc = 0)
{
// return a timet in the localtime, or UTC
$t = 0;
@@ -608,9 +588,8 @@ class XML_RPC_Response
return $t;
}
-} // End Response Class
-
-
+}
+// End Response Class
/**
* XML-RPC Message class
@@ -621,10 +600,10 @@ class XML_RPC_Response
*/
class XML_RPC_Message extends CI_Xmlrpc
{
- var $payload;
- var $method_name;
- var $params = array();
- var $xh = array();
+ public $payload;
+ public $method_name;
+ public $params = array();
+ public $xh = array();
public function __construct($method, $pars=0)
{
@@ -633,7 +612,7 @@ class XML_RPC_Message extends CI_Xmlrpc
$this->method_name = $method;
if (is_array($pars) && count($pars) > 0)
{
- for ($i=0; $i<count($pars); $i++)
+ for ($i = 0, $c = count($pars); $i < $c; $i++)
{
// $pars[$i] = XML_RPC_Values
$this->params[] = $pars[$i];
@@ -645,13 +624,13 @@ class XML_RPC_Message extends CI_Xmlrpc
// Create Payload to Send
//-------------------------------------
- function createPayload()
+ public function createPayload()
{
- $this->payload = "<?xml version=\"1.0\"?".">\r\n<methodCall>\r\n";
- $this->payload .= '<methodName>' . $this->method_name . "</methodName>\r\n";
- $this->payload .= "<params>\r\n";
+ $this->payload = "<?xml version=\"1.0\"?".">\r\n<methodCall>\r\n"
+ . '<methodName>'.$this->method_name."</methodName>\r\n"
+ . "<params>\r\n";
- for ($i=0; $i<count($this->params); $i++)
+ for ($i = 0, $c = count($this->params); $i < $c; $i++)
{
// $p = XML_RPC_Values
$p = $this->params[$i];
@@ -665,7 +644,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// Parse External XML-RPC Server's Response
//-------------------------------------
- function parseResponse($fp)
+ public function parseResponse($fp)
{
$data = '';
@@ -680,16 +659,14 @@ class XML_RPC_Message extends CI_Xmlrpc
if ($this->debug === TRUE)
{
- echo "<pre>";
- echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n";
- echo "</pre>";
+ echo "<pre>---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n</pre>";
}
//-------------------------------------
// Check for data
//-------------------------------------
- if ($data == "")
+ if ($data === '')
{
error_log($this->xmlrpcstr['no_data']);
$r = new XML_RPC_Response(0, $this->xmlrpcerr['no_data'], $this->xmlrpcstr['no_data']);
@@ -701,7 +678,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// Check for HTTP 200 Response
//-------------------------------------
- if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
+ if (strncmp($data, 'HTTP', 4) === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
{
$errstr= substr($data, 0, strpos($data, "\n")-1);
$r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')');
@@ -714,13 +691,14 @@ class XML_RPC_Message extends CI_Xmlrpc
$parser = xml_parser_create($this->xmlrpc_defencoding);
- $this->xh[$parser] = array();
- $this->xh[$parser]['isf'] = 0;
- $this->xh[$parser]['ac'] = '';
- $this->xh[$parser]['headers'] = array();
- $this->xh[$parser]['stack'] = array();
- $this->xh[$parser]['valuestack'] = array();
- $this->xh[$parser]['isf_reason'] = 0;
+ $this->xh[$parser] = array(
+ 'isf' => 0,
+ 'ac' => '',
+ 'headers' => array(),
+ 'stack' => array(),
+ 'valuestack' => array(),
+ 'isf_reason' => 0
+ );
xml_set_object($parser, $this);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
@@ -769,9 +747,7 @@ class XML_RPC_Message extends CI_Xmlrpc
{
if ($this->debug === TRUE)
{
- echo "---Invalid Return---\n";
- echo $this->xh[$parser]['isf_reason'];
- echo "---Invalid Return---\n\n";
+ echo "---Invalid Return---\n".$this->xh[$parser]['isf_reason']."---Invalid Return---\n\n";
}
$r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']);
@@ -801,9 +777,7 @@ class XML_RPC_Message extends CI_Xmlrpc
echo "---END HEADERS---\n\n";
}
- echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n";
-
- echo "---PARSED---\n" ;
+ echo "---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n---PARSED---\n";
var_dump($this->xh[$parser]['value']);
echo "\n---END PARSED---</pre>";
}
@@ -813,7 +787,6 @@ class XML_RPC_Message extends CI_Xmlrpc
//-------------------------------------
$v = $this->xh[$parser]['value'];
-
if ($this->xh[$parser]['isf'])
{
$errno_v = $v->me['struct']['faultCode'];
@@ -855,7 +828,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// Start Element Handler
//-------------------------------------
- function open_tag($the_parser, $name, $attrs)
+ public function open_tag($the_parser, $name, $attrs)
{
// If invalid nesting, then return
if ($this->xh[$the_parser]['isf'] > 1) return;
@@ -957,7 +930,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// End Element Handler
//-------------------------------------
- function closing_tag($the_parser, $name)
+ public function closing_tag($the_parser, $name)
{
if ($this->xh[$the_parser]['isf'] > 1) return;
@@ -1101,7 +1074,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// Parses Character Data
//-------------------------------------
- function character_data($the_parser, $data)
+ public function character_data($the_parser, $data)
{
if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already
@@ -1123,13 +1096,16 @@ class XML_RPC_Message extends CI_Xmlrpc
}
- function addParam($par) { $this->params[]=$par; }
+ public function addParam($par)
+ {
+ $this->params[] = $par;
+ }
- function output_parameters($array=FALSE)
+ public function output_parameters($array = FALSE)
{
$CI =& get_instance();
-
- if ($array !== FALSE && is_array($array))
+
+ if (is_array($array))
{
while (list($key) = each($array))
{
@@ -1151,7 +1127,7 @@ class XML_RPC_Message extends CI_Xmlrpc
{
$parameters = array();
- for ($i = 0; $i < count($this->params); $i++)
+ for ($i = 0, $c = count($this->params); $i < $c; $i++)
{
$a_param = $this->decode_message($this->params[$i]);
@@ -1170,7 +1146,7 @@ class XML_RPC_Message extends CI_Xmlrpc
}
- function decode_message($param)
+ public function decode_message($param)
{
$kind = $param->kindOf();
@@ -1181,11 +1157,10 @@ class XML_RPC_Message extends CI_Xmlrpc
elseif ($kind == 'array')
{
reset($param->me);
- list($a,$b) = each($param->me);
-
+ $b = current($param->me);
$arr = array();
- for($i = 0; $i < count($b); $i++)
+ for($i = 0, $c = count($b); $i < $c; $i++)
{
$arr[] = $this->decode_message($param->me['array'][$i]);
}
@@ -1195,7 +1170,6 @@ class XML_RPC_Message extends CI_Xmlrpc
elseif ($kind == 'struct')
{
reset($param->me['struct']);
-
$arr = array();
while (list($key,$value) = each($param->me['struct']))
@@ -1207,9 +1181,8 @@ class XML_RPC_Message extends CI_Xmlrpc
}
}
-} // End XML_RPC_Messages class
-
-
+}
+// End XML_RPC_Messages class
/**
* XML-RPC Values class
@@ -1220,10 +1193,10 @@ class XML_RPC_Message extends CI_Xmlrpc
*/
class XML_RPC_Values extends CI_Xmlrpc
{
- var $me = array();
- var $mytype = 0;
+ public $me = array();
+ public $mytype = 0;
- public function __construct($val=-1, $type='')
+ public function __construct($val = -1, $type = '')
{
parent::__construct();
@@ -1246,7 +1219,7 @@ class XML_RPC_Values extends CI_Xmlrpc
}
}
- function addScalar($val, $type='string')
+ public function addScalar($val, $type = 'string')
{
$typeof = $this->xmlrpcTypes[$type];
@@ -1264,14 +1237,7 @@ class XML_RPC_Values extends CI_Xmlrpc
if ($type == $this->xmlrpcBoolean)
{
- if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false')))
- {
- $val = 1;
- }
- else
- {
- $val=0;
- }
+ $val = (strcasecmp($val,'true') === 0 OR $val == 1 OR ($val == true && strcasecmp($val, 'false'))) ? 1 : 0;
}
if ($this->mytype == 2)
@@ -1290,7 +1256,7 @@ class XML_RPC_Values extends CI_Xmlrpc
return 1;
}
- function addArray($vals)
+ public function addArray($vals)
{
if ($this->mytype != 0)
{
@@ -1303,7 +1269,7 @@ class XML_RPC_Values extends CI_Xmlrpc
return 1;
}
- function addStruct($vals)
+ public function addStruct($vals)
{
if ($this->mytype != 0)
{
@@ -1315,7 +1281,7 @@ class XML_RPC_Values extends CI_Xmlrpc
return 1;
}
- function kindOf()
+ public function kindOf()
{
switch($this->mytype)
{
@@ -1333,7 +1299,7 @@ class XML_RPC_Values extends CI_Xmlrpc
}
}
- function serializedata($typ, $val)
+ public function serializedata($typ, $val)
{
$rs = '';
@@ -1345,20 +1311,18 @@ class XML_RPC_Values extends CI_Xmlrpc
reset($val);
while (list($key2, $val2) = each($val))
{
- $rs .= "<member>\n<name>{$key2}</name>\n";
- $rs .= $this->serializeval($val2);
- $rs .= "</member>\n";
+ $rs .= "<member>\n<name>{$key2}</name>\n".$this->serializeval($val2)."</member>\n";
}
$rs .= '</struct>';
break;
case 2:
// array
$rs .= "<array>\n<data>\n";
- for($i=0; $i < count($val); $i++)
+ for($i = 0, $c = count($val); $i < $c; $i++)
{
$rs .= $this->serializeval($val[$i]);
}
- $rs.="</data>\n</array>\n";
+ $rs .= "</data>\n</array>\n";
break;
case 1:
// others
@@ -1383,26 +1347,24 @@ class XML_RPC_Values extends CI_Xmlrpc
return $rs;
}
- function serialize_class()
+ public function serialize_class()
{
return $this->serializeval($this);
}
- function serializeval($o)
+ public function serializeval($o)
{
$ar = $o->me;
reset($ar);
list($typ, $val) = each($ar);
- $rs = "<value>\n".$this->serializedata($typ, $val)."</value>\n";
- return $rs;
+ return "<value>\n".$this->serializedata($typ, $val)."</value>\n";
}
- function scalarval()
+ public function scalarval()
{
reset($this->me);
- list($a,$b) = each($this->me);
- return $b;
+ return current($this->me);
}
@@ -1412,24 +1374,13 @@ class XML_RPC_Values extends CI_Xmlrpc
// Useful for sending time in XML-RPC
- function iso8601_encode($time, $utc=0)
+ public function iso8601_encode($time, $utc = 0)
{
- if ($utc == 1)
- {
- $t = strftime("%Y%m%dT%H:%i:%s", $time);
- }
- else
- {
- if (function_exists('gmstrftime'))
- $t = gmstrftime("%Y%m%dT%H:%i:%s", $time);
- else
- $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z'));
- }
- return $t;
+ return ($utc) ? strftime('%Y%m%dT%H:%i:%s', $time) : gmstrftime('%Y%m%dT%H:%i:%s', $time);
}
}
// END XML_RPC_Values Class
/* End of file Xmlrpc.php */
-/* Location: ./system/libraries/Xmlrpc.php */ \ No newline at end of file
+/* Location: ./system/libraries/Xmlrpc.php */
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 893e51873..355d43f29 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 52f1bc3d0..50e84920e 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index 888e89b1b..03574c66e 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0