Я сделал себе много ББ кодов, по одному и тому же принципу, но в один прекрасный момент решил обновить свой пост и добавить этот тег, но он не стал просто-напросто парситься. Остальные же теги, которые я делал по такому же принципу - работают. В чем может быть проблема?
Вот инструкция, моего мода:
===============================================================
Открыть файл sources/lib/post_parser.php
===============================================================
Найти:
================================================================================
==
//---------------------------------
// Do [QUOTE(name,date)] tags
//---------------------------------
// Find the first, and last quote tag (greedy match)...
$txt = preg_replace( "#(\[quote(.+?)?\].*\[/quote\])#ies" , "\$this->regex_parse_quotes('\\1')" , $txt );
================================================================================
===
Ниже добавить:
================================================================================
==
//---------------------------------
// Do [note] tags
//---------------------------------
// Find the first, and last quote tag (greedy match)...
$txt = preg_replace( "#(\[note].*\[/note\])#ies" , "\$this->regex_parse_note('\\1')" , $txt );
================================================================================
==
Найти:
================================================================================
==
$txt = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , '[QUOTE]' , $txt );
$txt = preg_replace( "#<!--QuoteBegin--(.+?)\+-->(.+?)<!--QuoteEBegin-->#" , "[QUOTE=\\1]" , $txt );
$txt = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "[QUOTE=\\1,\\2]" , $txt );
$txt = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , '[/QUOTE]' , $txt );
================================================================================
==
Ниже добавить:
================================================================================
==
$txt = preg_replace( "#<!--noteBegin-->(.+?)<!--noteEBegin-->#" , '[note]' , $txt );
$txt = preg_replace( "#<!--noteEnd-->(.+?)<!--noteEEnd-->#" , '[/note]' , $txt );
================================================================================
==
Найти:
================================================================================
==
//-----------------------------
// This returns two array elements:
// START: Contains the HTML code for the start wrapper
// END : Contains the HTML code for the end wrapper
//-----------------------------
$possible_use = array( 'CODE' => array( 'CODE', 'CODE' ),
'QUOTE' => array( 'QUOTE',
================================================================================
==
Ниже добавить:
================================================================================
==
'note' => array( 'note', 'O F F T O P I C:' ),
================================================================================
==
Найти:
================================================================================
==
function regex_parse_quotes($the_txt="") {
if ($the_txt == "") return;
$txt = $the_txt;
// Too many embedded code/quote/html/sql tags can crash Opera and Moz
/*if (preg_match( "/\[(quote|code|html|sql)\].+?\[(quote|code|html|sql)\].+?\[(quote|code|html|sql)\].+?\[(quote|code|html|sql)\].+?\[(quote|code|html|sql)\]/is", $txt) ) {
$this->quote_error++;
return $txt;
}*/
$this->quote_html = $this->wrap_style( array( 'STYLE' => 'QUOTE' ) );
$txt = preg_replace( "#\[quote\]#ie" , "\$this->regex_simple_quote_tag()" , $txt );
$txt = preg_replace( "#\[quote=([^\]]+?),([^\]]+?)\]#ie" , "\$this->regex_quote_tag('\\1', '\\2')" , $txt );
$txt = preg_replace( "#\[quote=([^\]]+?)\]#ie" , "\$this->regex_quote_tag('\\1', '')" , $txt );
$txt = preg_replace( "#\[/quote\]#ie" , "\$this->regex_close_quote()" , $txt );
$txt = preg_replace( "/\n/", "<br>", $txt );
if ( ($this->quote_open == $this->quote_closed) and ($this->quote_error == 0) )
{
$txt = preg_replace( "#(<!--QuoteEBegin-->.+?<!--QuoteEnd-->)#es", "\$this->regex_preserve_spacing('\\1')", trim($txt) );
return $txt;
}
else
{
return $the_txt;
}
}
================================================================================
==
ниже добавить:
================================================================================
==
/**************************************************/
// regex_parse_note: Builds this note tag HTML
// [note] .. [/note]
/**************************************************/
function regex_parse_note($the_txt="") {
if ($the_txt == "") return;
$txt = $the_txt;
$this->note_html = $this->wrap_style( array( 'STYLE' => 'note' ) );
$txt = preg_replace( "#\[note\]#ie" , "\$this->regex_simple_note_tag()" , $txt );
$txt = preg_replace( "#\[/note\]#ie" , "\$this->regex_close_note()" , $txt );
$txt = preg_replace( "/\n/", "<br>", $txt );
if ( ($this->note_open == $this->note_closed) ) {
// Preserve spacing
$txt = preg_replace( "#(<!--noteEBegin-->.+?<!--noteEnd-->)#es", "\$this->regex_preserve_spacing('\\1')", trim($txt) );
return $txt;
} else {
return $the_txt;
}
}
================================================================================
==
Найти:
================================================================================
==
function regex_close_quote() {
if ($this->quote_open == 0) {
$this->quote_error++;
return;
}
$this->quote_closed++;
return "<!--QuoteEnd-->{$this->quote_html['END']}<!--QuoteEEnd-->";
}
================================================================================
==
Ниже добавить:
================================================================================
==
/**************************************************/
// regex_simple_note_tag: Builds this note tag HTML
// [note] .. [/note]
/**************************************************/
function regex_simple_note_tag() {
global $ibforums;
$this->note_open++;
return "<!--noteBegin-->{$this->note_html['START']}<!--noteEBegin-->";
}
/**************************************************/
// regex_close_note: closes a note tag
//
/**************************************************/
function regex_close_note() {
if ($this->note_open == 0) {
$this->note_error++;
return;
}
$this->note_closed++;
return "<!--noteEnd-->{$this->note_html['END']}<!--noteEEnd-->";
}
================================================================================
==
Сохраните изменения и загрузите на место файл sources/lib/post_parser.php
Зайдите в Админцентр и перейдите в меню:
Скины и шаблоны > Стили > Редактировать
(В английской админке это Skins & Templates > Style Sheets > Edit)
Найдите там:
================================================================================
==
#QUOTE { font-family: Verdana, Arial; font-size: 8pt; color: #333333; background-color: #FAFCFE; border: 1px solid Black; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px }
================================================================================
==
Ниже добавьте:
================================================================================
==
#note { font-family: Verdana, Arial; font-size: 8pt; color: #333333; border: 0px solid Black; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px }
================================================================================
==
[1125312778:1125313007]В других постах он работает. А в этом нет. Как так?
Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.
Вопрос
Jax
Я сделал себе много ББ кодов, по одному и тому же принципу, но в один прекрасный момент решил обновить свой пост и добавить этот тег, но он не стал просто-напросто парситься. Остальные же теги, которые я делал по такому же принципу - работают. В чем может быть проблема?
Вот инструкция, моего мода:
[1125312778:1125313007]В других постах он работает. А в этом нет. Как так?
Ссылка на комментарий
Поделиться на других сайтах
6 ответов на этот вопрос
Рекомендуемые сообщения
Присоединиться к обсуждению
Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.