]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/phpjs/get_html_translation_table.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / phpjs / get_html_translation_table.js
1 /*
2  * More info at: http://phpjs.org
3  *
4  * This is version: 3.25
5  * php.js is copyright 2011 Kevin van Zonneveld.
6  *
7  * Portions copyright Brett Zamir (http://brett-zamir.me), Kevin van Zonneveld
8  * (http://kevin.vanzonneveld.net), Onno Marsman, Theriault, Michael White
9  * (http://getsprink.com), Waldo Malqui Silva, Paulo Freitas, Jonas Raoni
10  * Soares Silva (http://www.jsfromhell.com), Jack, Philip Peterson, Legaev
11  * Andrey, Ates Goral (http://magnetiq.com), Ratheous, Alex, Rafa? Kukawski
12  * (http://blog.kukawski.pl), Martijn Wieringa, lmeyrick
13  * (https://sourceforge.net/projects/bcmath-js/), Nate, Enrique Gonzalez,
14  * Philippe Baumann, Webtoolkit.info (http://www.webtoolkit.info/), Jani
15  * Hartikainen, Ole Vrijenhoek, Ash Searle (http://hexmen.com/blog/), Carlos
16  * R. L. Rodrigues (http://www.jsfromhell.com), travc, Michael Grier,
17  * Erkekjetter, Johnny Mast (http://www.phpvrouwen.nl), Rafa? Kukawski
18  * (http://blog.kukawski.pl/), GeekFG (http://geekfg.blogspot.com), Andrea
19  * Giammarchi (http://webreflection.blogspot.com), WebDevHobo
20  * (http://webdevhobo.blogspot.com/), d3x, marrtins,
21  * http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript,
22  * pilus, stag019, T.Wild, Martin (http://www.erlenwiese.de/), majak, Marc
23  * Palau, Mirek Slugen, Chris, Diplom@t (http://difane.com/), Breaking Par
24  * Consulting Inc
25  * (http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256CFB006C45F7),
26  * gettimeofday, Arpad Ray (mailto:arpad@php.net), Oleg Eremeev, Josh Fraser
27  * (http://onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/),
28  * Steve Hilder, mdsjack (http://www.mdsjack.bo.it), Kevin van Zonneveld
29  * (http://kevin.vanzonneveld.net/), gorthaur, Aman Gupta, Sakimori, Joris,
30  * Robin, Kankrelune (http://www.webfaktory.info/), Alfonso Jimenez
31  * (http://www.alfonsojimenez.com), David, Felix Geisendoerfer
32  * (http://www.debuggable.com/felix), Lars Fischer, Karol Kowalski, Imgen Tata
33  * (http://www.myipdf.com/), Steven Levithan (http://blog.stevenlevithan.com),
34  * Tim de Koning (http://www.kingsquare.nl), Dreamer, AJ, Paul Smith, KELAN,
35  * Pellentesque Malesuada, felix, Michael White, Mailfaker
36  * (http://www.weedem.fr/), Thunder.m, Tyler Akins (http://rumkin.com),
37  * saulius, Public Domain (http://www.json.org/json2.js), Caio Ariede
38  * (http://caioariede.com), Steve Clay, David James, madipta, Marco, Ole
39  * Vrijenhoek (http://www.nervous.nl/), class_exists, T. Wild, noname, Arno,
40  * Frank Forte, Francois, Scott Cariss, Slawomir Kaniecki, date, Itsacon
41  * (http://www.itsacon.net/), Billy, vlado houba, Jalal Berrami,
42  * ReverseSyntax, Mateusz "loonquawl" Zalega, john (http://www.jd-tech.net),
43  * mktime, Douglas Crockford (http://javascript.crockford.com), ger, Nick
44  * Kolosov (http://sammy.ru), Nathan, nobbler, Fox, marc andreu, Alex Wilson,
45  * Raphael (Ao RUDLER), Bayron Guevara, Adam Wallner
46  * (http://web2.bitbaro.hu/), paulo kuong, jmweb, Lincoln Ramsay, djmix,
47  * Pyerre, Jon Hohle, Thiago Mata (http://thiagomata.blog.com), lmeyrick
48  * (https://sourceforge.net/projects/bcmath-js/this.), Linuxworld, duncan,
49  * Gilbert, Sanjoy Roy, Shingo, sankai, Oskar Larsson H�gfeldt
50  * (http://oskar-lh.name/), Denny Wardhana, 0m3r, Everlasto, Subhasis Deb,
51  * josh, jd, Pier Paolo Ramon (http://www.mastersoup.com/), P, merabi, Soren
52  * Hansen, EdorFaus, Eugene Bulkin (http://doubleaw.com/), Der Simon
53  * (http://innerdom.sourceforge.net/), echo is bad, JB, LH, kenneth, J A R,
54  * Marc Jansen, Stoyan Kyosev (http://www.svest.org/), Francesco, XoraX
55  * (http://www.xorax.info), Ozh, Brad Touesnard, MeEtc
56  * (http://yass.meetcweb.com), Peter-Paul Koch
57  * (http://www.quirksmode.org/js/beat.html), Olivier Louvignes
58  * (http://mg-crea.com/), T0bsn, Tim Wiel, Bryan Elliott, nord_ua, Martin, JT,
59  * David Randall, Thomas Beaucourt (http://www.webapp.fr), Tim de Koning,
60  * stensi, Pierre-Luc Paour, Kristof Coomans (SCK-CEN Belgian Nucleair
61  * Research Centre), Martin Pool, Kirk Strobeck, Rick Waldron, Brant Messenger
62  * (http://www.brantmessenger.com/), Devan Penner-Woelk, Saulo Vallory, Wagner
63  * B. Soares, Artur Tchernychev, Valentina De Rosa, Jason Wong
64  * (http://carrot.org/), Christoph, Daniel Esteban, strftime, Mick@el, rezna,
65  * Simon Willison (http://simonwillison.net), Anton Ongson, Gabriel Paderni,
66  * Marco van Oort, penutbutterjelly, Philipp Lenssen, Bjorn Roesbeke
67  * (http://www.bjornroesbeke.be/), Bug?, Eric Nagel, Tomasz Wesolowski,
68  * Evertjan Garretsen, Bobby Drake, Blues (http://tech.bluesmoon.info/), Luke
69  * Godfrey, Pul, uestla, Alan C, Ulrich, Rafal Kukawski, Yves Sucaet,
70  * sowberry, Norman "zEh" Fuchs, hitwork, Zahlii, johnrembo, Nick Callen,
71  * Steven Levithan (stevenlevithan.com), ejsanders, Scott Baker, Brian Tafoya
72  * (http://www.premasolutions.com/), Philippe Jausions
73  * (http://pear.php.net/user/jausions), Aidan Lister
74  * (http://aidanlister.com/), Rob, e-mike, HKM, ChaosNo1, metjay, strcasecmp,
75  * strcmp, Taras Bogach, jpfle, Alexander Ermolaev
76  * (http://snippets.dzone.com/user/AlexanderErmolaev), DxGx, kilops, Orlando,
77  * dptr1988, Le Torbi, James (http://www.james-bell.co.uk/), Pedro Tainha
78  * (http://www.pedrotainha.com), James, Arnout Kazemier
79  * (http://www.3rd-Eden.com), Chris McMacken, Yannoo, jakes, gabriel paderni,
80  * FGFEmperor, Greg Frazier, baris ozdil, 3D-GRAF, daniel airton wermann
81  * (http://wermann.com.br), Howard Yeend, Diogo Resende, Allan Jensen
82  * (http://www.winternet.no), Benjamin Lupton, Atli ?�r, Maximusya, davook,
83  * Tod Gentille, Ryan W Tenney (http://ryan.10e.us), Nathan Sepulveda, Cord,
84  * fearphage (http://http/my.opera.com/fearphage/), Victor, Rafa? Kukawski
85  * (http://kukawski.pl), Matteo, Manish, Matt Bradley, Riddler
86  * (http://www.frontierwebdev.com/), Alexander M Beedie, T.J. Leahy, Rafa?
87  * Kukawski, taith, Luis Salazar (http://www.freaky-media.com/), FremyCompany,
88  * Rival, Luke Smith (http://lucassmith.name), Andrej Pavlovic, Garagoth, Le
89  * Torbi (http://www.letorbi.de/), Dino, Josep Sanz (http://www.ws3.es/), rem,
90  * Russell Walker (http://www.nbill.co.uk/), Jamie Beck
91  * (http://www.terabit.ca/), setcookie, Michael, YUI Library:
92  * http://developer.yahoo.com/yui/docs/YAHOO.util.DateLocale.html, Blues at
93  * http://hacks.bluesmoon.info/strftime/strftime.js, Ben
94  * (http://benblume.co.uk/), DtTvB
95  * (http://dt.in.th/2008-09-16.string-length-in-bytes.html), Andreas, William,
96  * meo, incidence, Cagri Ekin, Amirouche, Amir Habibi
97  * (http://www.residence-mixte.com/), Kheang Hok Chin
98  * (http://www.distantia.ca/), Jay Klehr, Lorenzo Pisani, Tony, Yen-Wei Liu,
99  * Greenseed, mk.keck, Leslie Hoare, dude, booeyOH, Ben Bryan
100  *
101  * Dual licensed under the MIT (MIT-LICENSE.txt)
102  * and GPL (GPL-LICENSE.txt) licenses.
103  *
104  * Permission is hereby granted, free of charge, to any person obtaining a
105  * copy of this software and associated documentation files (the
106  * "Software"), to deal in the Software without restriction, including
107  * without limitation the rights to use, copy, modify, merge, publish,
108  * distribute, sublicense, and/or sell copies of the Software, and to
109  * permit persons to whom the Software is furnished to do so, subject to
110  * the following conditions:
111  *
112  * The above copyright notice and this permission notice shall be included
113  * in all copies or substantial portions of the Software.
114  *
115  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
116  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
117  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
118  * IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES
119  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
120  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
121  * OTHER DEALINGS IN THE SOFTWARE.
122  */
123 function get_html_translation_table(table,quote_style){var entities={},hash_map={},decimal=0,symbol='';var constMappingTable={},constMappingQuoteStyle={};var useTable={},useQuoteStyle={};constMappingTable[0]='HTML_SPECIALCHARS';constMappingTable[1]='HTML_ENTITIES';constMappingQuoteStyle[0]='ENT_NOQUOTES';constMappingQuoteStyle[2]='ENT_COMPAT';constMappingQuoteStyle[3]='ENT_QUOTES';useTable=!isNaN(table)?constMappingTable[table]:table?table.toUpperCase():'HTML_SPECIALCHARS';useQuoteStyle=!isNaN(quote_style)?constMappingQuoteStyle[quote_style]:quote_style?quote_style.toUpperCase():'ENT_COMPAT';if(useTable!=='HTML_SPECIALCHARS'&&useTable!=='HTML_ENTITIES'){throw new Error("Table: "+useTable+' not supported');}
124 entities['38']='&';if(useTable==='HTML_ENTITIES'){entities['160']=' ';entities['161']='¡';entities['162']='¢';entities['163']='£';entities['164']='¤';entities['165']='¥';entities['166']='¦';entities['167']='§';entities['168']='¨';entities['169']='©';entities['170']='ª';entities['171']='«';entities['172']='¬';entities['173']='­';entities['174']='®';entities['175']='¯';entities['176']='°';entities['177']='±';entities['178']='²';entities['179']='³';entities['180']='´';entities['181']='µ';entities['182']='¶';entities['183']='·';entities['184']='¸';entities['185']='¹';entities['186']='º';entities['187']='»';entities['188']='¼';entities['189']='½';entities['190']='¾';entities['191']='¿';entities['192']='À';entities['193']='Á';entities['194']='Â';entities['195']='Ã';entities['196']='Ä';entities['197']='Å';entities['198']='Æ';entities['199']='Ç';entities['200']='È';entities['201']='É';entities['202']='Ê';entities['203']='Ë';entities['204']='Ì';entities['205']='Í';entities['206']='Î';entities['207']='Ï';entities['208']='Ð';entities['209']='Ñ';entities['210']='Ò';entities['211']='Ó';entities['212']='Ô';entities['213']='Õ';entities['214']='Ö';entities['215']='×';entities['216']='Ø';entities['217']='Ù';entities['218']='Ú';entities['219']='Û';entities['220']='Ü';entities['221']='Ý';entities['222']='Þ';entities['223']='ß';entities['224']='à';entities['225']='á';entities['226']='â';entities['227']='ã';entities['228']='ä';entities['229']='å';entities['230']='æ';entities['231']='ç';entities['232']='è';entities['233']='é';entities['234']='ê';entities['235']='ë';entities['236']='ì';entities['237']='í';entities['238']='î';entities['239']='ï';entities['240']='ð';entities['241']='ñ';entities['242']='ò';entities['243']='ó';entities['244']='ô';entities['245']='õ';entities['246']='ö';entities['247']='÷';entities['248']='ø';entities['249']='ù';entities['250']='ú';entities['251']='û';entities['252']='ü';entities['253']='ý';entities['254']='þ';entities['255']='ÿ';}
125 if(useQuoteStyle!=='ENT_NOQUOTES'){entities['34']='"';}
126 if(useQuoteStyle==='ENT_QUOTES'){entities['39']=''';}
127 entities['60']='<';entities['62']='>';for(decimal in entities){symbol=String.fromCharCode(decimal);hash_map[symbol]=entities[decimal];}
128 return hash_map;}