Extension:AddHTML

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
AddHTML

Release status: stable

Implementation Tag
Description Used to securely insert HTML section(s) on a wiki page.
Author(s) Jean-Lou Dupont (Jldupont Talk)
Version 1.1
MediaWiki tested on 1.8.2
Download [1]

Contents

[edit] Better Option

See SecureHTML extension for a better solution.

[edit] Features

  • Secure: Only people who can edit 'protected' pages (sysops) can use the tag
  • Inserts HTML code section either through:
    • inline code without the tagged section e.g. <addhtml> code here </addhtml>
    • or through PHP code
  • Parser Cache friendly

[edit] Limitation

The tag can only be used on a pages which are 'protected', which means you might be forced to protect a page in order to use some HTML, which otherwise you would permit open editing on.

[edit] Example1

<addhtml id=xyz />

and use an extension such as <runphp> to populate the section # 'xyz' with HTML code.

[edit] Example2

<addhtml><html>
<head>
<script type="text/javascript">
function disp_prompt()
  {
  var name=prompt("Please enter your name","t3h h4x0r")
  if (name!=null && name!="")
    {
    document.write("Hello " + name + "! How are you today?")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="disp_prompt()" value="CLICK!" />

</body>
</html></addhtml>

[edit] Security

Pages where 'addhtml' is used must be protected or else an 'unauthorized use of addhtml' message will be displayed. If you have several 'sysop' users, you must trust them all not to abuse this feature.


[edit] Changes to LocalSettings.php

require_once("$IP/extensions/ExtensionClass.php");
require_once("$IP/extensions/addHTML.php");
Personal tools