Version 3.3.4
This commit is contained in:
1 parent
78706903a2
commit
fb6b5baabc
2206 files changed
+409828
-382984
No files matched your search
@@ -3,24 +3,25 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* IP.Board v3.3.4
|
||||
* Character set conversion library
|
||||
* Last Updated: $Date: 2011-09-07 14:34:13 -0400 (Wed, 07 Sep 2011) $
|
||||
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author Mikolaj Jedrzejak <mikolajj@op.pl>
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @copyright Copyright Mikolaj Jedrzejak (c) 2003-2004
|
||||
* @license This is NULLED!
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @link http://hatynka.in
|
||||
* @link http://www.invisionpower.com
|
||||
* @since Friday 2nd December 2005 10:18
|
||||
* @version $Revision: 9462 $
|
||||
* @version $Revision: 10914 $
|
||||
* @version 1.0 2004-07-27 00:37
|
||||
* @link http://www.unicode.org Unicode Homepage
|
||||
* @link http://www.mikkom.pl My Homepage
|
||||
* @link https://www.invisionpower.com/index.php?appcomponent=downloads Downloads
|
||||
*
|
||||
* This class is an adaptation of the ConvertCharset.class.php provided by Mikolaj Jedrzejak.
|
||||
* In order to use character set conversions, you must first download the conversion libraries from our website. See the 'Downloads' link.
|
||||
@@ -50,14 +51,14 @@ class classConvertCharset
|
||||
/**
|
||||
* Array of error messages associated with the conversion
|
||||
*
|
||||
* @var array Error messages
|
||||
* @var array
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* Should characters be turned into numeric entities
|
||||
*
|
||||
* @var boolean
|
||||
* @var boolean
|
||||
*/
|
||||
protected $entities = false;
|
||||
|
||||
@@ -65,14 +66,14 @@ class classConvertCharset
|
||||
* Conversion method to use.
|
||||
* Valid values include: mb, iconv, recode, internal
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
public $method = 'internal';
|
||||
|
||||
/**
|
||||
* Path for character sets
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
public $charsetPath = '';
|
||||
|
||||
@@ -82,7 +83,7 @@ class classConvertCharset
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return string Converted string
|
||||
* @return @e string
|
||||
*/
|
||||
public function convertEncoding( $string, $string_char_set, $destination_char_set='UTF-8' )
|
||||
{
|
||||
@@ -131,12 +132,12 @@ class classConvertCharset
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using mb_convert_encoding
|
||||
* Converts a text string from its current charset to a destination charset using mb_convert_encoding. If mb* functions are not available, logs an error to $this->errors.
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return string Converted string
|
||||
* @return @e string
|
||||
*/
|
||||
protected function convertUsing_mb( $string, $string_char_set, $destination_char_set='UTF-8' )
|
||||
{
|
||||
@@ -162,12 +163,12 @@ class classConvertCharset
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using iconv
|
||||
* Converts a text string from its current charset to a destination charset using iconv. If iconv is not available, logs an error to $this->errors.
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return string Converted string
|
||||
* @return @e string
|
||||
*/
|
||||
protected function convertUsing_iconv( $string, $string_char_set, $destination_char_set='UTF-8' )
|
||||
{
|
||||
@@ -184,12 +185,12 @@ class classConvertCharset
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using recode_string
|
||||
* Converts a text string from its current charset to a destination charset using recode_string. If recode is not available, logs an error to $this->errors.
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return string Converted string
|
||||
* @return @e string
|
||||
*/
|
||||
protected function convertUsing_recode( $string, $string_char_set, $destination_char_set='UTF-8' )
|
||||
{
|
||||
@@ -206,13 +207,13 @@ class classConvertCharset
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using internal conversion class.
|
||||
* Converts a text string from its current charset to a destination charset using internal conversion class.
|
||||
* The bulk of this function was written by Mikolaj Jedrzejak and used with permission via the License
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return string Converted string
|
||||
* @return @e string
|
||||
*/
|
||||
protected function convertUsing_internal( $string, $string_char_set, $destination_char_set='UTF-8' )
|
||||
{
|
||||
@@ -377,13 +378,12 @@ class classConvertCharset
|
||||
|
||||
return $text ? $text : $original;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert unicode characters to unicode HTML entities
|
||||
*
|
||||
* @param string $unicodeString Input Unicode string (1 char can take more than 1 byte)
|
||||
* @return string This is an input string also with unicode chars, but saved as entities
|
||||
* @return @e string
|
||||
* @see _hexToUtf()
|
||||
*/
|
||||
protected function _unicodeEntity( $unicodeString )
|
||||
@@ -454,12 +454,12 @@ class classConvertCharset
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert unicode characters to unicode HTML entities.
|
||||
* Convert unicode characters to unicode HTML entities.
|
||||
* It is very similar to _unicodeEntity function (link below). There is one difference
|
||||
* in returned format. This time it's a regular char(s), in most cases it will be one or two chars.
|
||||
*
|
||||
* @param string $utfCharInHex Hexadecimal value of a unicode char.
|
||||
* @return string Encoded hexadecimal value as a regular char.
|
||||
* @return @e string
|
||||
* @see _unicodeEntity()
|
||||
*/
|
||||
protected function _hexToUtf( $utfCharInHex )
|
||||
@@ -521,7 +521,7 @@ class classConvertCharset
|
||||
*
|
||||
* @param string $firstEncoding Name of first encoding and first encoding filename (thay have to be the same)
|
||||
* @param string $secondEncoding Name of second encoding and second encoding filename (thay have to be the same). Optional for building a joined table.
|
||||
* @return array Table necessary to change one encoding to another.
|
||||
* @return @e array
|
||||
*/
|
||||
protected function _makeConversionTable( $firstEncoding, $secondEncoding = "" )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user