Updated to KH 3.3 and improved

This commit is contained in:
Deon George
2013-04-13 16:17:56 +10:00
parent 6f50463ec7
commit 6f7913d363
1551 changed files with 96188 additions and 29813 deletions

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::from_unicode
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -36,8 +36,10 @@ function _from_unicode($arr)
elseif ($arr[$k] >= 0xD800 AND $arr[$k] <= 0xDFFF)
{
// Found a surrogate
trigger_error('UTF8::from_unicode: Illegal surrogate at index: '.$k.', value: '.$arr[$k], E_USER_WARNING);
return FALSE;
throw new UTF8_Exception("UTF8::from_unicode: Illegal surrogate at index: ':index', value: ':value'", array(
':index' => $k,
':value' => $arr[$k],
));
}
// 3 byte sequence
elseif ($arr[$k] <= 0xffff)
@@ -57,8 +59,10 @@ function _from_unicode($arr)
// Out of range
else
{
trigger_error('UTF8::from_unicode: Codepoint out of Unicode range at index: '.$k.', value: '.$arr[$k], E_USER_WARNING);
return FALSE;
throw new UTF8_Exception("UTF8::from_unicode: Codepoint out of Unicode range at index: ':index', value: ':value'", array(
':index' => $k,
':value' => $arr[$k],
));
}
}

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::ltrim
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::ord
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -17,8 +17,7 @@ function _ord($chr)
if ( ! isset($chr[1]))
{
trigger_error('Short sequence - at least 2 bytes expected, only 1 seen', E_USER_WARNING);
return FALSE;
throw new UTF8_Exception('Short sequence - at least 2 bytes expected, only 1 seen');
}
$ord1 = ord($chr[1]);
@@ -28,8 +27,7 @@ function _ord($chr)
if ( ! isset($chr[2]))
{
trigger_error('Short sequence - at least 3 bytes expected, only 2 seen', E_USER_WARNING);
return FALSE;
throw new UTF8_Exception('Short sequence - at least 3 bytes expected, only 2 seen');
}
$ord2 = ord($chr[2]);
@@ -39,8 +37,7 @@ function _ord($chr)
if ( ! isset($chr[3]))
{
trigger_error('Short sequence - at least 4 bytes expected, only 3 seen', E_USER_WARNING);
return FALSE;
throw new UTF8_Exception('Short sequence - at least 4 bytes expected, only 3 seen');
}
$ord3 = ord($chr[3]);
@@ -50,8 +47,7 @@ function _ord($chr)
if ( ! isset($chr[4]))
{
trigger_error('Short sequence - at least 5 bytes expected, only 4 seen', E_USER_WARNING);
return FALSE;
throw new UTF8_Exception('Short sequence - at least 5 bytes expected, only 4 seen');
}
$ord4 = ord($chr[4]);
@@ -61,8 +57,7 @@ function _ord($chr)
if ( ! isset($chr[5]))
{
trigger_error('Short sequence - at least 6 bytes expected, only 5 seen', E_USER_WARNING);
return FALSE;
throw new UTF8_Exception('Short sequence - at least 6 bytes expected, only 5 seen');
}
if ($ord0 >= 252 AND $ord0 <= 253)
@@ -70,7 +65,8 @@ function _ord($chr)
if ($ord0 >= 254 AND $ord0 <= 255)
{
trigger_error('Invalid UTF-8 with surrogate ordinal '.$ord0, E_USER_WARNING);
return FALSE;
throw new UTF8_Exception("Invalid UTF-8 with surrogate ordinal ':ordinal'", array(
':ordinal' => $ord0,
));
}
}

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::rtrim
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::str_ireplace
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::str_pad
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -46,5 +46,7 @@ function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_R
return $pad_left.$str.$pad_right;
}
trigger_error('UTF8::str_pad: Unknown padding type ('.$pad_type.')', E_USER_ERROR);
throw new UTF8_Exception("UTF8::str_pad: Unknown padding type (:pad_type)", array(
':pad_type' => $pad_type,
));
}

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::str_split
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strcasecmp
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strcspn
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::stristr
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strlen
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strpos
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strrev
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strrpos
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strspn
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strtolower
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::strtoupper
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::substr
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::substr_replace
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::to_unicode
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
@@ -134,8 +134,9 @@ function _to_unicode($str)
{
// ((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;
throw new UTF8_Exception("UTF8::to_unicode: Incomplete multi-octet sequence in UTF-8 at byte ':byte'", array(
':byte' => $i,
));
}
}
}

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::transliterate_to_ascii
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::trim
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::ucfirst
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/

View File

@@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* UTF8::ucwords
*
* @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2011 Kohana Team
* @copyright (c) 2007-2012 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/