FCKeditor 2.6.6
[freeside.git] / httemplate / elements / fckeditor / editor / filemanager / connectors / perl / util.pl
1 #####\r
2 #  FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
3 #  Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
4 #\r
5 #  == BEGIN LICENSE ==\r
6 #\r
7 #  Licensed under the terms of any of the following licenses at your\r
8 #  choice:\r
9 #\r
10 #   - GNU General Public License Version 2 or later (the "GPL")\r
11 #     http://www.gnu.org/licenses/gpl.html\r
12 #\r
13 #   - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
14 #     http://www.gnu.org/licenses/lgpl.html\r
15 #\r
16 #   - Mozilla Public License Version 1.1 or later (the "MPL")\r
17 #     http://www.mozilla.org/MPL/MPL-1.1.html\r
18 #\r
19 #  == END LICENSE ==\r
20 #\r
21 #  This is the File Manager Connector for Perl.\r
22 #####\r
23 \r
24 sub RemoveFromStart\r
25 {\r
26         local($sourceString, $charToRemove) = @_;\r
27         $sPattern = '^' . $charToRemove . '+' ;\r
28         $sourceString =~ s/^$charToRemove+//g;\r
29         return $sourceString;\r
30 }\r
31 \r
32 sub RemoveFromEnd\r
33 {\r
34         local($sourceString, $charToRemove) = @_;\r
35         $sPattern = $charToRemove . '+$' ;\r
36         $sourceString =~ s/$charToRemove+$//g;\r
37         return $sourceString;\r
38 }\r
39 \r
40 sub ConvertToXmlAttribute\r
41 {\r
42         local($value) = @_;\r
43         return(&specialchar_cnv($value));\r
44 }\r
45 \r
46 sub specialchar_cnv\r
47 {\r
48         local($ch) = @_;\r
49 \r
50         $ch =~ s/&/&/g;             # &\r
51         $ch =~ s/\"/"/g;   #"\r
52         $ch =~ s/\'/'/g;    # '\r
53         $ch =~ s/</&lt;/g;              # <\r
54         $ch =~ s/>/&gt;/g;              # >\r
55         return($ch);\r
56 }\r
57 \r
58 sub JS_cnv\r
59 {\r
60         local($ch) = @_;\r
61 \r
62         $ch =~ s/\"/\\\"/g;     #"\r
63         return($ch);\r
64 }\r
65 \r
66 1;\r