public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Removed lib/translation.functions.php

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4457 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Sun Apr 27 06:27:38 -0700 2008
commit  aec01eb1af4c1dbb19d98c5bc656d0771a199a7f
tree    24bf0a40b77798c9f9e14317a7ac83bd77317d39
parent  d0c7ce152c41ceaef9472cf23f6be1a732ba1151
...
59
60
61
62
 
63
64
65
...
59
60
61
 
62
63
64
65
0
@@ -59,7 +59,7 @@
0
   }
0
   else
0
   {
0
- $themeObject->SendHeaders(isset($charsetsent), get_encoding('', false));
0
+ $themeObject->SendHeaders(isset($charsetsent), CmsResponse::get_encoding());
0
   }
0
   $themeObject->PopulateAdminNavigation(isset($CMS_ADMIN_SUBTITLE)?$CMS_ADMIN_SUBTITLE:'');
0
 
...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 
88
89
90
...
70
71
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
74
75
76
0
@@ -70,21 +70,7 @@
0
 }
0
 
0
 cms_smarty()->assign('lang', $frontendlang);
0
-cms_smarty()->assign('encoding', get_encoding());
0
-
0
-/*
0
-if (isset($CMS_ADMIN_PAGE))
0
-{
0
- include_once(cms_join_path($dirname, CmsConfig::get('admin_dir'), 'lang.php'));
0
-
0
- #This will only matter on upgrades now. All new stuff (0.13 on) will be UTF-8.
0
- if (is_file(cms_join_path($dirname,'lib','convert','ConvertCharset.class.php')))
0
- {
0
- include(cms_join_path($dirname,'lib','convert','ConvertCharset.class.php'));
0
- $gCms->variables['convertclass'] = new ConvertCharset();
0
- }
0
-}
0
-*/
0
+cms_smarty()->assign('encoding', 'UTF-8');
0
 
0
 #Load all installed module code
0
 CmsModuleLoader::load_modules(isset($LOAD_ALL_MODULES), !isset($CMS_ADMIN_PAGE));
...
75
76
77
78
79
 
80
81
82
...
75
76
77
 
 
78
79
80
81
0
@@ -75,8 +75,7 @@
0
   
0
   public function send_headers()
0
   {
0
- header("Content-Type: " . cmsms()->variables['content-type'] . "; charset=" .
0
- (isset($this->template_encoding) && $this->template_encoding != ''?$this->template_encoding:get_encoding()));
0
+ header("Content-Type: " . cmsms()->variables['content-type'] . "; charset=" . CmsResponse::get_encoding());
0
   }
0
   
0
   /**
...
35
36
37
 
 
 
 
 
38
39
40
...
35
36
37
38
39
40
41
42
43
44
45
0
@@ -35,6 +35,11 @@
0
     parent::__construct();
0
   }
0
   
0
+ function get_encoding()
0
+ {
0
+ return 'UTF-8';
0
+ }
0
+
0
   /**
0
    * Redirects a user to given url.
0
    *
...
475
476
477
478
 
479
480
481
...
475
476
477
 
478
479
480
481
0
@@ -475,7 +475,7 @@
0
       $tpl_source = $modoutput;
0
     }
0
     
0
- header("Content-Type: ".$gCms->variables['content-type']."; charset=" . (isset($line['encoding']) && $line['encoding'] != ''?$line['encoding']:get_encoding()));
0
+ header("Content-Type: ".$gCms->variables['content-type']."; charset=" . CmsResponse::get_encoding());
0
     if (isset($gCms->variables['content-filename']) && $gCms->variables['content-filename'] != '')
0
     {
0
       header('Content-Disposition: attachment; filename="'.$gCms->variables['content-filename'].'"');
...
419
420
421
422
423
424
425
426
427
428
429
 
430
431
432
...
455
456
457
458
 
459
460
461
...
588
589
590
591
 
592
593
594
...
634
635
636
637
 
638
639
640
...
419
420
421
 
 
 
 
 
 
 
 
422
423
424
425
...
448
449
450
 
451
452
453
454
...
581
582
583
 
584
585
586
587
...
627
628
629
 
630
631
632
633
0
@@ -419,14 +419,7 @@
0
   if ($templateobj !== FALSE && ($templateobj->active == '1' || $templateobj->active == TRUE) )
0
   {
0
     #Grab the encoding
0
- if ($templateobj->encoding !== FALSE && $templateobj->encoding != '')
0
- {
0
- $result['encoding'] = $templateobj->encoding;
0
- }
0
- else
0
- {
0
- $result['encoding'] = get_encoding();
0
- }
0
+ $result['encoding'] = CmsResponse::get_encoding();
0
 
0
     #Load in the "standard" template CSS if media type is empty
0
     if ($media_type == '')
0
@@ -455,7 +448,7 @@
0
   else
0
   {
0
     $result['nostylesheet'] = true;
0
- $result['encoding'] = get_encoding();
0
+ $result['encoding'] = CmsResponse::get_encoding();
0
   }
0
 
0
   #$css = preg_replace("/[\r\n]/", "", $css); //hack for tinymce
0
@@ -588,7 +581,7 @@
0
     {
0
       $result .= ' id="'.$id.'"';
0
     }
0
- $result .= '>'.cms_htmlentities($text,ENT_NOQUOTES,get_encoding($encoding)).'</textarea>';
0
+ $result .= '>'.cms_htmlentities($text,ENT_NOQUOTES,CmsResponse::get_encoding()).'</textarea>';
0
   }
0
 
0
   return $result;
0
@@ -634,7 +627,7 @@
0
             class="'.$class_name.'"';
0
         if ($id<>"")
0
             $output.=' id="'.$id.'"';
0
- $output.='>'.cms_htmlentities($text,ENT_NOQUOTES,get_encoding($encoding)).'</textarea>';
0
+ $output.='>'.cms_htmlentities($text,ENT_NOQUOTES,CmsResponse::get_encoding()).'</textarea>';
0
     }
0
 
0
     return $output;
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,91 +1 @@
0
-<?php
0
-#CMS - CMS Made Simple
0
-#(c)2004-2008 by Ted Kulp (ted@cmsmadesimple.org)
0
-#This project's homepage is: http://cmsmadesimple.sf.net
0
-#
0
-#This program is free software; you can redistribute it and/or modify
0
-#it under the terms of the GNU General Public License as published by
0
-#the Free Software Foundation; either version 2 of the License, or
0
-#(at your option) any later version.
0
-#
0
-#This program is distributed in the hope that it will be useful,
0
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
0
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0
-#GNU General Public License for more details.
0
-#You should have received a copy of the GNU General Public License
0
-#along with this program; if not, write to the Free Software
0
-#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0
-#
0
-#$Id$
0
-
0
-/**
0
- * Translation functions/classes
0
- *
0
- * @package CMS
0
- */
0
-
0
-function get_encoding($charset='', $defaultoverrides=true)
0
-{
0
- global $nls;
0
- global $current_language;
0
- global $config;
0
- global $gCms;
0
- $variables =& $gCms->variables;
0
-
0
- if ($charset != '')
0
- {
0
- return $charset;
0
- }
0
- else if (isset($variables['current_encoding']) && $variables['current_encoding'] != "" )
0
- {
0
- return $variables['current_encoding'];
0
- }
0
- else if (isset($config['default_encoding']) && $config['default_encoding'] != "" && $defaultoverrides == true)
0
- {
0
- return $config['default_encoding'];
0
- }
0
- else if (isset($nls['encoding'][$current_language]))
0
- {
0
- return $nls['encoding'][$current_language];
0
- }
0
- else
0
- {
0
- return "UTF-8"; //can't hurt
0
- }
0
-}
0
-
0
-
0
-function set_encoding($charset)
0
-{
0
- global $gCms;
0
- $variables =& $gCms->variables;
0
-
0
- if( $charset == '' )
0
- {
0
- if( isset($variables['current_encoding']) )
0
- unset($variables['current_encoding']);
0
- return;
0
- }
0
- $variables['current_encoding'] = $charset;
0
-}
0
-
0
-// Returns true if $string is valid UTF-8 and false otherwise.
0
-function is_utf8($string)
0
-{
0
- // From http://w3.org/International/questions/qa-forms-utf-8.html
0
- return preg_match('%^(?:
0
- [\x09\x0A\x0D\x20-\x7E] # ASCII
0
- | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
0
- | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
0
- | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
0
- | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
0
- | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
0
- | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
0
- | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
0
- )*$%xs', $string);
0
-
0
-} // function is_utf8
0
-
0
-# vim:ts=4 sw=4 noet
0
-?>

Comments

    No one has commented yet.