{"id":2025,"date":"2008-01-12T07:12:22","date_gmt":"2008-01-12T14:12:22","guid":{"rendered":"http:\/\/www.andreaswacker.com\/blog\/?p=1007"},"modified":"2008-01-12T07:12:22","modified_gmt":"2008-01-12T14:12:22","slug":"use-html-code-in-wikimedia","status":"publish","type":"post","link":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/","title":{"rendered":"use HTML code in Wikimedia"},"content":{"rendered":"<p>since it is pretty tricky to google for, here the <strike>wonderful<\/strike> scary as hell wikimedia addition that lets you add raw html code in your pages:<br \/>\n[make sure to read the end of this post]<\/p>\n<p><code><br \/>\n< ?php\n  # RawHtml.php - raw HTML extension\n  #\n  # Defines the tag pair <rawHtml>.<br \/>\n  # Sends the content out without any processing.<br \/>\n  #<br \/>\n  # To use, include this file into your LocalSettings.php<br \/>\n  # To configure, set members of $wgRawHtml after the inclusion.<br \/>\n  #<br \/>\n  #   include 'RawHtml.php';<br \/>\n  #<br \/>\n  #   $wgRawHtml = array('JoeUser', 'JoeUserBot')<br \/>\n  #<br \/>\n  # Adapted from code by Jan Steinman <jan @...><\/p>\n<p>  class raw_html_settings { };<\/p>\n<p>  $wgRawHtml              = new raw_html_settings;<br \/>\n  $wgExtensionFunctions[] = 'wf_raw_html_ext';<\/p>\n<p>  function wf_raw_html_ext() {<\/p>\n<p>    global $wgParser;<\/p>\n<p>    $wgParser->setHook('RawHtml', 'render_raw_html');<br \/>\n  }<\/p>\n<p>  function render_raw_html($raw_html_src, $style='') {<\/p>\n<p>    return $raw_html_src;<br \/>\n  }<br \/>\n?><br \/>\n<\/jan><\/code><\/p>\n<p>found <a href=\"http:\/\/www.nabble.com\/image-map-addressing-oddities-to3932459.html\">here<\/a>.<\/p>\n<p>It really is easy to use: Just add the file as RawHtml.php and then add in the end of LocalSettings.php the following lines:<\/p>\n<p><code><br \/>\ninclude 'RawHtml.php';<br \/>\n$wgRawHtml = array('user-name-to-use-this-goes-here' , 'this-would-be-a-second-one');<br \/>\n<\/code><\/p>\n<p>It turns out that the user names get absolutely ignored. So actually this is really dangerous to do, since ANYBODY that can edit the wiki can also insert any html code. Which is ok in a non public wiki, but NOT out there on those internets.<\/p>\n<p>So the code above is plain malware: A bot could crawl the sources of wikis and could insert any html that might please in those pages. Allot of harm can be done that way.<\/p>\n<p>For a decent explaination how to add your own addition look <a href=\"http:\/\/planetozh.com\/blog\/2006\/05\/how-to-add-a-custom-function-to-mediawiki\/\">here<\/a><\/p>\n<p>I ended up boiling up a couple of probably horrible php lines myself:<\/p>\n<p><code><br \/>\n?php<br \/>\n#mimg.php<br \/>\n#insert image in wikimedia pages.<br \/>\n#to use add code like:<\/p>\n<p>#<mimg>\/path\/to\/image.png<\/mimg><\/p>\n<p>#please note that I have no freaking clue what I am doing.<\/p>\n<p>#this will only work with local links to images, since all<br \/>\n#characters apart from numbers, letters slash and dot will be filtered when rendered<br \/>\n#to install save this in a file and include in LocalSettings.php<\/p>\n<p>class mimgclass { };<\/p>\n<p>$mimgo = new mimgclass;<br \/>\n$wgExtensionFunctions[] = 'installmimg';<\/p>\n<p>function installmimg() {<br \/>\nglobal $wgParser;<br \/>\n$wgParser->setHook('mimg', 'mrender_mimg');<br \/>\n}<\/p>\n<p>function mrender_mimg($mimg, $style='') {<br \/>\n$mimg = preg_replace ('\/[^a-zA-Z0-9\\\/\\.]\/' ,\"\",$mimg);<br \/>\n    return \"<img decoding=\"async\" src=\"\" . $mimg . \"\"\/>\";<br \/>\n  }<br \/>\n?><\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>since it is pretty tricky to google for, here the wonderful scary as hell wikimedia addition that lets you add raw html code in your pages: [make sure to read the end of this post] < ?php # RawHtml.php - raw HTML extension # # Defines the tag pair . # Sends the content out [&hellip;]\n<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,7,19],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>use HTML code in Wikimedia - Andreas Wacker<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"use HTML code in Wikimedia - Andreas Wacker\" \/>\n<meta property=\"og:description\" content=\"since it is pretty tricky to google for, here the wonderful scary as hell wikimedia addition that lets you add raw html code in your pages: [make sure to read the end of this post] &lt; ?php # RawHtml.php - raw HTML extension # # Defines the tag pair . # Sends the content out [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\" \/>\n<meta property=\"og:site_name\" content=\"Andreas Wacker\" \/>\n<meta property=\"article:published_time\" content=\"2008-01-12T14:12:22+00:00\" \/>\n<meta name=\"author\" content=\"1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@_andreaswacker\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"1\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\"},\"author\":{\"name\":\"1\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/691b5221b886b3b09742e476a16e5631\"},\"headline\":\"use HTML code in Wikimedia\",\"datePublished\":\"2008-01-12T14:12:22+00:00\",\"dateModified\":\"2008-01-12T14:12:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\"},\"wordCount\":172,\"publisher\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a\"},\"articleSection\":[\"internet\",\"malware\",\"technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\",\"url\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\",\"name\":\"use HTML code in Wikimedia - Andreas Wacker\",\"isPartOf\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#website\"},\"datePublished\":\"2008-01-12T14:12:22+00:00\",\"dateModified\":\"2008-01-12T14:12:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.andreaswacker.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"use HTML code in Wikimedia\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#website\",\"url\":\"https:\/\/www.andreaswacker.com\/blog\/\",\"name\":\"Andreas Wacker\",\"description\":\"weblog\",\"publisher\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.andreaswacker.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a\",\"name\":\"Andreas Wacker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.andreaswacker.com\/blog\/wp-content\/uploads\/2024\/06\/awfavion.png\",\"contentUrl\":\"https:\/\/www.andreaswacker.com\/blog\/wp-content\/uploads\/2024\/06\/awfavion.png\",\"width\":248,\"height\":248,\"caption\":\"Andreas Wacker\"},\"logo\":{\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.andreaswacker.com\",\"https:\/\/www.instagram.com\/_andreaswacker\/\",\"https:\/\/x.com\/_andreaswacker\",\"https:\/\/www.youtube.com\/channel\/UCWwFtVC_HATVr-R5EiNmhHw\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/691b5221b886b3b09742e476a16e5631\",\"name\":\"1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"1\"},\"url\":\"https:\/\/www.andreaswacker.com\/blog\/author\/1\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"use HTML code in Wikimedia - Andreas Wacker","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/","og_locale":"en_US","og_type":"article","og_title":"use HTML code in Wikimedia - Andreas Wacker","og_description":"since it is pretty tricky to google for, here the wonderful scary as hell wikimedia addition that lets you add raw html code in your pages: [make sure to read the end of this post] < ?php # RawHtml.php - raw HTML extension # # Defines the tag pair . # Sends the content out [&hellip;]","og_url":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/","og_site_name":"Andreas Wacker","article_published_time":"2008-01-12T14:12:22+00:00","author":"1","twitter_card":"summary_large_image","twitter_site":"@_andreaswacker","twitter_misc":{"Written by":"1","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#article","isPartOf":{"@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/"},"author":{"name":"1","@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/691b5221b886b3b09742e476a16e5631"},"headline":"use HTML code in Wikimedia","datePublished":"2008-01-12T14:12:22+00:00","dateModified":"2008-01-12T14:12:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/"},"wordCount":172,"publisher":{"@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a"},"articleSection":["internet","malware","technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/","url":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/","name":"use HTML code in Wikimedia - Andreas Wacker","isPartOf":{"@id":"https:\/\/www.andreaswacker.com\/blog\/#website"},"datePublished":"2008-01-12T14:12:22+00:00","dateModified":"2008-01-12T14:12:22+00:00","breadcrumb":{"@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.andreaswacker.com\/blog\/2008\/01\/12\/use-html-code-in-wikimedia\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.andreaswacker.com\/blog\/"},{"@type":"ListItem","position":2,"name":"use HTML code in Wikimedia"}]},{"@type":"WebSite","@id":"https:\/\/www.andreaswacker.com\/blog\/#website","url":"https:\/\/www.andreaswacker.com\/blog\/","name":"Andreas Wacker","description":"weblog","publisher":{"@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.andreaswacker.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/c1f46a348eafeb52ee54843dce18442a","name":"Andreas Wacker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.andreaswacker.com\/blog\/wp-content\/uploads\/2024\/06\/awfavion.png","contentUrl":"https:\/\/www.andreaswacker.com\/blog\/wp-content\/uploads\/2024\/06\/awfavion.png","width":248,"height":248,"caption":"Andreas Wacker"},"logo":{"@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.andreaswacker.com","https:\/\/www.instagram.com\/_andreaswacker\/","https:\/\/x.com\/_andreaswacker","https:\/\/www.youtube.com\/channel\/UCWwFtVC_HATVr-R5EiNmhHw"]},{"@type":"Person","@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/691b5221b886b3b09742e476a16e5631","name":"1","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.andreaswacker.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"1"},"url":"https:\/\/www.andreaswacker.com\/blog\/author\/1\/"}]}},"_links":{"self":[{"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/posts\/2025"}],"collection":[{"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/comments?post=2025"}],"version-history":[{"count":0,"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/posts\/2025\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/media?parent=2025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/categories?post=2025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.andreaswacker.com\/blog\/wp-json\/wp\/v2\/tags?post=2025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}