2012-04-19, 08:58 PM
Ok, I made a mycode spoiler and it worked in the MYCODE sandbox. I disabled all plugins and ran on the clean default templates, no changes.
The spoiler will not open.
Any ideas?
The spoiler will not open.
Any ideas?
<?php
$plugins->add_hook("parse_message", "spoiler_run");
function spoiler_info()
{
return array(
"name" => "Spoiler BBCode",
"description" => "Hides text specified in the [spoiler] tag.",
"website" => "http://www.sephiroth.ws",
"author" => "Sephiroth",
"authorsite" => "http://www.sephiroth.ws",
"version" => "1.6",
"guid" => "795e4538050784720a1196a8b6e8065f",
"compatibility" => "16*"
);
}
function spoiler_activate()
{
}
function spoiler_deactivate()
{
}
function spoiler_run($message)
{
// Assign pattern and replace values.
$pattern = array("#\[spoiler=(?:"|\"|')?(.*?)[\"']?(?:"|\"|')?\](.*?)\[\/spoiler\](\r\n?|\n?)#si", "#\[spoiler\](.*?)\[\/spoiler\](\r\n?|\n?)#si");
$replace = array("<div><div class=\"spoiler_header\">$1 <a href=\"javascript:void(0);\" onclick=\"javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='(Click to View)';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='(Click to Hide)';}\">(Click to View)</a></div><div class=\"spoiler_body\" style=\"display: none;\">$2</div></div>", "<div><div class=\"spoiler_header\">Spoiler <a href=\"javascript:void(0);\" onclick=\"javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='(Click to View)';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='(Click to Hide)';}\">(Click to View)</a></div><div class=\"spoiler_body\" style=\"display: none;\">$1</div></div>");
while(preg_match($pattern[0], $message) or preg_match($pattern[1], $message))
{
$message = preg_replace($pattern, $replace, $message);
}
$find = array(
"#<div class=\"spoiler_body\">(\r\n?|\n?)#",
"#(\r\n?|\n?)</div>#"
);
$replace = array(
"<div class=\"spoiler_body\">",
"</div>"
);
$message = preg_replace($find, $replace, $message);
return $message;
}
?>
Auto Unapprove Reported Posts (1.1)
Latest Downloads Stats on UserCP (1.1)
Cool Codes (1.24)
BBCode in Custom Profile Fields (1.0)
Creatorlink (1.1)
Custom Status (1.7)
Default Profile (2.1.0)
Latest Uploads Stats on UserCP (1.2)
Fresh Fish Attachments Gallery (1.1)
Game Section (1.2)
Gravatar (0.1)
Hide Sigs and Website of New Users (1.1)
Leesester's Graphs (1.0)
A plugin to display download information for Leefish
Forum Promotions (1.0)
Forum Name In Portal Announcement (1.0)
Format Name And Avatar In Thread List - XThreads Plugin (1.1)
Latest Or Random Images In Profile (1.0)
Display latest or random images in profile
Moderator notifications (1.5)
MyBBpublisher (1.7)
MyCodes Pack (1.0)
MyNetwork (1.1.2)
MyTracker (1.02)
Page Manager (1.5.2)
PHP and Template Conditionals (1.9)
Portal Pagination (1.0)
Portal Announcement Cut Off. (1.0)
Profile Comments (0.6.0)
Quick Theme! (1.1.2)
Registration Security Question (1.1)
RSS To Post (1.2.2)
SEO Titles (1.5)
Shadowbox.js (1.5)
Referral in Profile (1.1)
Spamalyser (0.92)
Thread Tooltip Preview (1.32)
Unapproved Threads (1.1)
View Unread Posts (2.6)
vB Style Quotes (1.13)
WhoIsInAjaxChat (0.4)
Wiki (Beta 3)
XThreads v1.47
XThreads Link Directory (1.0)
<a href="javascript:void(0);" onclick="javascript:if(parentNode.parentNode.getElementsByTagName('div')[1].style.display=='block'){parentNode.parentNode.getElementsByTagName('div')[1].style.display='none';this.innerHTML='(Click to View)';}else {parentNode.parentNode.getElementsByTagName('div')[1].style.display='block';this.innerHTML='(Click to Hide)';}">(Click to View)</a></div><div class="spoiler_body" style="display: none;">
(Click to Hide)
parentNode.parentNode.getElementsByTagName('div')