There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(