Upgrade to KH 3.1.3.1

This commit is contained in:
Deon George
2011-05-13 16:00:25 +10:00
parent 8013aadc4c
commit 6d256839fc
675 changed files with 22771 additions and 24111 deletions

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -42,9 +42,9 @@ function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_R
$repeat_right = ceil($pad_length_right / $pad_str_length);
$pad_left = UTF8::substr(str_repeat($pad_str, $repeat_left), 0, $pad_length_left);
$pad_right = UTF8::substr(str_repeat($pad_str, $repeat_right), 0, $pad_length_left);
$pad_right = UTF8::substr(str_repeat($pad_str, $repeat_right), 0, $pad_length_right);
return $pad_left.$str.$pad_right;
}
trigger_error('UTF8::str_pad: Unknown padding type (' . $pad_type . ')', E_USER_ERROR);
trigger_error('UTF8::str_pad: Unknown padding type ('.$pad_type.')', E_USER_ERROR);
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -23,5 +23,5 @@ function _strpos($str, $search, $offset = 0)
$str = UTF8::substr($str, $offset);
$pos = UTF8::strpos($str, $search);
return ($pos === FALSE) ? FALSE : $pos + $offset;
return ($pos === FALSE) ? FALSE : ($pos + $offset);
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -23,5 +23,5 @@ function _strrpos($str, $search, $offset = 0)
$str = UTF8::substr($str, $offset);
$pos = UTF8::strrpos($str, $search);
return ($pos === FALSE) ? FALSE : $pos + $offset;
return ($pos === FALSE) ? FALSE : ($pos + $offset);
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -13,11 +13,11 @@ function _strtolower($str)
if (UTF8::is_ascii($str))
return strtolower($str);
static $UTF8_UPPER_TO_LOWER = NULL;
static $utf8_upper_to_lower = NULL;
if ($UTF8_UPPER_TO_LOWER === NULL)
if ($utf8_upper_to_lower === NULL)
{
$UTF8_UPPER_TO_LOWER = array(
$utf8_upper_to_lower = array(
0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062,
0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101,
0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3,
@@ -71,9 +71,9 @@ function _strtolower($str)
for ($i = 0, $c = count($uni); $i < $c; $i++)
{
if (isset($UTF8_UPPER_TO_LOWER[$uni[$i]]))
if (isset($utf8_upper_to_lower[$uni[$i]]))
{
$uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]];
$uni[$i] = $utf8_upper_to_lower[$uni[$i]];
}
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -13,11 +13,11 @@ function _strtoupper($str)
if (UTF8::is_ascii($str))
return strtoupper($str);
static $UTF8_LOWER_TO_UPPER = NULL;
static $utf8_lower_to_upper = NULL;
if ($UTF8_LOWER_TO_UPPER === NULL)
if ($utf8_lower_to_upper === NULL)
{
$UTF8_LOWER_TO_UPPER = array(
$utf8_lower_to_upper = array(
0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042,
0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100,
0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393,
@@ -71,9 +71,9 @@ function _strtoupper($str)
for ($i = 0, $c = count($uni); $i < $c; $i++)
{
if (isset($UTF8_LOWER_TO_UPPER[$uni[$i]]))
if (isset($utf8_lower_to_upper[$uni[$i]]))
{
$uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];
$uni[$i] = $utf8_lower_to_upper[$uni[$i]];
}
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -36,8 +36,8 @@ function _substr($str, $offset, $length = NULL)
// PCRE repeating quantifiers must be less than 65536, so repeat when necessary
$x = (int) ($offset / 65535);
$y = (int) ($offset % 65535);
$regex .= ($x == 0) ? '' : '(?:.{65535}){'.$x.'}';
$regex .= ($y == 0) ? '' : '.{'.$y.'}';
$regex .= ($x == 0) ? '' : ('(?:.{65535}){'.$x.'}');
$regex .= ($y == 0) ? '' : ('.{'.$y.'}');
}
// Create a length expression
@@ -54,7 +54,7 @@ function _substr($str, $offset, $length = NULL)
$x = (int) ($length / 65535);
$y = (int) ($length % 65535);
$regex .= '(';
$regex .= ($x == 0) ? '' : '(?:.{65535}){'.$x.'}';
$regex .= ($x == 0) ? '' : ('(?:.{65535}){'.$x.'}');
$regex .= '.{'.$y.'})';
}
// Find length from the right (negative length)
@@ -63,7 +63,7 @@ function _substr($str, $offset, $length = NULL)
$x = (int) (-$length / 65535);
$y = (int) (-$length % 65535);
$regex .= '(.*)';
$regex .= ($x == 0) ? '' : '(?:.{65535}){'.$x.'}';
$regex .= ($x == 0) ? '' : ('(?:.{65535}){'.$x.'}');
$regex .= '.{'.$y.'}';
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,15 +4,18 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _to_unicode($str)
{
$mState = 0; // cached expected number of octets after the current octet until the beginning of the next UTF8 character sequence
$mUcs4 = 0; // cached Unicode character
$mBytes = 1; // cached expected number of octets in the current sequence
// Cached expected number of octets after the current octet until the beginning of the next UTF8 character sequence
$m_state = 0;
// Cached Unicode character
$m_ucs4 = 0;
// Cached expected number of octets in the current sequence
$m_bytes = 1;
$out = array();
@@ -22,61 +25,61 @@ function _to_unicode($str)
{
$in = ord($str[$i]);
if ($mState == 0)
if ($m_state == 0)
{
// When mState is zero we expect either a US-ASCII character or a
// multi-octet sequence.
// When m_state is zero we expect either a US-ASCII character or a multi-octet sequence.
if (0 == (0x80 & $in))
{
// US-ASCII, pass straight through.
$out[] = $in;
$mBytes = 1;
$m_bytes = 1;
}
elseif (0xC0 == (0xE0 & $in))
{
// First octet of 2 octet sequence
$mUcs4 = $in;
$mUcs4 = ($mUcs4 & 0x1F) << 6;
$mState = 1;
$mBytes = 2;
$m_ucs4 = $in;
$m_ucs4 = ($m_ucs4 & 0x1F) << 6;
$m_state = 1;
$m_bytes = 2;
}
elseif (0xE0 == (0xF0 & $in))
{
// First octet of 3 octet sequence
$mUcs4 = $in;
$mUcs4 = ($mUcs4 & 0x0F) << 12;
$mState = 2;
$mBytes = 3;
$m_ucs4 = $in;
$m_ucs4 = ($m_ucs4 & 0x0F) << 12;
$m_state = 2;
$m_bytes = 3;
}
elseif (0xF0 == (0xF8 & $in))
{
// First octet of 4 octet sequence
$mUcs4 = $in;
$mUcs4 = ($mUcs4 & 0x07) << 18;
$mState = 3;
$mBytes = 4;
$m_ucs4 = $in;
$m_ucs4 = ($m_ucs4 & 0x07) << 18;
$m_state = 3;
$m_bytes = 4;
}
elseif (0xF8 == (0xFC & $in))
{
// First octet of 5 octet sequence.
//
// This is illegal because the encoded codepoint must be either
// (a) not the shortest form or
// (b) outside the Unicode range of 0-0x10FFFF.
// Rather than trying to resynchronize, we will carry on until the end
// of the sequence and let the later error handling code catch it.
$mUcs4 = $in;
$mUcs4 = ($mUcs4 & 0x03) << 24;
$mState = 4;
$mBytes = 5;
/** First octet of 5 octet sequence.
*
* This is illegal because the encoded codepoint must be either
* (a) not the shortest form or
* (b) outside the Unicode range of 0-0x10FFFF.
* Rather than trying to resynchronize, we will carry on until the end
* of the sequence and let the later error handling code catch it.
**/
$m_ucs4 = $in;
$m_ucs4 = ($m_ucs4 & 0x03) << 24;
$m_state = 4;
$m_bytes = 5;
}
elseif (0xFC == (0xFE & $in))
{
// First octet of 6 octet sequence, see comments for 5 octet sequence.
$mUcs4 = $in;
$mUcs4 = ($mUcs4 & 1) << 30;
$mState = 5;
$mBytes = 6;
$m_ucs4 = $in;
$m_ucs4 = ($m_ucs4 & 1) << 30;
$m_state = 5;
$m_bytes = 6;
}
else
{
@@ -87,49 +90,49 @@ function _to_unicode($str)
}
else
{
// When mState is non-zero, we expect a continuation of the multi-octet sequence
// When m_state is non-zero, we expect a continuation of the multi-octet sequence
if (0x80 == (0xC0 & $in))
{
// Legal continuation
$shift = ($mState - 1) * 6;
$shift = ($m_state - 1) * 6;
$tmp = $in;
$tmp = ($tmp & 0x0000003F) << $shift;
$mUcs4 |= $tmp;
$m_ucs4 |= $tmp;
// End of the multi-octet sequence. mUcs4 now contains the final Unicode codepoint to be output
if (0 == --$mState)
if (0 == --$m_state)
{
// Check for illegal sequences and codepoints
// From Unicode 3.1, non-shortest form is illegal
if (((2 == $mBytes) AND ($mUcs4 < 0x0080)) OR
((3 == $mBytes) AND ($mUcs4 < 0x0800)) OR
((4 == $mBytes) AND ($mUcs4 < 0x10000)) OR
(4 < $mBytes) OR
if (((2 == $m_bytes) AND ($m_ucs4 < 0x0080)) OR
((3 == $m_bytes) AND ($m_ucs4 < 0x0800)) OR
((4 == $m_bytes) AND ($m_ucs4 < 0x10000)) OR
(4 < $m_bytes) OR
// From Unicode 3.2, surrogate characters are illegal
(($mUcs4 & 0xFFFFF800) == 0xD800) OR
(($m_ucs4 & 0xFFFFF800) == 0xD800) OR
// Codepoints outside the Unicode range are illegal
($mUcs4 > 0x10FFFF))
($m_ucs4 > 0x10FFFF))
{
trigger_error('UTF8::to_unicode: Illegal sequence or codepoint in UTF-8 at byte '.$i, E_USER_WARNING);
return FALSE;
}
if (0xFEFF != $mUcs4)
if (0xFEFF != $m_ucs4)
{
// BOM is legal but we don't want to output it
$out[] = $mUcs4;
$out[] = $m_ucs4;
}
// Initialize UTF-8 cache
$mState = 0;
$mUcs4 = 0;
$mBytes = 1;
$m_state = 0;
$m_ucs4 = 0;
$m_bytes = 1;
}
}
else
{
// ((0xC0 & (*in) != 0x80) AND (mState != 0))
// ((0xC0 & (*in) != 0x80) AND (m_state != 0))
// Incomplete multi-octet sequence
trigger_error('UTF8::to_unicode: Incomplete multi-octet sequence in UTF-8 at byte '.$i, E_USER_WARNING);
return FALSE;

View File

@@ -4,20 +4,20 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _transliterate_to_ascii($str, $case = 0)
{
static $UTF8_LOWER_ACCENTS = NULL;
static $UTF8_UPPER_ACCENTS = NULL;
static $utf8_lower_accents = NULL;
static $utf8_upper_accents = NULL;
if ($case <= 0)
{
if ($UTF8_LOWER_ACCENTS === NULL)
if ($utf8_lower_accents === NULL)
{
$UTF8_LOWER_ACCENTS = array(
$utf8_lower_accents = array(
'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',
'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',
'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o',
@@ -37,17 +37,17 @@ function _transliterate_to_ascii($str, $case = 0)
}
$str = str_replace(
array_keys($UTF8_LOWER_ACCENTS),
array_values($UTF8_LOWER_ACCENTS),
array_keys($utf8_lower_accents),
array_values($utf8_lower_accents),
$str
);
}
if ($case >= 0)
{
if ($UTF8_UPPER_ACCENTS === NULL)
if ($utf8_upper_accents === NULL)
{
$UTF8_UPPER_ACCENTS = array(
$utf8_upper_accents = array(
'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',
'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', 'Ĕ' => 'E',
'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O',
@@ -67,8 +67,8 @@ function _transliterate_to_ascii($str, $case = 0)
}
$str = str_replace(
array_keys($UTF8_UPPER_ACCENTS),
array_values($UTF8_UPPER_ACCENTS),
array_keys($utf8_upper_accents),
array_values($utf8_upper_accents),
$str
);
}

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -4,7 +4,7 @@
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/