<?php
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id: spoilerimg.php 5016 2010-11-1 00:24:02Z Lorataco $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("parse_message", "spoilerimg_run");
function spoilerimg_info()
{
return array(
'name' => 'Spoiler img',
'description' => 'Un spoiler donde podras poner imagenes muy grandes',
'website' => 'www.zero-strike.es',
'version' => '1.0',
'author' => 'Lorataco con la ayuda de Edson',
'authorsite' => 'http://zero-strike.es/',
'guid' => 'Lo'
);
}
function spoilerimg_activate(){
}
global $db, $mybb;
$spoilerimg = array(
"sid" => "NULL",
"name" => "spoilerimg",
"title" => "Hide",
"description" => "pon aqui la imagen que quieras para el boton hide",
"optionscode" => "text",
"value" => 'http://i40.tinypic.com/2m6347t.png',
"disporder" => '1',
"gid" => intval($gid),
);
$spoilerimg2 = array(
"sid" => "NULL",
"name" => "spoilerimg2",
"title" => "Show",
"description" => "pon aqui la imagen que quieras para el boton show",
"optionscode" => "text",
"value" => 'http://i42.tinypic.com/nmkz6w.jpg',
"disporder" => '1',
"gid" => intval($gid),
);
$db->insert_query("settings", $spoilerimg);
$gid = $db->insert_id();
function spoilerimg_deactivate(){
}
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='spoilerimg'");
function spoilerimg_run($message)
{
$aviso = "<div><div><input name=\"spoiler\" type=\"image\" src=\"http://i42.tinypic.com/nmkz6w.jpg\" onClick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.src = 'http://i40.tinypic.com/2m6347t.png'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.src = 'http://i42.tinypic.com/nmkz6w.jpg'; }\">
</div>
<div style=\"margin: 0px; padding:0px;\">
<div style=\"display: none;\">
$1
</div>
</div>
</div>;
$patron = \"[spoilerimg\](.*?)\[/spoilerimg\]";
$message = preg_replace($patron, $aviso, $message);
}
?>