2016-07-25, 07:09 AM
Hello everyone!
I have installed "My Spoiler" plugin in order to add spoiler functionality to my forum. It allowes to create spoilers with [spoiler][/spoiler] and also add bbcode to sceditor.
Everything worked fine but then I installed "Quick Advanced Editor" which (as I understand) only addes bbcodes panel to a quick reply editor.
The problem is that there is no spoiler button in it.
Both quick reply and new reply editors have the same "sceditor-toolbar" with the same buttons in it. The only difference is that there is no spoiler button in quick reply editor.
Here is "My Spoiler" activate function:
I have installed "My Spoiler" plugin in order to add spoiler functionality to my forum. It allowes to create spoilers with [spoiler][/spoiler] and also add bbcode to sceditor.
Everything worked fine but then I installed "Quick Advanced Editor" which (as I understand) only addes bbcodes panel to a quick reply editor.
The problem is that there is no spoiler button in it.
Both quick reply and new reply editors have the same "sceditor-toolbar" with the same buttons in it. The only difference is that there is no spoiler button in quick reply editor.
Here is "My Spoiler" activate function:
function myspoiler_activate()
{
// Creamos la hoja de estilo para el spoiler.
global $db;
$query_tid = $db->write_query("SELECT tid FROM ".TABLE_PREFIX."themes WHERE def='1'");
$themetid = $db->fetch_array($query_tid);
$estilo = array(
'name' => 'spoiler.css',
'tid' => $themetid['tid'],
'attachedto' => 'showthread.php|newthread.php|newreply.php|editpost.php|private.php|announcements.php',
'stylesheet' => '.spoiler {
background: #f5f5f5;
border: 1px solid #bbb;
margin-bottom: 15px;
border-radius: 5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
}
',
'lastmodified' => TIME_NOW
);
$sid = $db->insert_query('themestylesheets', $estilo);
$db->update_query('themestylesheets', array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
$query = $db->simple_select('themes', 'tid');
while($theme = $db->fetch_array($query))
{
require_once MYBB_ADMIN_DIR.'inc/functions_themes.php';
update_theme_stylesheet_list($theme['tid']);
}
require MYBB_ROOT.'inc/adminfunctions_templates.php';
// Reemplazos que vamos a hacer en las plantillas 1.- Platilla 2.- Contenido a Reemplazar 3.- Contenido que reemplaza lo anterior
find_replace_templatesets("codebuttons", '#'.preg_quote('<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js?ver=1804"></script>').'#', '<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js?ver=1804"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/spoiler.js?ver=1804"></script>');
find_replace_templatesets("codebuttons", '#'.preg_quote('{$link}').'#', '{$link},spoiler');
}