~quam-plures-core/quam-plures/file_manager_limits

« back to all changes in this revision

Viewing changes to qp_inc/locales/_charset.funcs.php

  • Committer: EdB
  • Date: 2013-03-04 07:15:41 UTC
  • mfrom: (7655.1.3 qp5_antispam)
  • Revision ID: 1912webworks@gmail.com-20130304071541-x462crs4d531rh69
http://forums.quamplures.net/viewtopic.php?f=6&t=1887

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/**
3
 
 * This file implements functions for handling charsets.
4
 
 *
5
 
 * This file is part of Quam Plures - {@link http://quamplures.net/}
6
 
 * See also {@link https://launchpad.net/quam-plures}.
7
 
 *
8
 
 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
9
 
 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
10
 
 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://daniel.hahler.de/}.
11
 
 *
12
 
 * {@internal License choice
13
 
 * - If you have received this file as part of a package, please find the license.txt file in
14
 
 *   the same folder or the closest folder above for complete license terms.
15
 
 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
16
 
 *   then you must choose one of the following licenses before using the file:
17
 
 *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
18
 
 *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
19
 
 * }}
20
 
 *
21
 
 * {@internal Open Source relicensing agreement:
22
 
 * Daniel HAHLER grants Francois PLANQUE the right to license
23
 
 * Daniel HAHLER's contributions to this file and the b2evolution project
24
 
 * under any OSI approved OSS license (http://www.opensource.org/licenses/).
25
 
 * }}
26
 
 *
27
 
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
28
 
 * @author blueyed: Daniel HAHLER.
29
 
 * @author fplanque: Francois PLANQUE.
30
 
 *
31
 
 * @todo dh> Move this to some other directory?
32
 
 *
33
 
 * @package pond
 
3
 * This file implements functions for handling charsets
 
4
 *
 
5
 * @author {@link http://wonderwinds.com/ Ed Bennett}
 
6
 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
 
7
 * @author {@link http://fplanque.net/ Francois PLANQUE}
 
8
 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
 
9
 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
 
10
 * @package locales
34
11
 */
35
 
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
36
 
 
 
12
if(!defined('QP_MAIN_INIT')) die('fail');
37
13
 
38
14
/**
39
 
 * Convert special chars (like german umlauts) to ASCII characters.
40
 
 *
41
 
 * @todo dh> IMHO this function should not be included in a file that gets used often/always.
 
15
 * Convert special chars (like german umlauts) to ASCII characters
42
16
 * @param string
43
17
 * @return string
44
18
 */
45
19
function replace_special_chars( $str )
46
20
{
47
 
        global $evo_charset;
 
21
        global $app_charset;
48
22
 
49
 
        if( can_convert_charsets('UTF-8', $evo_charset) && can_convert_charsets('UTF-8', 'ISO-8859-1') /* source */ )
 
23
        if( can_convert_charsets( 'UTF-8', $app_charset ) && can_convert_charsets( 'UTF-8', 'ISO-8859-1' ) /* source */ )
50
24
        {
51
 
                $str = convert_charset( $str, 'UTF-8', $evo_charset );
 
25
                $str = convert_charset( $str, 'UTF-8', $app_charset );
52
26
 
53
 
                // TODO: add more...?!
 
27
                // @todo (0000): add more...?!
54
28
                $search = array( '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�' ); // iso-8859-1
55
29
                $replace = array( 'Ae', 'ae', 'Oe', 'oe', 'Ue', 'ue', 'ss', 'a', 'c', 'e', 'e', 'i', 'o', 'o', 'u' );
56
30
 
57
31
                foreach( $search as $k => $v )
58
 
                { // convert $search to UTF-8
 
32
                {
 
33
                        // convert $search to UTF-8
59
34
                        $search[$k] = convert_charset( $v, 'UTF-8', 'ISO-8859-1' );
60
35
                }
61
36
                $str = str_replace( $search, $replace, $str );
66
41
        else
67
42
        {
68
43
                // Replace HTML entities only
69
 
                $str = htmlentities( $str, ENT_NOQUOTES, $evo_charset );
 
44
                $str = htmlentities( $str, ENT_NOQUOTES, $app_charset );
70
45
        }
71
46
 
72
47
        // Keep only one char in entities!
80
55
        return $str;
81
56
}
82
57
 
83
 
 
84
 
?>
 
 
b'\\ No newline at end of file'
 
58
?>