PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/app/include/function.encoded.php

https://github.com/rinie/TransFormr
PHP | 275 lines | 263 code | 4 blank | 8 comment | 0 complexity | 774acdfbd29746aeb86945cafb5ca56e MD5 | raw file
  1. <?php
  2. defined( '_Transformr' ) or die( 'Restricted access' );
  3. /* html_convert_entities($string) -- convert named HTML entities to
  4. * XML-compatible numeric entities.
  5. */
  6. function html_convert_entities($string) {
  7. return preg_replace_callback('/([a-zA-Z][a-zA-Z0-9]+);/',
  8. 'convert_entity', $string);
  9. }
  10. /* Swap HTML named entity with its numeric equivalent. If the entity
  11. * isn't in the lookup table, this function returns a blank, which
  12. * destroys the character in the output - this is probably the
  13. * desired behaviour when producing XML. */
  14. function convert_entity($matches) {
  15. static $table = array('quot' => '#34;',
  16. 'amp' => '#38;',
  17. 'lt' => '#60;',
  18. 'gt' => '#62;',
  19. 'OElig' => '#338;',
  20. 'oelig' => '#339;',
  21. 'Scaron' => '#352;',
  22. 'scaron' => '#353;',
  23. 'Yuml' => '#376;',
  24. 'circ' => '#710;',
  25. 'tilde' => '#732;',
  26. 'ensp' => '#8194;',
  27. 'emsp' => '#8195;',
  28. 'thinsp' => '#8201;',
  29. 'zwnj' => '#8204;',
  30. 'zwj' => '#8205;',
  31. 'lrm' => '#8206;',
  32. 'rlm' => '#8207;',
  33. 'ndash' => '#8211;',
  34. 'mdash' => '#8212;',
  35. 'lsquo' => '#8216;',
  36. 'rsquo' => '#8217;',
  37. 'sbquo' => '#8218;',
  38. 'ldquo' => '#8220;',
  39. 'rdquo' => '#8221;',
  40. 'bdquo' => '#8222;',
  41. 'dagger' => '#8224;',
  42. 'Dagger' => '#8225;',
  43. 'permil' => '#8240;',
  44. 'lsaquo' => '#8249;',
  45. 'rsaquo' => '#8250;',
  46. 'euro' => '#8364;',
  47. 'fnof' => '#402;',
  48. 'Alpha' => '#913;',
  49. 'Beta' => '#914;',
  50. 'Gamma' => '#915;',
  51. 'Delta' => '#916;',
  52. 'Epsilon' => '#917;',
  53. 'Zeta' => '#918;',
  54. 'Eta' => '#919;',
  55. 'Theta' => '#920;',
  56. 'Iota' => '#921;',
  57. 'Kappa' => '#922;',
  58. 'Lambda' => '#923;',
  59. 'Mu' => '#924;',
  60. 'Nu' => '#925;',
  61. 'Xi' => '#926;',
  62. 'Omicron' => '#927;',
  63. 'Pi' => '#928;',
  64. 'Rho' => '#929;',
  65. 'Sigma' => '#931;',
  66. 'Tau' => '#932;',
  67. 'Upsilon' => '#933;',
  68. 'Phi' => '#934;',
  69. 'Chi' => '#935;',
  70. 'Psi' => '#936;',
  71. 'Omega' => '#937;',
  72. 'alpha' => '#945;',
  73. 'beta' => '#946;',
  74. 'gamma' => '#947;',
  75. 'delta' => '#948;',
  76. 'epsilon' => '#949;',
  77. 'zeta' => '#950;',
  78. 'eta' => '#951;',
  79. 'theta' => '#952;',
  80. 'iota' => '#953;',
  81. 'kappa' => '#954;',
  82. 'lambda' => '#955;',
  83. 'mu' => '#956;',
  84. 'nu' => '#957;',
  85. 'xi' => '#958;',
  86. 'omicron' => '#959;',
  87. 'pi' => '#960;',
  88. 'rho' => '#961;',
  89. 'sigmaf' => '#962;',
  90. 'sigma' => '#963;',
  91. 'tau' => '#964;',
  92. 'upsilon' => '#965;',
  93. 'phi' => '#966;',
  94. 'chi' => '#967;',
  95. 'psi' => '#968;',
  96. 'omega' => '#969;',
  97. 'thetasym' => '#977;',
  98. 'upsih' => '#978;',
  99. 'piv' => '#982;',
  100. 'bull' => '#8226;',
  101. 'hellip' => '#8230;',
  102. 'prime' => '#8242;',
  103. 'Prime' => '#8243;',
  104. 'oline' => '#8254;',
  105. 'frasl' => '#8260;',
  106. 'weierp' => '#8472;',
  107. 'image' => '#8465;',
  108. 'real' => '#8476;',
  109. 'trade' => '#8482;',
  110. 'alefsym' => '#8501;',
  111. 'larr' => '#8592;',
  112. 'uarr' => '#8593;',
  113. 'rarr' => '#8594;',
  114. 'darr' => '#8595;',
  115. 'harr' => '#8596;',
  116. 'crarr' => '#8629;',
  117. 'lArr' => '#8656;',
  118. 'uArr' => '#8657;',
  119. 'rArr' => '#8658;',
  120. 'dArr' => '#8659;',
  121. 'hArr' => '#8660;',
  122. 'forall' => '#8704;',
  123. 'part' => '#8706;',
  124. 'exist' => '#8707;',
  125. 'empty' => '#8709;',
  126. 'nabla' => '#8711;',
  127. 'isin' => '#8712;',
  128. 'notin' => '#8713;',
  129. 'ni' => '#8715;',
  130. 'prod' => '#8719;',
  131. 'sum' => '#8721;',
  132. 'minus' => '#8722;',
  133. 'lowast' => '#8727;',
  134. 'radic' => '#8730;',
  135. 'prop' => '#8733;',
  136. 'infin' => '#8734;',
  137. 'ang' => '#8736;',
  138. 'and' => '#8743;',
  139. 'or' => '#8744;',
  140. 'cap' => '#8745;',
  141. 'cup' => '#8746;',
  142. 'int' => '#8747;',
  143. 'there4' => '#8756;',
  144. 'sim' => '#8764;',
  145. 'cong' => '#8773;',
  146. 'asymp' => '#8776;',
  147. 'ne' => '#8800;',
  148. 'equiv' => '#8801;',
  149. 'le' => '#8804;',
  150. 'ge' => '#8805;',
  151. 'sub' => '#8834;',
  152. 'sup' => '#8835;',
  153. 'nsub' => '#8836;',
  154. 'sube' => '#8838;',
  155. 'supe' => '#8839;',
  156. 'oplus' => '#8853;',
  157. 'otimes' => '#8855;',
  158. 'perp' => '#8869;',
  159. 'sdot' => '#8901;',
  160. 'lceil' => '#8968;',
  161. 'rceil' => '#8969;',
  162. 'lfloor' => '#8970;',
  163. 'rfloor' => '#8971;',
  164. 'lang' => '#9001;',
  165. 'rang' => '#9002;',
  166. 'loz' => '#9674;',
  167. 'spades' => '#9824;',
  168. 'clubs' => '#9827;',
  169. 'hearts' => '#9829;',
  170. 'diams' => '#9830;',
  171. 'nbsp' => '#160;',
  172. 'iexcl' => '#161;',
  173. 'cent' => '#162;',
  174. 'pound' => '#163;',
  175. 'curren' => '#164;',
  176. 'yen' => '#165;',
  177. 'brvbar' => '#166;',
  178. 'sect' => '#167;',
  179. 'uml' => '#168;',
  180. 'copy' => '#169;',
  181. 'ordf' => '#170;',
  182. 'laquo' => '#171;',
  183. 'not' => '#172;',
  184. 'shy' => '#173;',
  185. 'reg' => '#174;',
  186. 'macr' => '#175;',
  187. 'deg' => '#176;',
  188. 'plusmn' => '#177;',
  189. 'sup2' => '#178;',
  190. 'sup3' => '#179;',
  191. 'acute' => '#180;',
  192. 'micro' => '#181;',
  193. 'para' => '#182;',
  194. 'middot' => '#183;',
  195. 'cedil' => '#184;',
  196. 'sup1' => '#185;',
  197. 'ordm' => '#186;',
  198. 'raquo' => '#187;',
  199. 'frac14' => '#188;',
  200. 'frac12' => '#189;',
  201. 'frac34' => '#190;',
  202. 'iquest' => '#191;',
  203. 'Agrave' => '#192;',
  204. 'Aacute' => '#193;',
  205. 'Acirc' => '#194;',
  206. 'Atilde' => '#195;',
  207. 'Auml' => '#196;',
  208. 'Aring' => '#197;',
  209. 'AElig' => '#198;',
  210. 'Ccedil' => '#199;',
  211. 'Egrave' => '#200;',
  212. 'Eacute' => '#201;',
  213. 'Ecirc' => '#202;',
  214. 'Euml' => '#203;',
  215. 'Igrave' => '#204;',
  216. 'Iacute' => '#205;',
  217. 'Icirc' => '#206;',
  218. 'Iuml' => '#207;',
  219. 'ETH' => '#208;',
  220. 'Ntilde' => '#209;',
  221. 'Ograve' => '#210;',
  222. 'Oacute' => '#211;',
  223. 'Ocirc' => '#212;',
  224. 'Otilde' => '#213;',
  225. 'Ouml' => '#214;',
  226. 'times' => '#215;',
  227. 'Oslash' => '#216;',
  228. 'Ugrave' => '#217;',
  229. 'Uacute' => '#218;',
  230. 'Ucirc' => '#219;',
  231. 'Uuml' => '#220;',
  232. 'Yacute' => '#221;',
  233. 'THORN' => '#222;',
  234. 'szlig' => '#223;',
  235. 'agrave' => '#224;',
  236. 'aacute' => '#225;',
  237. 'acirc' => '#226;',
  238. 'atilde' => '#227;',
  239. 'auml' => '#228;',
  240. 'aring' => '#229;',
  241. 'aelig' => '#230;',
  242. 'ccedil' => '#231;',
  243. 'egrave' => '#232;',
  244. 'eacute' => '#233;',
  245. 'ecirc' => '#234;',
  246. 'euml' => '#235;',
  247. 'igrave' => '#236;',
  248. 'iacute' => '#237;',
  249. 'icirc' => '#238;',
  250. 'iuml' => '#239;',
  251. 'eth' => '#240;',
  252. 'ntilde' => '#241;',
  253. 'ograve' => '#242;',
  254. 'oacute' => '#243;',
  255. 'ocirc' => '#244;',
  256. 'otilde' => '#245;',
  257. 'ouml' => '#246;',
  258. 'divide' => '#247;',
  259. 'oslash' => '#248;',
  260. 'ugrave' => '#249;',
  261. 'uacute' => '#250;',
  262. 'ucirc' => '#251;',
  263. 'uuml' => '#252;',
  264. 'yacute' => '#253;',
  265. 'thorn' => '#254;',
  266. 'yuml' => '#255;'
  267. );
  268. // Entity not found? Destroy it.
  269. return isset($table[$matches[1]]) ? $table[$matches[1]] : '';
  270. }
  271. ?>