Чтото не работает, текст вообще исчез, я поставил конструкцию {spoiler}{/spoiler} и содержимое вовсе исчезло, может я как то не так поставил, вашу запись, вот полный измененный код
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class PlgContentPlg_Gugospoiler extends JPlugin {
public function onContentPrepare($context, &$row, &$params, $page = 1)
{
if (JString::strpos($row->text, '{spoiler}')!== false) {
$match_start = '{spoiler}';
$match_end = '{/spoiler}';
$row->text = str_replace(array('<p>{spoiler}</p>', '<p>{/spoiler}</p>'), array($match_start, $match_end), $text);
$html_start = '<div id="gugo_spoiler_content">';
$html_end = '</div><div class="br_right"><div id="gugo_spoiler_button">Читать полностью</div></div>';
$html_end .= '<form><input type="button" value="Назад на предыдущую страницу" onClick="history.back()"></form>';
$row->text = str_replace(array($match_start, $match_end), array($html_start, $html_end), $row->text);
}
return true;
}
}
к этому плагину так же прилагается java код, может в нем чтото не так из-за изменений,
jQuery(document).ready(function()
{jQuery('#gugo_spoiler_content').hide()
if (jQuery(".products_related_scroll").length>0)
{
jQuery(".products_related_scroll").mCustomScrollbar
({
horizontalScroll:true,
scrollButtons:
{
enable:true,
scrollType:"pixels",
scrollAmount:116
}
});
/* hide here couse this will nead to be parsed */
jQuery(".products_related_scroll").hide();
jQuery(".products_related_n").click(function()
{
jQuery(this).parent().parent().find('.products_related_scroll').toggle(200);
});
}
jQuery('#gugo_spoiler_button').click(function(){
if (jQuery('#gugo_spoiler_content').is(':visible')) {
jQuery('#gugo_spoiler_content').slideUp(1000);
jQuery('#gugo_spoiler_button').html('Читать полностью');
} else {
jQuery('#gugo_spoiler_content').slideDown(1000);
jQuery('#gugo_spoiler_button').html('Свернуть текст');
}
});
});
Кстати кнопку "назад" я вставил позже в плагин, это не его родной