Version 4.0.13.1
This commit is contained in:
1 parent
f9e857d255
commit
c6a86f0d9b
7517 files changed
+597400
-668041
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Conversion module
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Tools
|
||||
* @since 4 Sept 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPSUtf8\Text\Module;
|
||||
|
||||
/**
|
||||
* Native MB Conversion class
|
||||
*/
|
||||
class Recode extends \IPSUtf8\Text\Charset
|
||||
{
|
||||
/**
|
||||
* Converts a text string from its current charset to a destination charset using recode_string
|
||||
*
|
||||
* @param string Text string
|
||||
* @param string Text string char set (original)
|
||||
* @param string Desired character set (destination)
|
||||
* @return @e string
|
||||
*/
|
||||
public function convert( $string, $from, $to='UTF-8' )
|
||||
{
|
||||
if ( static::needsConverting( $string, $from, $to ) === false )
|
||||
{
|
||||
return $string;
|
||||
}
|
||||
|
||||
if ( function_exists( 'recode_string' ) )
|
||||
{
|
||||
$text = recode_string( $from . '..' . $to, $string );
|
||||
}
|
||||
else
|
||||
{
|
||||
static::$errors[] = "NO_RECODE_FUNCTION";
|
||||
}
|
||||
|
||||
return $text ? $text : $string;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user