sahwar

internationalized-HTML5-converter.html

Sep 21st, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.24 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title>Internationalized HTML(5) converter (write HTML(5) in your own native language and output it automagically into proper English code!</title>
  5. </head>
  6. <body>
  7. <!--
  8. This code is made possible by:
  9. 1. PHP code copied from http://stackoverflow.com/questions/535143/search-and-replace-multiple-values-with-multiple-different-values-in-php5
  10. 2. Some code copied from http://stackoverflow.com/questions/7711466/checking-if-form-has-been-submitted-php
  11. 3. http://bg2.php.net/str_replace
  12. 4. Help from a friend who knows PHP.
  13. 5. The HTML tags are acquired from http://www.w3schools.com/tags/default.asp
  14. 6. The CSS tags are acquired from
  15. -->
  16. <p><strong>Internationalized HTML(5) converter (write HTML(5) in your own native language and output it automagically into proper English code!</strong></p>
  17. <form method="post" action="<?php echo $PHP_SELF;?>">
  18. <textarea rows="10" cols="50" name="quote" wrap="physical">Enter your input code here!</textarea><br />
  19. Select the HTML's/CSS's language input-output type:<br />
  20. <select name="transformation">
  21. <option value="BG->EN">BG → EN</option>
  22. <option value="EN->BG">EN → BG</option>
  23. </select><br />
  24. <input type="submit" value="submit" name="submit">
  25. </form>
  26. <p>Your output code goes here! Just copy and paste into Notepad and save it as *.html<p>
  27. <textarea rows="10" cols="50" name="result" wrap="physical">
  28.  
  29. <?php
  30.  
  31. if (!empty($_POST))
  32. {
  33. $quote = $_POST["quote"];
  34. $searchReplaceArray = array(
  35. '<!ТИПНАДОК емхт>' => '<!DOCTYPE html>',
  36. '<емхт>' => '<html>',
  37. '</емхт>' => '</html>',
  38. '<к хпре=' => '<a href=',
  39. '</к>' => '</a>',
  40. '<абр>' => '<abbr>',
  41. '<акроним заглавие=' => '<acronym title=',
  42. '</акроним>' => '</acronym>',
  43. '<адрес>' => '<address>',
  44. '</адрес>' => '</address>',
  45. '<абр заглавие=' => '<abbr title=',
  46. '</абр>' => '</abbr>',
  47. '<аплет код="' => '<applet code="',
  48. '</аплет>' => '</applet>',
  49. ' ширина="' => ' width="'
  50. ' височина="' => ' height="'
  51. '<зона очертание=">' => ' <area shape=">',
  52. '</зона>' => '</area>',
  53. ' координати="' => ' coords="',
  54. ' хпреп="' => ' href="',
  55. ' алт="' => ' alt="',
  56. '<статия>' => '<article>',
  57. '</статия>' => '</article>',
  58. '<настрана>' => '<aside>',
  59. '</настрана>' => '</aside>',
  60. '<аудио>' => '<audio>',
  61. '</аудио>' => '</audio>',
  62. ' контроли ' => ' controls ',
  63. '<източник изт="' => '<source src="',
  64. '</източник>' => '</source>',
  65. ' затворена верига ' => ' loop ',
  66. ' заглушаване ' => ' muted ',
  67. 'предзареждане="' => 'preload="',
  68. 'изт="' => 'src="',
  69. '<пч>' => '<b>',
  70. '</пч>' => '</b>',
  71. '<основа ' => '<base ',
  72. '</основа>' => '</base>',
  73. ' цел="' => ' target="',
  74. '<основеншрифт ' => '<basefont ',
  75. '</основеншрифт>' => '</basefont>',
  76. ' цвят="' => ' color="',
  77. ' начертание="' => ' face="',
  78. ' размер="' => ' size="',
  79. '<дпи>' => '<bdi>',
  80. '</дпи>' => '</bdi>',
  81. '<дпп посока="' => '<bdo dir="',
  82. '</дпп>' => '</bdo>',
  83. '<голям>' => '<big>',
  84. '</голям>' => '</big>',
  85. '<блокцитат>' => '<blockquote>',
  86. '<блокцитат цитиране=' => '<blockquote cite="',
  87. '</блокцитат>' => '</blockquote>',
  88. '<тяло>' => '<body>',
  89. '</тяло>' => '</body>',
  90. ' авръзка="' => ' alink="',
  91. ' фон="' => ' background="',
  92. ' фоновцвят="' => ' bgcolor="',
  93. ' връзка="' => ' link="',
  94. ' текст="' => ' text="',
  95. ' пвръзка="' => ' vlink="',
  96. '<чл>' => '<br>',
  97. '<чл />' => '<br />',
  98. '<чл/>' => '<br/>',
  99. 'blarh' => 'blerh',
  100. 'blarh' => 'blerh',
  101. 'blarh' => 'blerh',
  102. 'blarh' => 'blerh',
  103. 'blarh' => 'blerh',
  104. 'blarh' => 'blerh',
  105. 'blarh' => 'blerh',
  106. 'blarh' => 'blerh',
  107. 'blarh' => 'blerh',
  108. 'blarh' => 'blerh',
  109. 'blarh' => 'blerh',
  110. 'blarh' => 'blerh',
  111. 'blarh' => 'blerh',
  112. 'blarh' => 'blerh',
  113. 'blarh' => 'blerh',
  114. 'blarh' => 'blerh',
  115. 'blarh' => 'blerh',
  116. 'blarh' => 'blerh',
  117. 'blarh' => 'blerh',
  118. 'blarh' => 'blerh',
  119. 'blarh' => 'blerh',
  120. 'blarh' => 'blerh',
  121. 'blarh' => 'blerh',
  122. 'blarh' => 'blerh',
  123. 'blarh' => 'blerh',
  124. 'blarh' => 'blerh',
  125. 'blarh' => 'blerh',
  126. 'blarh' => 'blerh',
  127. 'blarh' => 'blerh',
  128. 'blarh' => 'blerh',
  129. 'blarh' => 'blerh',
  130. 'blarh' => 'blerh',
  131. 'blarh' => 'blerh',
  132. 'blarh' => 'blerh',
  133. 'blarh' => 'blerh',
  134. 'blarh' => 'blerh',
  135. 'blarh' => 'blerh',
  136. 'blarh' => 'blerh',
  137. 'blarh' => 'blerh',
  138. 'blarh' => 'blerh',
  139. 'blarh' => 'blerh',
  140. 'blarh' => 'blerh',
  141. 'blarh' => 'blerh',
  142. 'blarh' => 'blerh',
  143. 'blarh' => 'blerh',
  144. 'blarh' => 'blerh',
  145. 'blarh' => 'blerh',
  146. 'blarh' => 'blerh',
  147. 'blarh' => 'blerh',
  148. 'blarh' => 'blerh',
  149. 'blarh' => 'blerh',
  150. 'blarh' => 'blerh',
  151. 'blarh' => 'blerh',
  152. 'blarh' => 'blerh',
  153. 'blarh' => 'blerh',
  154. 'blarh' => 'blerh',
  155. 'blarh' => 'blerh',
  156. 'blarh' => 'blerh',
  157. 'blarh' => 'blerh',
  158. 'blarh' => 'blerh',
  159. 'blarh' => 'blerh',
  160. 'blarh' => 'blerh',
  161. 'blarh' => 'blerh',
  162. 'blarh' => 'blerh',
  163. 'blarh' => 'blerh',
  164. 'blarh' => 'blerh',
  165. 'blarh' => 'blerh',
  166. 'blarh' => 'blerh',
  167. 'blarh' => 'blerh',
  168. 'blarh' => 'blerh',
  169. 'blarh' => 'blerh',
  170. 'blarh' => 'blerh',
  171. 'blarh' => 'blerh',
  172. 'blarh' => 'blerh',
  173. 'blarh' => 'blerh',
  174. 'blarh' => 'blerh',
  175. 'blarh' => 'blerh',
  176. 'blarh' => 'blerh',
  177. 'blarh' => 'blerh',
  178. 'blarh' => 'blerh',
  179. 'blarh' => 'blerh',
  180. 'blarh' => 'blerh',
  181. 'blarh' => 'blerh',
  182. 'blarh' => 'blerh',
  183. 'blarh' => 'blerh',
  184. 'blarh' => 'blerh',
  185. 'blarh' => 'blerh',
  186. 'blarh' => 'blerh',
  187. 'blarh' => 'blerh',
  188. 'blarh' => 'blerh',
  189. 'blarh' => 'blerh',
  190. 'blarh' => 'blerh',
  191. 'blarh' => 'blerh',
  192. );
  193. $result = str_replace(
  194. array_keys($searchReplaceArray),
  195. array_values($searchReplaceArray),
  196. $quote
  197. );
  198.  
  199. echo $result;
  200.  
  201. }
  202. ?>
  203. </textarea>
  204.  
  205. <p>
  206. <code>
  207. <button> Defines a clickable button
  208. <canvas> Used to draw graphics, on the fly, via scripting (usually JavaScript)
  209. <caption> Defines a table caption
  210. <center> Not supported in HTML5. Use CSS instead. Defines centered text
  211. <cite> Defines the title of a work
  212. <code> Defines a piece of computer code
  213. <col> Specifies column properties for each column within a <colgroup> element
  214. <colgroup> Specifies a group of one or more columns in a table for formatting
  215. <datalist> Specifies a list of pre-defined options for input controls
  216. <dd> Defines a description/value of a term in a description list
  217. <del> Defines text that has been deleted from a document
  218. <details> Defines additional details that the user can view or hide
  219. <dfn> Defines a definition term
  220. <dialog> Defines a dialog box or window
  221. <dir> Not supported in HTML5. Use <ul> instead.
  222. Defines a directory list
  223. <div> Defines a section in a document
  224. <dl> Defines a description list
  225. <dt> Defines a term/name in a description list
  226. <em> Defines emphasized text
  227. <embed> Defines a container for an external (non-HTML) application
  228. <fieldset> Groups related elements in a form
  229. <figcaption> Defines a caption for a <figure> element
  230. <figure> Specifies self-contained content
  231. <font> Not supported in HTML5. Use CSS instead.
  232. Defines font, color, and size for text
  233. <footer> Defines a footer for a document or section
  234. <form> Defines an HTML form for user input
  235. <frame> Not supported in HTML5.
  236. Defines a window (a frame) in a frameset
  237. <frameset> Not supported in HTML5.
  238. Defines a set of frames
  239. <h1> to <h6> Defines HTML headings
  240. <head> Defines information about the document
  241. <header> Defines a header for a document or section
  242. <hr> Defines a thematic change in the content
  243. <html> Defines the root of an HTML document
  244. <i> Defines a part of text in an alternate voice or mood
  245. <iframe> Defines an inline frame
  246. <img> Defines an image
  247. <input> Defines an input control
  248. <ins> Defines a text that has been inserted into a document
  249. <kbd> Defines keyboard input
  250. <keygen> Defines a key-pair generator field (for forms)
  251. <label> Defines a label for an <input> element
  252. <legend> Defines a caption for a <fieldset> element
  253. <li> Defines a list item
  254. <link> Defines the relationship between a document and an external resource (most used to link to style sheets)
  255. <main> Specifies the main content of a document
  256. <map> Defines a client-side image-map
  257. <mark> Defines marked/highlighted text
  258. <menu> Defines a list/menu of commands
  259. <menuitem> Defines a command/menu item that the user can invoke from a popup menu
  260. <meta> Defines metadata about an HTML document
  261. <meter> Defines a scalar measurement within a known range (a gauge)
  262. <nav> Defines navigation links
  263. <noframes> Not supported in HTML5.
  264. Defines an alternate content for users that do not support frames
  265. <noscript> Defines an alternate content for users that do not support client-side scripts
  266. <object> Defines an embedded object
  267. <ol> Defines an ordered list
  268. <optgroup> Defines a group of related options in a drop-down list
  269. <option> Defines an option in a drop-down list
  270. <output> Defines the result of a calculation
  271. <p> Defines a paragraph
  272. <param> Defines a parameter for an object
  273. <pre> Defines preformatted text
  274. <progress> Represents the progress of a task
  275. <q> Defines a short quotation
  276. <rp> Defines what to show in browsers that do not support ruby annotations
  277. <rt> Defines an explanation/pronunciation of characters (for East Asian typography)
  278. <ruby> Defines a ruby annotation (for East Asian typography)
  279. <s> Defines text that is no longer correct
  280. <samp> Defines sample output from a computer program
  281. <script> Defines a client-side script
  282. <section> Defines a section in a document
  283. <select> Defines a drop-down list
  284. <small> Defines smaller text
  285. <source> Defines multiple media resources for media elements (<video> and <audio>)
  286. <span> Defines a section in a document
  287. <strike> Not supported in HTML5. Use <del> instead.
  288. Defines strikethrough text
  289. <strong> Defines important text
  290. <style> Defines style information for a document
  291. <sub> Defines subscripted text
  292. <summary> Defines a visible heading for a <details> element
  293. <sup> Defines superscripted text
  294. <table> Defines a table
  295. <tbody> Groups the body content in a table
  296. <td> Defines a cell in a table
  297. <textarea> Defines a multiline input control (text area)
  298. <tfoot> Groups the footer content in a table
  299. <th> Defines a header cell in a table
  300. <thead> Groups the header content in a table
  301. <time> Defines a date/time
  302. <title> Defines a title for the document
  303. <tr> Defines a row in a table
  304. <track> Defines text tracks for media elements (<video> and <audio>)
  305. <tt> Not supported in HTML5. Use CSS instead.
  306. Defines teletype text
  307. <u> Defines text that should be stylistically different from normal text
  308. <ul> Defines an unordered list
  309. <var> Defines a variable
  310. <video> Defines a video or movie
  311. <wbr> Defines a possible line-break
  312. </code>
  313. </p>
  314.  
  315. <p>For comments and suggestions, please write to <a href="mailto:[email protected]">[email protected]</a>.<br/>
  316. The GitHub page of this script is <a href="http://github.com/sahwar/">http://github.com/sahwar/</a></p>
  317. </body>
  318. </html>
Advertisement
Add Comment
Please, Sign In to add comment