<?php
/**
* XS2:
*
* This file is developed by Solutecs, LLC for the purpose of the company
* and is provided together with XS2 Framework as and inherent part of the
* system. This file can be used on the terms of License Agreement.
*
* +7 (495) 585-0833 / 13 Rusakovskaya street, Moscow 107140 Russia
*
* @link http://www.solutecs.com
* @copyright ©1998-2007 Solutecs, LLC
* @package XS2-MODCOM
* @subpackage proc-forum
* @version 1.XX
*/
/**
* Библиотека для парсинга сообщений форума.
*
* Поведение: определяет модификаторы шаблонизатора.
* Параметры: отсутствуют.
* Подключается в метод функцией xs2Fetch в процессоре.
*/
$icons['nodes'] = xs2GetNodes(array('mod'=>'forum',
'NType'=>'icon'));
$icons['patterns'] = array();
$icons['images'] = array();
foreach($icons['nodes'] as $key=>$node) {
$icons['patterns'][] = '/'.preg_quote($node['NName']).'/';
$icons['images'][] = '<img src="'.$node['Icon']['path'].'"'
.' width="'.$node['Icon']['width'].'" '
.' height="'.$node['Icon']['height'].'"'
.' alt="'.$node['NName'].'" '
.' title="'.$node['NName'].'" '
.' class="parsedIcon" />';
}
$_HTML->assign('ForumConfigIcons', $icons);
function _ForumParseIcons1($input, $doParse=1) {
global $_HTML;
$icons = $_HTML->get_template_vars('ForumConfigIcons');
return 1==$doParse ? preg_replace($icons['patterns'], $icons['images'], $input) : $input;
}
$_HTML->register_modifier('ForumParseIcons', '_ForumParseIcons1');
function _ForumParseLineBreaks1($input, $doParse=1) {
return 1==$doParse ? preg_replace('/\n/', "<br class=\"parsedBreak\" />", $input) : $input;
}
$_HTML->register_modifier('ForumParseLineBreaks', '_ForumParseLineBreaks1');
function _ForumParseMessageNName1($NName, $Deleted=0) {
global $_HTML;
if(!$NName) $NName = '';
$NName = trim($NName);
$ForNoNName = $_HTML->get_template_vars('emptyMessageNNameLabel');
$ForDeleted = $_HTML->get_template_vars('deletedMessageLabel');
if(empty($NName) || 'message'==$NName || 'thread'==$NName)
$NName = '<span style="color:darkgreen">'.$ForNoNName.'</span>';
if($Deleted)
$NName = '<span style="color:darkred">'.$ForDeleted.'</span>';
return $NName;
}
$_HTML->register_modifier('ForumParseMessageNName', '_ForumParseMessageNName1');
?>
|
|